nRF51 SDK - S130 SoftDevice
|
Hardware abstraction layer for managing the real time counter (RTC). More...
Macros | |
#define | RTC_CHANNEL_NUM 4 |
#define | RTC_INPUT_FREQ 32768 |
#define | RTC_WRAP(val) (val & RTC_COUNTER_COUNTER_Msk) |
#define | RTC_CHANNEL_INT_MASK(ch) ((uint32_t)NRF_RTC_INT_COMPARE0_MASK << ch) |
#define | RTC_CHANNEL_EVENT_ADDR(ch) (nrf_rtc_event_t)(NRF_RTC_EVENT_COMPARE_0 + ch*sizeof(uint32_t)) |
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) } |
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 | |
__STATIC_INLINE void | nrf_rtc_cc_set (NRF_RTC_Type *p_rtc, uint32_t ch, uint32_t cc_val) |
Function for setting a compare value for a channel. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_cc_get (NRF_RTC_Type *p_rtc, uint32_t ch) |
Function for returning the compare value for a channel. More... | |
__STATIC_INLINE void | nrf_rtc_int_enable (NRF_RTC_Type *p_rtc, uint32_t mask) |
Function for enabling interrupts. More... | |
__STATIC_INLINE void | nrf_rtc_int_disable (NRF_RTC_Type *p_rtc, uint32_t mask) |
Function for disabling interrupts. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_int_is_enabled (NRF_RTC_Type *p_rtc, uint32_t mask) |
Function for checking if interrupts are enabled. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_int_get (NRF_RTC_Type *p_rtc) |
Function for returning the status of currently enabled interrupts. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_event_pending (NRF_RTC_Type *p_rtc, nrf_rtc_event_t event) |
Function for checking if an event is pending. More... | |
__STATIC_INLINE void | nrf_rtc_event_clear (NRF_RTC_Type *p_rtc, nrf_rtc_event_t event) |
Function for clearing an event. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_counter_get (NRF_RTC_Type *p_rtc) |
Function for returning a counter value. More... | |
__STATIC_INLINE void | nrf_rtc_prescaler_set (NRF_RTC_Type *p_rtc, uint32_t val) |
Function for setting a prescaler value. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_event_address_get (NRF_RTC_Type *p_rtc, nrf_rtc_event_t event) |
Function for returning the address of an event. More... | |
__STATIC_INLINE uint32_t | nrf_rtc_task_address_get (NRF_RTC_Type *p_rtc, nrf_rtc_task_t task) |
Function for returning the address of a task. More... | |
__STATIC_INLINE void | nrf_rtc_task_trigger (NRF_RTC_Type *p_rtc, nrf_rtc_task_t task) |
Function for starting a task. More... | |
__STATIC_INLINE void | nrf_rtc_event_enable (NRF_RTC_Type *p_rtc, uint32_t mask) |
Function for enabling events. More... | |
__STATIC_INLINE void | nrf_rtc_event_disable (NRF_RTC_Type *p_rtc, uint32_t event) |
Function for disabling an event. More... | |
Hardware abstraction layer for managing the real time counter (RTC).
#define RTC_CHANNEL_NUM 4 |
Number of compare channels in the RTC instance.
#define RTC_INPUT_FREQ 32768 |
Input frequency of the RTC instance. Macro for wrapping values to RTC capacity.
enum nrf_rtc_event_t |
enum nrf_rtc_int_t |
RTC interrupts.
enum nrf_rtc_task_t |
__STATIC_INLINE uint32_t nrf_rtc_cc_get | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | ch | ||
) |
Function for returning the compare value for a channel.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | ch | Channel. |
__STATIC_INLINE void nrf_rtc_cc_set | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | ch, | ||
uint32_t | cc_val | ||
) |
Function for setting a compare value for a channel.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | ch | Channel. |
[in] | cc_val | Compare value to set. |
__STATIC_INLINE uint32_t nrf_rtc_counter_get | ( | NRF_RTC_Type * | p_rtc | ) |
Function for returning a counter value.
[in] | p_rtc | Pointer to the instance register structure. |
__STATIC_INLINE uint32_t nrf_rtc_event_address_get | ( | NRF_RTC_Type * | p_rtc, |
nrf_rtc_event_t | event | ||
) |
Function for returning the address of an event.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | event | Requested event. |
__STATIC_INLINE void nrf_rtc_event_clear | ( | NRF_RTC_Type * | p_rtc, |
nrf_rtc_event_t | event | ||
) |
Function for clearing an event.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | event | Event to clear. |
__STATIC_INLINE void nrf_rtc_event_disable | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | event | ||
) |
Function for disabling an event.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | event | Requested event. |
__STATIC_INLINE void nrf_rtc_event_enable | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | mask | ||
) |
Function for enabling events.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | mask | Mask of event flags to enable. |
__STATIC_INLINE uint32_t nrf_rtc_event_pending | ( | NRF_RTC_Type * | p_rtc, |
nrf_rtc_event_t | event | ||
) |
Function for checking if an event is pending.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | event | Address of the event. |
__STATIC_INLINE void nrf_rtc_int_disable | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | mask | ||
) |
Function for disabling interrupts.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | mask | Interrupt mask to be disabled. |
__STATIC_INLINE void nrf_rtc_int_enable | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | mask | ||
) |
Function for enabling interrupts.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | mask | Interrupt mask to be enabled. |
__STATIC_INLINE uint32_t nrf_rtc_int_get | ( | NRF_RTC_Type * | p_rtc | ) |
Function for returning the status of currently enabled interrupts.
[in] | p_rtc | Pointer to the instance register structure. |
__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | mask | ||
) |
Function for checking if interrupts are enabled.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | mask | Mask of interrupt flags to check. |
__STATIC_INLINE void nrf_rtc_prescaler_set | ( | NRF_RTC_Type * | p_rtc, |
uint32_t | val | ||
) |
Function for setting a prescaler value.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | val | Value to set the prescaler to. |
__STATIC_INLINE uint32_t nrf_rtc_task_address_get | ( | NRF_RTC_Type * | p_rtc, |
nrf_rtc_task_t | task | ||
) |
Function for returning the address of a task.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | task | Requested task. |
__STATIC_INLINE void nrf_rtc_task_trigger | ( | NRF_RTC_Type * | p_rtc, |
nrf_rtc_task_t | task | ||
) |
Function for starting a task.
[in] | p_rtc | Pointer to the instance register structure. |
[in] | task | Requested task. |