Multi-instance timer driver. More...
Data Structures |
|
| struct | nrf_drv_timer_t |
|
Struct for TIMER instance.
More...
|
|
| struct | nrf_drv_timer_config_t |
|
Struct for TIMER instance configuration.
More...
|
|
Macros |
|
| #define | NRF_DRV_TIMER_INSTANCE (id) |
| #define | TIMER_CONFIG_FREQUENCY (id) TIMER##id##_CONFIG_FREQUENCY |
| #define | TIMER_CONFIG_MODE (id) TIMER##id##_CONFIG_MODE |
| #define | TIMER_CONFIG_BIT_WIDTH (id) TIMER##id##_CONFIG_BIT_WIDTH |
| #define | TIMER_CONFIG_IRQ_PRIORITY (id) TIMER##id##_CONFIG_IRQ_PRIORITY |
| #define | NRF_DRV_TIMER_DEFAULT_CONFIG (id) |
|
TIMER instance default configuration.
More...
|
|
Typedefs |
|
| typedef void(* | nrf_timer_event_handler_t )( nrf_timer_event_t event_type, void *p_context) |
|
TIMER interrupt event handler.
More...
|
|
Functions |
|
| ret_code_t | nrf_drv_timer_init ( nrf_drv_timer_t const *const p_instance, nrf_drv_timer_config_t const *p_config, nrf_timer_event_handler_t timer_event_handler) |
|
Function for initializing the timer.
More...
|
|
| void | nrf_drv_timer_uninit ( nrf_drv_timer_t const *const p_instance) |
|
Function for uninitializing the timer.
More...
|
|
| void | nrf_drv_timer_enable ( nrf_drv_timer_t const *const p_instance) |
|
Function for turning on timer.
More...
|
|
| void | nrf_drv_timer_disable ( nrf_drv_timer_t const *const p_instance) |
|
Function for turning off the timer.
More...
|
|
| void | nrf_drv_timer_pause ( nrf_drv_timer_t const *const p_instance) |
|
Function for pausing the timer.
More...
|
|
| void | nrf_drv_timer_resume ( nrf_drv_timer_t const *const p_instance) |
|
Function for resuming the timer.
More...
|
|
| void | nrf_drv_timer_clear ( nrf_drv_timer_t const *const p_instance) |
|
Function for clearing the timer.
More...
|
|
| void | nrf_drv_timer_increment ( nrf_drv_timer_t const *const p_instance) |
|
Function for incrementing the timer.
More...
|
|
| uint32_t | nrf_drv_timer_task_address_get ( nrf_drv_timer_t const *const p_instance, nrf_timer_task_t timer_task) |
|
Function for returning the address of a specific timer task.
More...
|
|
| uint32_t | nrf_drv_timer_capture_task_address_get ( nrf_drv_timer_t const *const p_instance, uint32_t channel) |
|
Function for returning the address of a specific timer capture task.
More...
|
|
| uint32_t | nrf_drv_timer_event_address_get ( nrf_drv_timer_t const *const p_instance, nrf_timer_event_t timer_event) |
|
Function for returning the address of a specific timer event.
More...
|
|
| uint32_t | nrf_drv_timer_compare_event_address_get ( nrf_drv_timer_t const *const p_instance, uint32_t channel) |
|
Function for returning the address of a specific timer compare event.
More...
|
|
| uint32_t | nrf_drv_timer_capture ( nrf_drv_timer_t const *const p_instance, nrf_timer_cc_channel_t cc_channel) |
|
Function for capturing the timer value.
More...
|
|
| uint32_t | nrf_drv_timer_capture_get ( nrf_drv_timer_t const *const p_instance, nrf_timer_cc_channel_t cc_channel) |
|
Function for returning the capture value from a specific channel.
More...
|
|
| void | nrf_drv_timer_compare ( nrf_drv_timer_t const *const p_instance, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value, bool enable) |
|
Function for setting the timer channel in compare mode.
More...
|
|
| void | nrf_drv_timer_extended_compare ( nrf_drv_timer_t const *const p_instance, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value, nrf_timer_short_mask_t timer_short_mask, bool enable) |
|
Function for setting the timer channel in extended compare mode.
More...
|
|
| uint32_t | nrf_drv_timer_us_to_ticks ( nrf_drv_timer_t const *const p_instance, uint32_t timer_us) |
|
Function for converting microseconds to ticks.
More...
|
|
| uint32_t | nrf_drv_timer_ms_to_ticks ( nrf_drv_timer_t const *const p_instance, uint32_t timer_ms) |
|
Function for converting milliseconds to ticks.
More...
|
|
| void | nrf_drv_timer_compare_int_enable ( nrf_drv_timer_t const *const p_instance, uint32_t channel) |
|
Function for enabling timer compare interrupt.
More...
|
|
| void | nrf_drv_timer_compare_int_disable ( nrf_drv_timer_t const *const p_instance, uint32_t channel) |
|
Function for disabling timer compare interrupt.
More...
|
|
Detailed Description
Multi-instance timer driver.
Macro Definition Documentation
| #define NRF_DRV_TIMER_DEFAULT_CONFIG | ( | id | ) |
TIMER instance default configuration.
| #define NRF_DRV_TIMER_INSTANCE | ( | id | ) |
Typedef Documentation
| typedef void(* nrf_timer_event_handler_t)( nrf_timer_event_t event_type, void *p_context) |
TIMER interrupt event handler.
- Parameters
-
[in] event_type Timer event. [in] p_context General purpose parameter set during initialization of the timer. Can be used to pass additional information to handler function, e.g. timer ID.
Function Documentation
| uint32_t nrf_drv_timer_capture | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_timer_cc_channel_t | cc_channel | ||
| ) |
Function for capturing the timer value.
- Parameters
-
[in] p_instance Timer. [in] cc_channel Channel.
- Return values
-
Captured value.
| uint32_t nrf_drv_timer_capture_get | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_timer_cc_channel_t | cc_channel | ||
| ) |
Function for returning the capture value from a specific channel.
- Note
- Function for reading channel value when PPI is used for capturing.
- Parameters
-
[in] p_instance Timer. [in] cc_channel Channel.
- Return values
-
Captured value.
| uint32_t nrf_drv_timer_capture_task_address_get | ( | nrf_drv_timer_t const *const | p_instance , |
| uint32_t | channel | ||
| ) |
Function for returning the address of a specific timer capture task.
- Parameters
-
[in] p_instance Timer. [in] channel Capture channel number.
- Return values
-
Task address.
| void nrf_drv_timer_clear | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for clearing the timer.
- Parameters
-
[in] p_instance Timer.
| void nrf_drv_timer_compare | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_timer_cc_channel_t | cc_channel , | ||
| uint32_t | cc_value , | ||
| bool | enable | ||
| ) |
Function for setting the timer channel in compare mode.
- Parameters
-
[in] p_instance Timer. [in] cc_channel Channel. [in] cc_value Compare value. [in] enable Enable or disable the interrupt for the compare channel.
| uint32_t nrf_drv_timer_compare_event_address_get | ( | nrf_drv_timer_t const *const | p_instance , |
| uint32_t | channel | ||
| ) |
Function for returning the address of a specific timer compare event.
- Parameters
-
[in] p_instance Timer. [in] channel Compare channel number.
- Return values
-
Event address.
| void nrf_drv_timer_compare_int_disable | ( | nrf_drv_timer_t const *const | p_instance , |
| uint32_t | channel | ||
| ) |
Function for disabling timer compare interrupt.
- Parameters
-
[in] p_instance Timer. [in] channel Compare channel
| void nrf_drv_timer_compare_int_enable | ( | nrf_drv_timer_t const *const | p_instance , |
| uint32_t | channel | ||
| ) |
Function for enabling timer compare interrupt.
- Parameters
-
[in] p_instance Timer. [in] channel Compare channel
| void nrf_drv_timer_disable | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for turning off the timer.
- Note
- Timer will allow to enter lowest possible SYSTEM_ON state only after this function is called.
- Parameters
-
[in] p_instance Timer.
| void nrf_drv_timer_enable | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for turning on timer.
- Parameters
-
[in] p_instance Timer
| uint32_t nrf_drv_timer_event_address_get | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_timer_event_t | timer_event | ||
| ) |
Function for returning the address of a specific timer event.
- Parameters
-
[in] p_instance Timer. [in] timer_event Timer event.
- Return values
-
Event address.
| void nrf_drv_timer_extended_compare | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_timer_cc_channel_t | cc_channel , | ||
| uint32_t | cc_value , | ||
| nrf_timer_short_mask_t | timer_short_mask , | ||
| bool | enable | ||
| ) |
Function for setting the timer channel in extended compare mode.
- Parameters
-
[in] p_instance Timer. [in] cc_channel Channel. [in] cc_value Compare value. [in] timer_short_mask Shortcut between the compare event on the channel and the timer task (STOP or CLEAR). [in] enable Enable or disable the interrupt for the compare channel.
| void nrf_drv_timer_increment | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for incrementing the timer.
- Parameters
-
[in] p_instance Timer.
| ret_code_t nrf_drv_timer_init | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_drv_timer_config_t const * | p_config , | ||
| nrf_timer_event_handler_t | timer_event_handler | ||
| ) |
Function for initializing the timer.
- Parameters
-
[in] p_instance Timer. [in] p_config Initial configuration. Default configuration used if NULL. [in] timer_event_handler Event handler provided by the user.
- Return values
-
NRF_SUCCESS If initialization was successful. NRF_ERROR_INVALID_PARAM If invalid parameters were supplied.
| uint32_t nrf_drv_timer_ms_to_ticks | ( | nrf_drv_timer_t const *const | p_instance , |
| uint32_t | timer_ms | ||
| ) |
Function for converting milliseconds to ticks.
- Parameters
-
[in] p_instance Timer. [in] timer_ms Time in milliseconds.
- Note
- Function asserts if there was a 32-bit integer overflow.
- Return values
-
Number of ticks.
| void nrf_drv_timer_pause | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for pausing the timer.
- Parameters
-
[in] p_instance Timer
| void nrf_drv_timer_resume | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for resuming the timer.
- Parameters
-
[in] p_instance Timer.
| uint32_t nrf_drv_timer_task_address_get | ( | nrf_drv_timer_t const *const | p_instance , |
| nrf_timer_task_t | timer_task | ||
| ) |
Function for returning the address of a specific timer task.
- Parameters
-
[in] p_instance Timer. [in] timer_task Timer task.
- Return values
-
Task address.
| void nrf_drv_timer_uninit | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for uninitializing the timer.
- Parameters
-
[in] p_instance Timer.
| uint32_t nrf_drv_timer_us_to_ticks | ( | nrf_drv_timer_t const *const | p_instance , |
| uint32_t | timer_us | ||
| ) |
Function for converting microseconds to ticks.
- Parameters
-
[in] p_instance Timer. [in] timer_us Time in microseconds.
- Note
- Function asserts if there was a 32-bit integer overflow.
- Return values
-
Number of ticks.