nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Data Structures | Namespaces | Macros | Typedefs | Enumerations | Functions
core.hpp File Reference

Primary header for nrfcxx interface dependencies. More...

#include <cstddef>
#include <cstdint>
#include <functional>
#include <pabigot/container.hpp>
#include <nrfcxx/version.hpp>
#include <nrfcxx/nrf51/core.hpp>

Go to the source code of this file.

Data Structures

struct  nrfcxx::nrf5::peripheral< S >
 Capture information about an nRF5 peripheral instance. More...
 
struct  nrfcxx::nrf5::GPIO_Instance< I >
 A traits type identifying GPIO peripheral instances. More...
 
class  nrfcxx::null_mutex
 RAII class that performs no mutex operations. More...
 
class  nrfcxx::primask
 RAII class to block exceptions. More...
 
class  nrfcxx::nvic_BlockIRQ
 RAII class to block a peripheral interrupt. More...
 
class  nrfcxx::mutex_irq< IRQn >
 nvic_BlockIRQ as a template type. More...
 
class  nrfcxx::event_set
 A record of events that occur asynchonously. More...
 
class  nrfcxx::event_set_copy
 A helper class for processing snapshot nrfcxx::event_set values. More...
 
class  nrfcxx::systemState
 A class supporting watchdog configuration and cross-reset retention of state. More...
 
class  nrfcxx::systemState::scoped_sleeper
 RAII instance that configures the operational mode to enter OM_SLEEP when constructed, and to leave OM_SLEEP when destructed. More...
 
struct  nrfcxx::systemState::state_type
 The raw data supporting cross-reset state transfer. More...
 
class  nrfcxx::watchdog_extended_channel
 Support for extended watchdog channels. More...
 

Namespaces

 nrfcxx
 Primary namespace for nrfcxx functionality.
 
 nrfcxx::board
 Namespace holding board-specific configuration data.
 
 nrfcxx::nrf5
 Namespace holding support for bare nRF5 peripheral instances.
 
 nrfcxx::nrf5::series
 Namespace holding series-specific implementations that support the genericized API of nrfcxx.
 
 nrfcxx::sensor
 Namespace for abstractions of various sensors.
 
 nrfcxx::misc
 Namespace for abstractions that aren't handled in another namespace.
 

Macros

#define NRFCXX_FAKED   0
 Macro defined to an nRF5 series number for host-based testing. More...
 
#define NRF_SERIES   51
 Nordic nRF5 series. More...
 
#define ADCSeriesVariant_IRQHandler   [SA]ADC_IRQHandler
 Identifier for series-specific ADC IRQ entrypoint. More...
 
#define NRFCXX_CROSS_COMPILING   1
 Macro defined to preprocessor true when cross-compiling. More...
 

Typedefs

using nrfcxx::notifier_type = std::function< void()>
 Type used to hold a notifier. More...
 

Enumerations

enum  nrfcxx::FailSafeCode : unsigned int {
  nrfcxx::FailSafeCode::SYSTEM_BASE = 0xbad00000, nrfcxx::FailSafeCode::NO_SUCH_PERIPHERAL = SYSTEM_BASE + 1, nrfcxx::FailSafeCode::MEMORY_POOL = SYSTEM_BASE + 2, nrfcxx::FailSafeCode::HEAP_OVERRUN = SYSTEM_BASE + 3,
  nrfcxx::FailSafeCode::STACK_OVERFLOW = SYSTEM_BASE + 4, nrfcxx::FailSafeCode::PERSIST_VIOLATION = SYSTEM_BASE + 5, nrfcxx::FailSafeCode::INTERNAL_ERROR = SYSTEM_BASE + 6, nrfcxx::FailSafeCode::INCOMPLETE_SETUP = SYSTEM_BASE + 7,
  nrfcxx::FailSafeCode::RESOURCE_VIOLATION = SYSTEM_BASE + 8, nrfcxx::FailSafeCode::API_VIOLATION = SYSTEM_BASE + 9, nrfcxx::FailSafeCode::BOARD_INIT_FAILURE = SYSTEM_BASE + 10, nrfcxx::FailSafeCode::EVENT_LOOP_TERMINATED = SYSTEM_BASE + 11,
  nrfcxx::FailSafeCode::APPLICATION_BASE = 0xbad10000
}
 Enumerated constants used in failsafe() calls. More...
 

