Hardware abstraction layer for accessing the timer peripheral. More...
Macros |
|
| #define | TIMER_INSTANCE_NUMBER 3 |
| #define | TIMER_CHANNEL_NUMBER 4 |
| #define | TIMER_IS_BIT_WIDTH_VALID (instance_id, mode) (((instance_id>0) && (mode> NRF_TIMER_BIT_WIDTH_16 )) ? false : true) |
|
Macro for validating correctness of BIT_WIDTH setting.
|
|
| #define | TIMER_CC_SHORT (ch) |
Enumerations |
|
| enum |
nrf_timer_task_t
{
NRF_TIMER_TASK_START = offsetof(NRF_TIMER_Type, TASKS_START), NRF_TIMER_TASK_STOP = offsetof(NRF_TIMER_Type, TASKS_STOP), NRF_TIMER_TASK_COUNT = offsetof(NRF_TIMER_Type, TASKS_COUNT), NRF_TIMER_TASK_CLEAR = offsetof(NRF_TIMER_Type, TASKS_CLEAR), NRF_TIMER_TASK_SHUTDOWN = offsetof(NRF_TIMER_Type, TASKS_SHUTDOWN), NRF_TIMER_TASK_CAPTURE0 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[0]), NRF_TIMER_TASK_CAPTURE1 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[1]), NRF_TIMER_TASK_CAPTURE2 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[2]), NRF_TIMER_TASK_CAPTURE3 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[3]) } |
|
Timer tasks.
More...
|
|
| enum |
nrf_timer_event_t
{
NRF_TIMER_EVENT_COMPARE0 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[0]), NRF_TIMER_EVENT_COMPARE1 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[1]), NRF_TIMER_EVENT_COMPARE2 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[2]), NRF_TIMER_EVENT_COMPARE3 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[3]) } |
|
Timer events.
More...
|
|
| enum |
nrf_timer_short_mask_t
{
NRF_TIMER_SHORT_COMPARE0_STOP_MASK = TIMER_SHORTS_COMPARE0_STOP_Msk, NRF_TIMER_SHORT_COMPARE1_STOP_MASK = TIMER_SHORTS_COMPARE1_STOP_Msk, NRF_TIMER_SHORT_COMPARE2_STOP_MASK = TIMER_SHORTS_COMPARE2_STOP_Msk, NRF_TIMER_SHORT_COMPARE3_STOP_MASK = TIMER_SHORTS_COMPARE3_STOP_Msk, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK = TIMER_SHORTS_COMPARE0_CLEAR_Msk, NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK = TIMER_SHORTS_COMPARE1_CLEAR_Msk, NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK = TIMER_SHORTS_COMPARE2_CLEAR_Msk, NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK = TIMER_SHORTS_COMPARE3_CLEAR_Msk } |
|
Types of timer shortcuts.
More...
|
|
| enum |
nrf_timer_mode_t
{
NRF_TIMER_MODE_TIMER = TIMER_MODE_MODE_Timer, NRF_TIMER_MODE_COUNTER = TIMER_MODE_MODE_Counter } |
|
Timer modes.
More...
|
|
| enum |
nrf_timer_bit_width_t
{
NRF_TIMER_BIT_WIDTH_8 = TIMER_BITMODE_BITMODE_08Bit, NRF_TIMER_BIT_WIDTH_16 = TIMER_BITMODE_BITMODE_16Bit, NRF_TIMER_BIT_WIDTH_24 = TIMER_BITMODE_BITMODE_24Bit, NRF_TIMER_BIT_WIDTH_32 = TIMER_BITMODE_BITMODE_32Bit } |
|
Timer bit width.
More...
|
|
| enum |
nrf_timer_frequency_t
{
NRF_TIMER_FREQ_16MHz = 0, NRF_TIMER_FREQ_8MHz , NRF_TIMER_FREQ_4MHz , NRF_TIMER_FREQ_2MHz , NRF_TIMER_FREQ_1MHz , NRF_TIMER_FREQ_500kHz , NRF_TIMER_FREQ_250kHz , NRF_TIMER_FREQ_125kHz , NRF_TIMER_FREQ_62500Hz , NRF_TIMER_FREQ_31250Hz } |
|
Timer prescalers.
More...
|
|
| enum |
nrf_timer_cc_channel_t
{
NRF_TIMER_CC_CHANNEL0 = 0, NRF_TIMER_CC_CHANNEL1 , NRF_TIMER_CC_CHANNEL2 , NRF_TIMER_CC_CHANNEL3 } |
|
Timer compare/capture channels.
More...
|
|
| enum |
nrf_timer_int_mask_t
{
NRF_TIMER_INT_COMPARE0_MASK = TIMER_INTENSET_COMPARE0_Msk, NRF_TIMER_INT_COMPARE1_MASK = TIMER_INTENSET_COMPARE1_Msk, NRF_TIMER_INT_COMPARE2_MASK = TIMER_INTENSET_COMPARE2_Msk, NRF_TIMER_INT_COMPARE3_MASK = TIMER_INTENSET_COMPARE3_Msk } |
|
Timer interrupts.
More...
|
|
Functions |
|
| __STATIC_INLINE void | nrf_timer_task_trigger (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_task_t timer_task) |
|
Function for activating a specific timer task.
More...
|
|
| __STATIC_INLINE uint32_t * | nrf_timer_task_address_get (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_task_t timer_task) |
|
Function for returning the address of a specific timer task register.
More...
|
|
| __STATIC_INLINE void | nrf_timer_event_clear (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_event_t timer_event) |
|
Function for clearing a specific timer event.
More...
|
|
| __STATIC_INLINE bool | nrf_timer_event_check (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_event_t timer_event) |
|
Function for returning the state of a specific event.
More...
|
|
| __STATIC_INLINE uint32_t * | nrf_timer_event_address_get (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_event_t timer_event) |
|
Function for returning the address of a specific timer event register.
More...
|
|
| __STATIC_INLINE void | nrf_timer_shorts_enable (NRF_TIMER_Type *NRF_TIMERx, uint32_t timer_short_mask) |
|
Function for seting a shortcut for a specific compare channel.
More...
|
|
| __STATIC_INLINE void | nrf_timer_shorts_disable (NRF_TIMER_Type *NRF_TIMERx, uint32_t timer_short_mask) |
|
Function for clearing a shortcut for a specific compare channel.
More...
|
|
| __STATIC_INLINE void | nrf_timer_mode_set (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_mode_t timer_mode) |
|
Function for setting the timer mode.
More...
|
|
| __STATIC_INLINE nrf_timer_mode_t | nrf_timer_mode_get (NRF_TIMER_Type *NRF_TIMERx) |
|
Function for retrieving the timer mode.
More...
|
|
| __STATIC_INLINE void | nrf_timer_bit_width_set (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_bit_width_t timer_bit_width) |
|
Function for setting the timer bit width.
More...
|
|
|
__STATIC_INLINE
nrf_timer_bit_width_t |
nrf_timer_bit_width_get (NRF_TIMER_Type *NRF_TIMERx) |
|
Function for retrieving the timer bit width.
More...
|
|
| __STATIC_INLINE void | nrf_timer_frequency_set (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_frequency_t timer_frequency) |
|
Function for setting the timer frequency.
More...
|
|
|
__STATIC_INLINE
nrf_timer_frequency_t |
nrf_timer_frequency_get (NRF_TIMER_Type *NRF_TIMERx) |
|
Function for retrieving the timer frequency.
More...
|
|
| __STATIC_INLINE uint32_t | nrf_timer_cc_read (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_cc_channel_t cc_channel) |
|
Function for retrieving the value of a given CC channel.
More...
|
|
| __STATIC_INLINE void | nrf_timer_cc_write (NRF_TIMER_Type *NRF_TIMERx, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value) |
|
Function for writing to a specific CC channel.
More...
|
|
| __STATIC_INLINE void | nrf_timer_int_enable (NRF_TIMER_Type *NRF_TIMERx, uint32_t timer_int) |
|
Function for enableing a specific interrupt.
More...
|
|
| __STATIC_INLINE bool | nrf_timer_int_enable_check (NRF_TIMER_Type *NRF_TIMERx, uint32_t timer_int) |
|
Function for retrieving the state of a given interrupt.
More...
|
|
| __STATIC_INLINE void | nrf_timer_int_disable (NRF_TIMER_Type *NRF_TIMERx, uint32_t timer_int) |
|
Function for disabling a specific interrupt.
More...
|
|
Detailed Description
Hardware abstraction layer for accessing the timer peripheral.
Macro Definition Documentation
| #define TIMER_CC_SHORT | ( | ch | ) |
Enumeration Type Documentation
| enum nrf_timer_event_t |
Timer prescalers.
| enum nrf_timer_int_mask_t |
Timer interrupts.
| enum nrf_timer_mode_t |
Types of timer shortcuts.
| enum nrf_timer_task_t |
Timer tasks.
Function Documentation
| __STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get | ( | NRF_TIMER_Type * | NRF_TIMERx | ) |
Function for retrieving the timer bit width.
- Parameters
-
NRF_TIMERx Timer instance.
| __STATIC_INLINE void nrf_timer_bit_width_set | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_bit_width_t | timer_bit_width | ||
| ) |
Function for setting the timer bit width.
- Parameters
-
NRF_TIMERx Timer instance. timer_bit_width Timer bit width.
| __STATIC_INLINE uint32_t nrf_timer_cc_read | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_cc_channel_t | cc_channel | ||
| ) |
Function for retrieving the value of a given CC channel.
- Parameters
-
NRF_TIMERx Timer instance. cc_channel CC channel to read.
| __STATIC_INLINE void nrf_timer_cc_write | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_cc_channel_t | cc_channel , | ||
| uint32_t | cc_value | ||
| ) |
Function for writing to a specific CC channel.
- Parameters
-
NRF_TIMERx Timer instance. cc_channel CC channel to write to. cc_value Value to write to the CC channel.
| __STATIC_INLINE uint32_t* nrf_timer_event_address_get | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_event_t | timer_event | ||
| ) |
Function for returning the address of a specific timer event register.
- Parameters
-
NRF_TIMERx Timer instance. timer_event Timer event.
| __STATIC_INLINE bool nrf_timer_event_check | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_event_t | timer_event | ||
| ) |
Function for returning the state of a specific event.
- Parameters
-
NRF_TIMERx Timer instance. timer_event Timer event to check.
| __STATIC_INLINE void nrf_timer_event_clear | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_event_t | timer_event | ||
| ) |
Function for clearing a specific timer event.
- Parameters
-
NRF_TIMERx Timer instance. timer_event Timer event to clear.
| __STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get | ( | NRF_TIMER_Type * | NRF_TIMERx | ) |
Function for retrieving the timer frequency.
- Parameters
-
NRF_TIMERx Timer instance.
| __STATIC_INLINE void nrf_timer_frequency_set | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_frequency_t | timer_frequency | ||
| ) |
Function for setting the timer frequency.
- Parameters
-
NRF_TIMERx Timer instance. timer_frequency Timer frequency value.
| __STATIC_INLINE void nrf_timer_int_disable | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| uint32_t | timer_int | ||
| ) |
Function for disabling a specific interrupt.
- Parameters
-
NRF_TIMERx Timer instance. timer_int Interrupt to disable.
| __STATIC_INLINE void nrf_timer_int_enable | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| uint32_t | timer_int | ||
| ) |
Function for enableing a specific interrupt.
- Parameters
-
NRF_TIMERx Timer instance. timer_int Interrupt to enable.
| __STATIC_INLINE bool nrf_timer_int_enable_check | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| uint32_t | timer_int | ||
| ) |
Function for retrieving the state of a given interrupt.
- Parameters
-
NRF_TIMERx Timer instance. timer_int Interrupt to check.
- Return values
-
true If the interrupt is enabled. false If the interrupt is not enabled.
| __STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get | ( | NRF_TIMER_Type * | NRF_TIMERx | ) |
Function for retrieving the timer mode.
- Parameters
-
NRF_TIMERx Timer instance.
| __STATIC_INLINE void nrf_timer_mode_set | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_mode_t | timer_mode | ||
| ) |
Function for setting the timer mode.
- Parameters
-
NRF_TIMERx Timer instance. timer_mode Timer mode.
| __STATIC_INLINE void nrf_timer_shorts_disable | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| uint32_t | timer_short_mask | ||
| ) |
Function for clearing a shortcut for a specific compare channel.
- Parameters
-
NRF_TIMERx Timer instance. timer_short_mask Type of timer shortcut.
| __STATIC_INLINE void nrf_timer_shorts_enable | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| uint32_t | timer_short_mask | ||
| ) |
Function for seting a shortcut for a specific compare channel.
- Parameters
-
NRF_TIMERx Timer instance. timer_short_mask Type of timer shortcut.
| __STATIC_INLINE uint32_t* nrf_timer_task_address_get | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_task_t | timer_task | ||
| ) |
Function for returning the address of a specific timer task register.
- Parameters
-
NRF_TIMERx Timer instance. timer_task Timer task.
| __STATIC_INLINE void nrf_timer_task_trigger | ( | NRF_TIMER_Type * | NRF_TIMERx , |
| nrf_timer_task_t | timer_task | ||
| ) |
Function for activating a specific timer task.
- Parameters
-
NRF_TIMERx Timer instance. timer_task Timer task.