nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
nrfcxx::periph::RTC Class Reference

Wrapper around the nRF51 RTC peripheral. More...

#include <nrfcxx/periph.hpp>

Public Member Functions

uint32_t counter () const
 Return the underlying 24-bit counter value.
 
const nrf5::RTC_Typeperipheral () const
 Reference the nRF5 RTC peripheral instance used by the abstraction.
 
const unsigned int ccr_count () const
 The number of capture/compare registers on the device.
 

Static Public Member Functions

constexpr static unsigned int counter_delta (uint32_t a, uint32_t b)
 Calculate the tick-count between two counter values. More...
 
static RTCinstance (int idx)
 Reference the abstraction instance for a specific peripheral instance. More...
 

Static Public Attributes

constexpr static uint32_t counter_modulus = (1U << 24)
 Modulus for the 24-bit RTC counter.
 
constexpr static uint32_t counter_mask = (counter_modulus - 1)
 Mask for the 24-bit RTC counter.
 

Protected Member Functions

constexpr RTC (const nrf5::RTC_Type &rtc)
 

Detailed Description

Wrapper around the nRF51 RTC peripheral.

Note
When a soft device is used RTC0 is restricted to the soft device. RTC1 is available to applications, but is probably taken by clock::uptime.

Member Function Documentation

◆ counter_delta()

constexpr static unsigned int nrfcxx::periph::RTC::counter_delta ( uint32_t  a,
uint32_t  b 
)
inlinestaticconstexpr

Calculate the tick-count between two counter values.

Returns
The value that when added to counter value a would produce counter value b.
Note
a and b are assumed to be 24-bit counter values; if bits are set outside counter_mask the result may be incorrect.

◆ instance()

static RTC& nrfcxx::periph::RTC::instance ( int  idx)
static

Reference the abstraction instance for a specific peripheral instance.

Parameters
idxthe peripheral instance desired.
Warning
If idx specifies a peripheral instance that does not exist on the device the system will reset into failsafe mode with FailSafeCode::NO_SUCH_PERIPHERAL.

The documentation for this class was generated from the following file: