Hardware access layer for managing the Real Time Counter (RTC) peripheral. More...
Macros | |
#define | NRF_RTC_CC_CHANNEL_COUNT(id) NRFX_CONCAT_3(RTC, id, _CC_NUM) |
Macro for getting the number of compare channels available in a given RTC instance. | |
#define | NRF_RTC_COUNTER_MAX RTC_COUNTER_COUNTER_Msk |
Maximum value of the RTC counter. | |
#define | RTC_INPUT_FREQ 32768 |
Input frequency of the RTC instance. | |
#define | RTC_FREQ_TO_PRESCALER(FREQ) (uint16_t)(((RTC_INPUT_FREQ) / (FREQ)) - 1) |
Macro for converting expected frequency to prescaler setting. | |
#define | RTC_WRAP(val) ((val) & RTC_COUNTER_COUNTER_Msk) |
Macro for trimming values to the RTC bit width. | |
#define | RTC_CHANNEL_INT_MASK(ch) ((uint32_t)(NRF_RTC_INT_COMPARE0_MASK) << (ch)) |
Macro for creating the interrupt bitmask for the specified compare channel. | |
#define | RTC_CHANNEL_EVENT_ADDR(ch) (nrf_rtc_event_t)((NRF_RTC_EVENT_COMPARE_0) + (ch) * sizeof(uint32_t)) |
Macro for obtaining the compare event for the specified channel. | |
Enumerations | |
enum | nrf_rtc_task_t { NRF_RTC_TASK_START = offsetof(NRF_RTC_Type,TASKS_START), NRF_RTC_TASK_STOP = offsetof(NRF_RTC_Type,TASKS_STOP), NRF_RTC_TASK_CLEAR = offsetof(NRF_RTC_Type,TASKS_CLEAR), NRF_RTC_TASK_TRIGGER_OVERFLOW = offsetof(NRF_RTC_Type,TASKS_TRIGOVRFLW), NRF_RTC_TASK_CAPTURE_0 = offsetof(NRF_RTC_Type,TASKS_CAPTURE[0]), NRF_RTC_TASK_CAPTURE_1 = offsetof(NRF_RTC_Type,TASKS_CAPTURE[1]), NRF_RTC_TASK_CAPTURE_2 = offsetof(NRF_RTC_Type,TASKS_CAPTURE[2]), NRF_RTC_TASK_CAPTURE_3 = offsetof(NRF_RTC_Type,TASKS_CAPTURE[3]) } |
RTC tasks. More... | |
enum | nrf_rtc_event_t { NRF_RTC_EVENT_TICK = offsetof(NRF_RTC_Type,EVENTS_TICK), NRF_RTC_EVENT_OVERFLOW = offsetof(NRF_RTC_Type,EVENTS_OVRFLW), NRF_RTC_EVENT_COMPARE_0 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[0]), NRF_RTC_EVENT_COMPARE_1 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[1]), NRF_RTC_EVENT_COMPARE_2 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[2]), NRF_RTC_EVENT_COMPARE_3 = offsetof(NRF_RTC_Type,EVENTS_COMPARE[3]) } |
RTC events. More... | |
enum | nrf_rtc_int_t { NRF_RTC_INT_TICK_MASK = RTC_INTENSET_TICK_Msk, NRF_RTC_INT_OVERFLOW_MASK = RTC_INTENSET_OVRFLW_Msk, NRF_RTC_INT_COMPARE0_MASK = RTC_INTENSET_COMPARE0_Msk, NRF_RTC_INT_COMPARE1_MASK = RTC_INTENSET_COMPARE1_Msk, NRF_RTC_INT_COMPARE2_MASK = RTC_INTENSET_COMPARE2_Msk, NRF_RTC_INT_COMPARE3_MASK = RTC_INTENSET_COMPARE3_Msk } |
RTC interrupts. More... | |
Functions | |
NRF_STATIC_INLINE void | nrf_rtc_cc_set (NRF_RTC_Type *p_reg, uint32_t ch, uint32_t cc_val) |
Function for setting a compare value for a channel. More... | |
NRF_STATIC_INLINE uint32_t | nrf_rtc_cc_get (NRF_RTC_Type const *p_reg, uint32_t ch) |
Function for returning the compare value for a channel. More... | |
NRF_STATIC_INLINE void | nrf_rtc_int_enable (NRF_RTC_Type *p_reg, uint32_t mask) |
Function for enabling interrupts. More... | |
NRF_STATIC_INLINE void | nrf_rtc_int_disable (NRF_RTC_Type *p_reg, uint32_t mask) |
Function for disabling interrupts. More... | |
NRF_STATIC_INLINE uint32_t | nrf_rtc_int_enable_check (NRF_RTC_Type const *p_reg, uint32_t mask) |
Function for checking if the specified interrupts are enabled. More... | |
NRF_STATIC_INLINE void | nrf_rtc_subscribe_set (NRF_RTC_Type *p_reg, nrf_rtc_task_t task, uint8_t channel) |
Function for setting the subscribe configuration for a given RTC task. More... | |
NRF_STATIC_INLINE void | nrf_rtc_subscribe_clear (NRF_RTC_Type *p_reg, nrf_rtc_task_t task) |
Function for clearing the subscribe configuration for a given RTC task. More... | |
NRF_STATIC_INLINE void | nrf_rtc_publish_set (NRF_RTC_Type *p_reg, nrf_rtc_event_t event, uint8_t channel) |
Function for setting the publish configuration for a given RTC event. More... | |
NRF_STATIC_INLINE void | nrf_rtc_publish_clear (NRF_RTC_Type *p_reg, nrf_rtc_event_t event) |
Function for clearing the publish configuration for a given RTC event. More... | |
NRF_STATIC_INLINE bool | nrf_rtc_event_check (NRF_RTC_Type const *p_reg, nrf_rtc_event_t event) |
Function for retrieving the state of the RTC event. More... | |
NRF_STATIC_INLINE void | nrf_rtc_event_clear (NRF_RTC_Type *p_reg, nrf_rtc_event_t event) |
Function for clearing an event. More... | |
NRF_STATIC_INLINE uint32_t | nrf_rtc_counter_get (NRF_RTC_Type const *p_reg) |
Function for returning a counter value. More... | |
NRF_STATIC_INLINE void | nrf_rtc_prescaler_set (NRF_RTC_Type *p_reg, uint32_t val) |
Function for setting a prescaler value. More... | |
NRF_STATIC_INLINE uint32_t | nrf_rtc_prescaler_get (NRF_RTC_Type const *p_reg) |
Function for getting a prescaler value. More... | |
NRF_STATIC_INLINE uint32_t | nrf_rtc_event_address_get (NRF_RTC_Type const *p_reg, nrf_rtc_event_t event) |
Function for returning the address of an event. More... | |
NRF_STATIC_INLINE uint32_t | nrf_rtc_task_address_get (NRF_RTC_Type const *p_reg, nrf_rtc_task_t task) |
Function for returning the address of a task. More... | |
NRF_STATIC_INLINE void | nrf_rtc_task_trigger (NRF_RTC_Type *p_reg, nrf_rtc_task_t task) |
Function for starting a task. More... | |
NRF_STATIC_INLINE void | nrf_rtc_event_enable (NRF_RTC_Type *p_reg, uint32_t mask) |
Function for enabling events. More... | |
NRF_STATIC_INLINE void | nrf_rtc_event_disable (NRF_RTC_Type *p_reg, uint32_t event) |
Function for disabling an event. More... | |
NRF_STATIC_INLINE nrf_rtc_event_t | nrf_rtc_compare_event_get (uint8_t index) |
Function for getting the COMPARE event associated with the specified compare channel. More... | |
Hardware access layer for managing the Real Time Counter (RTC) peripheral.
enum nrf_rtc_event_t |
enum nrf_rtc_int_t |
RTC interrupts.
enum nrf_rtc_task_t |
RTC tasks.
NRF_STATIC_INLINE uint32_t nrf_rtc_cc_get | ( | NRF_RTC_Type const * | p_reg, |
uint32_t | ch | ||
) |
Function for returning the compare value for a channel.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | ch | Channel. |
NRF_STATIC_INLINE void nrf_rtc_cc_set | ( | NRF_RTC_Type * | p_reg, |
uint32_t | ch, | ||
uint32_t | cc_val | ||
) |
Function for setting a compare value for a channel.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | ch | Channel. |
[in] | cc_val | Compare value to be set. |
NRF_STATIC_INLINE nrf_rtc_event_t nrf_rtc_compare_event_get | ( | uint8_t | index | ) |
Function for getting the COMPARE event associated with the specified compare channel.
[in] | index | Compare channel index. |
NRF_STATIC_INLINE uint32_t nrf_rtc_counter_get | ( | NRF_RTC_Type const * | p_reg | ) |
Function for returning a counter value.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_rtc_event_address_get | ( | NRF_RTC_Type const * | p_reg, |
nrf_rtc_event_t | event | ||
) |
Function for returning the address of an event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Requested event. |
NRF_STATIC_INLINE bool nrf_rtc_event_check | ( | NRF_RTC_Type const * | p_reg, |
nrf_rtc_event_t | event | ||
) |
Function for retrieving the state of the RTC event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be checked. |
true | The event has been generated. |
false | The event has not been generated. |
NRF_STATIC_INLINE void nrf_rtc_event_clear | ( | NRF_RTC_Type * | p_reg, |
nrf_rtc_event_t | event | ||
) |
Function for clearing an event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be cleared. |
NRF_STATIC_INLINE void nrf_rtc_event_disable | ( | NRF_RTC_Type * | p_reg, |
uint32_t | event | ||
) |
Function for disabling an event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Requested event. |
NRF_STATIC_INLINE void nrf_rtc_event_enable | ( | NRF_RTC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling events.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of event flags to be enabled. |
NRF_STATIC_INLINE void nrf_rtc_int_disable | ( | NRF_RTC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for disabling interrupts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Interrupt mask to be disabled. |
NRF_STATIC_INLINE void nrf_rtc_int_enable | ( | NRF_RTC_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling interrupts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Interrupt mask to be enabled. |
NRF_STATIC_INLINE uint32_t nrf_rtc_int_enable_check | ( | NRF_RTC_Type const * | p_reg, |
uint32_t | mask | ||
) |
Function for checking if the specified interrupts are enabled.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be checked. |
NRF_STATIC_INLINE uint32_t nrf_rtc_prescaler_get | ( | NRF_RTC_Type const * | p_reg | ) |
Function for getting a prescaler value.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_rtc_prescaler_set | ( | NRF_RTC_Type * | p_reg, |
uint32_t | val | ||
) |
Function for setting a prescaler value.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | val | Value to set the prescaler to. |
NRF_STATIC_INLINE void nrf_rtc_publish_clear | ( | NRF_RTC_Type * | p_reg, |
nrf_rtc_event_t | event | ||
) |
Function for clearing the publish configuration for a given RTC event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to clear the configuration. |
NRF_STATIC_INLINE void nrf_rtc_publish_set | ( | NRF_RTC_Type * | p_reg, |
nrf_rtc_event_t | event, | ||
uint8_t | channel | ||
) |
Function for setting the publish configuration for a given RTC event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to set the configuration. |
[in] | channel | Channel through which to publish the event. |
NRF_STATIC_INLINE void nrf_rtc_subscribe_clear | ( | NRF_RTC_Type * | p_reg, |
nrf_rtc_task_t | task | ||
) |
Function for clearing the subscribe configuration for a given RTC task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to clear the configuration. |
NRF_STATIC_INLINE void nrf_rtc_subscribe_set | ( | NRF_RTC_Type * | p_reg, |
nrf_rtc_task_t | task, | ||
uint8_t | channel | ||
) |
Function for setting the subscribe configuration for a given RTC task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to set the configuration. |
[in] | channel | Channel through which to subscribe events. |
NRF_STATIC_INLINE uint32_t nrf_rtc_task_address_get | ( | NRF_RTC_Type const * | p_reg, |
nrf_rtc_task_t | task | ||
) |
Function for returning the address of a task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Requested task. |
NRF_STATIC_INLINE void nrf_rtc_task_trigger | ( | NRF_RTC_Type * | p_reg, |
nrf_rtc_task_t | task | ||
) |
Function for starting a task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Requested task. |