nRF51 SDK - S210 SoftDevice
|
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_events_t event_type) |
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_tasks_t timer_task) |
Function for returning the address of a specific timer task. More... | |
uint32_t | nrf_drv_timer_event_address_get (nrf_drv_timer_t const *const p_instance, nrf_timer_events_t timer_event) |
Function for returning the address of a specific timer 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_shorts_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... | |
Multi-instance timer driver.
#define NRF_DRV_TIMER_DEFAULT_CONFIG | ( | id | ) |
TIMER instance default configuration.
#define NRF_DRV_TIMER_INSTANCE | ( | id | ) |
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.
[in] | p_instance | Timer. |
[in] | cc_channel | Channel. |
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.
[in] | p_instance | Timer. |
[in] | cc_channel | Channel. |
Captured | value. |
void nrf_drv_timer_clear | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for clearing the timer.
[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.
[in] | p_instance | Timer. |
[in] | cc_channel | Channel. |
[in] | cc_value | Compare value. |
[in] | enable | Enable or disable the interrupt for the compare channel. |
void nrf_drv_timer_disable | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for turning off the timer.
[in] | p_instance | Timer. |
void nrf_drv_timer_enable | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for turning on timer.
[in] | p_instance | Timer |
uint32_t nrf_drv_timer_event_address_get | ( | nrf_drv_timer_t const *const | p_instance, |
nrf_timer_events_t | timer_event | ||
) |
Function for returning the address of a specific timer event.
[in] | p_instance | Timer. |
[in] | timer_event | Timer event. |
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_shorts_mask_t | timer_short_mask, | ||
bool | enable | ||
) |
Function for setting the timer channel in extended compare mode.
[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.
[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.
[in] | p_instance | Timer. |
[in] | p_config | Initial configuration. Default configuration used if NULL. |
[in] | timer_event_handler | Event handler provided by the user. |
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.
[in] | p_instance | Timer. |
[in] | timer_ms | Time in milliseconds. |
Number | of ticks. |
void nrf_drv_timer_pause | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for pausing the timer.
[in] | p_instance | Timer |
void nrf_drv_timer_resume | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for resuming the timer.
[in] | p_instance | Timer. |
uint32_t nrf_drv_timer_task_address_get | ( | nrf_drv_timer_t const *const | p_instance, |
nrf_timer_tasks_t | timer_task | ||
) |
Function for returning the address of a specific timer task.
[in] | p_instance | Timer. |
[in] | timer_task | Timer task. |
Task | address. |
void nrf_drv_timer_uninit | ( | nrf_drv_timer_t const *const | p_instance | ) |
Function for uninitializing the timer.
[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.
[in] | p_instance | Timer. |
[in] | timer_us | Time in microseconds. |
Number | of ticks. |