Functions

int nrfcxx::board::initialize (bool enable_hfxt=false)
 Perform board-specific initialization. More...
 
void nrfcxx::delay_us (unsigned int number_of_us)
 Delay for exactly the specified duration. More...
 
void nrfcxx::sleep_ms (unsigned int dur_ms)
 Sleep for the specified duration. More...
 
static void nrfcxx::nvic_EnableIRQ (int irqn)
 Wrapper around NVIC_EnableIRQ to work around issues with peripheral::IRQn.
 
static void nrfcxx::nvic_DisableIRQ (int irqn)
 Wrapper around NVIC_DisableIRQ to work around issues with peripheral::IRQn.
 
static void nrfcxx::nvic_GetPendingIRQ (int irqn)
 Wrapper around NVIC_GetPending to work around issues with peripheral::IRQn.
 
static void nrfcxx::nvic_SetPendingIRQ (int irqn)
 Wrapper around NVIC_SetPending to work around issues with peripheral::IRQn.
 
static void nrfcxx::nvic_ClearPendingIRQ (int irqn)
 Wrapper around NVIC_ClearPending to work around issues with peripheral::IRQn.
 
static void nrfcxx::nvic_SetPriority (int irqn, uint32_t priority)
 Wrapper around NVIC_SetPriority to work around issues with peripheral::IRQn.
 
static void nrfcxx::nvic_GetPriority (int irqn)
 Wrapper around NVIC_GetPriority to work around issues with peripheral::IRQn.
 
static FailSafeCode nrfcxx::operator+ (const FailSafeCode &lhs, unsigned int incr)
 
void nrfcxx::failsafe (FailSafeCode code)
 Record a critical system failure and reset the system. More...
 
void nrfcxx::failsafe (unsigned int code)
 
int nrfcxx::stack_space_remaining ()
 Determine how much of the reserved stack space remains. More...
 
void nrfcxx::validate_stack_pointer ()
 Force a system failure if the stack is beyond its configured maximum depth. More...
 
unsigned int nrfcxx::stack_fill_unused (unsigned int marker)
 Fill all space between the top of the heap and the current stack pointer with the provided value. More...
 
unsigned int nrfcxx::stack_infer_highwater (unsigned int marker)
 Check the space between the top of the heap and the current stack pointer for matches to the provided marker. More...
 
uint32_t nrfcxx::application_crc32 (bool exclude_data=false)
 Calculate a checksum of the application content. More...
 

Detailed Description

Primary header for nrfcxx interface dependencies.

Including this module introduces a dependency on CMSIS headers and Nordic device peripheral structures. It does not import the Nordic device bitfield macro definitions as with <nrfcxx/impl.hpp>.

The nrfcxx namespace defines nrfcxx::peripheral instances for all peripherals on the supported product, such as CLOCK, TWI0, or SAADC. Some peripherals are common and compatible between products; others are only available on a specific product. Note that these objects appear in the documentation regardless of series and availability on a specific product.

Mutex support classes:

Macro Definition Documentation

◆ ADCSeriesVariant_IRQHandler

#define ADCSeriesVariant_IRQHandler   [SA]ADC_IRQHandler

Identifier for series-specific ADC IRQ entrypoint.

For nRF51 this is ADC_IRQHandler. For nRF52 this is SAADC_IRQHandler. The define is provided by the series-specific core.hpp header.

◆ NRF_SERIES

#define NRF_SERIES   51

Nordic nRF5 series.

Derived from the externally provided device identifier (NRF51, NRF52832, etc) this is used in preprocessor directives when series-specific API is required. The value is either 51 or 52.

◆ NRFCXX_CROSS_COMPILING

#define NRFCXX_CROSS_COMPILING   1

Macro defined to preprocessor true when cross-compiling.

This is defined to preprocessor false when building on a host for non-embedded testing of implementation.

◆ NRFCXX_FAKED

#define NRFCXX_FAKED   0

Macro defined to an nRF5 series number for host-based testing.

When defined to a non-zero value this causes the nRF5 register, bitfield, and CMSIS headers to be included even when not cross-compiling. This allows references to structures and constants in header files even though the execution environment won't provide them.

In that situation NRFCXX_CROSS_COMPILING should be a preprocessor false (i.e. 0).