TIMER peripheral driver. More...
Modules | |
TIMER periperal driver configuration | |
Data Structures | |
struct | nrfx_timer_t |
Timer driver instance data structure. More... | |
struct | nrfx_timer_config_t |
The configuration structure of the timer driver instance. More... | |
Macros | |
#define | NRFX_TIMER_INSTANCE(id) |
Macro for creating a timer driver instance. | |
#define | NRFX_TIMER_DEFAULT_CONFIG(_frequency) |
TIMER driver default configuration. | |
#define | NRFX_TIMER_FREQUENCY_STATIC_CHECK(id, frequency) NRF_TIMER_FREQUENCY_STATIC_CHECK(NRF_TIMER_INST_GET(id), frequency) |
Macro for checking whether specified frequency can be achived for given timer instance. | |
#define | NRFX_TIMER_BASE_FREQUENCY_GET(p_instance) NRF_TIMER_BASE_FREQUENCY_GET((p_instance)->p_reg) |
Macro for getting base frequency value in Hz for a given timer instance. | |
#define | NRFX_TIMER_INST_HANDLER_GET(idx) NRFX_CONCAT_3(nrfx_timer_, idx, _irq_handler) |
Macro returning TIMER interrupt handler. | |
Typedefs | |
typedef void(* | nrfx_timer_event_handler_t) (nrf_timer_event_t event_type, void *p_context) |
Timer driver event handler type. | |
Functions | |
nrfx_err_t | nrfx_timer_init (nrfx_timer_t const *p_instance, nrfx_timer_config_t const *p_config, nrfx_timer_event_handler_t timer_event_handler) |
Function for initializing the timer. | |
nrfx_err_t | nrfx_timer_reconfigure (nrfx_timer_t const *p_instance, nrfx_timer_config_t const *p_config) |
Function for reconfiguring the timer. | |
void | nrfx_timer_uninit (nrfx_timer_t const *p_instance) |
Function for uninitializing the timer. | |
bool | nrfx_timer_init_check (nrfx_timer_t const *p_instance) |
Function for checking if the TIMER driver instance is initialized. | |
void | nrfx_timer_enable (nrfx_timer_t const *p_instance) |
Function for turning on the timer. | |
void | nrfx_timer_disable (nrfx_timer_t const *p_instance) |
Function for turning off the timer. | |
bool | nrfx_timer_is_enabled (nrfx_timer_t const *p_instance) |
Function for checking the timer state. | |
void | nrfx_timer_pause (nrfx_timer_t const *p_instance) |
Function for pausing the timer. | |
void | nrfx_timer_resume (nrfx_timer_t const *p_instance) |
Function for resuming the timer. | |
void | nrfx_timer_clear (nrfx_timer_t const *p_instance) |
Function for clearing the timer. | |
void | nrfx_timer_increment (nrfx_timer_t const *p_instance) |
Function for incrementing the timer. | |
NRFX_STATIC_INLINE uint32_t | nrfx_timer_task_address_get (nrfx_timer_t const *p_instance, nrf_timer_task_t timer_task) |
Function for returning the address of the specified timer task. | |
NRFX_STATIC_INLINE uint32_t | nrfx_timer_capture_task_address_get (nrfx_timer_t const *p_instance, uint32_t channel) |
Function for returning the address of the specified timer capture task. | |
NRFX_STATIC_INLINE uint32_t | nrfx_timer_event_address_get (nrfx_timer_t const *p_instance, nrf_timer_event_t timer_event) |
Function for returning the address of the specified timer event. | |
NRFX_STATIC_INLINE uint32_t | nrfx_timer_compare_event_address_get (nrfx_timer_t const *p_instance, uint32_t channel) |
Function for returning the address of the specified timer compare event. | |
uint32_t | nrfx_timer_capture (nrfx_timer_t const *p_instance, nrf_timer_cc_channel_t cc_channel) |
Function for capturing the timer value. | |
NRFX_STATIC_INLINE uint32_t | nrfx_timer_capture_get (nrfx_timer_t const *p_instance, nrf_timer_cc_channel_t cc_channel) |
Function for returning the capture value from the specified channel. | |
void | nrfx_timer_compare (nrfx_timer_t const *p_instance, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value, bool enable_int) |
Function for setting the timer channel in compare mode. | |
void | nrfx_timer_extended_compare (nrfx_timer_t const *p_instance, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value, nrf_timer_short_mask_t timer_short_mask, bool enable_int) |
Function for setting the timer channel in the extended compare mode. | |
uint32_t | nrfx_timer_us_to_ticks (nrfx_timer_t const *p_instance, uint32_t time_us) |
Function for converting time in microseconds to timer ticks. | |
uint32_t | nrfx_timer_ms_to_ticks (nrfx_timer_t const *p_instance, uint32_t time_ms) |
Function for converting time in milliseconds to timer ticks. | |
void | nrfx_timer_compare_int_enable (nrfx_timer_t const *p_instance, uint32_t channel) |
Function for enabling timer compare interrupt. | |
void | nrfx_timer_compare_int_disable (nrfx_timer_t const *p_instance, uint32_t channel) |
Function for disabling timer compare interrupt. | |
TIMER peripheral driver.
#define NRFX_TIMER_BASE_FREQUENCY_GET | ( | p_instance | ) | NRF_TIMER_BASE_FREQUENCY_GET((p_instance)->p_reg) |
Macro for getting base frequency value in Hz for a given timer instance.
[in] | p_instance | Pointer to the driver instance structure. |
#define NRFX_TIMER_DEFAULT_CONFIG | ( | _frequency | ) |
TIMER driver default configuration.
This configuration sets up TIMER with the following options:
[in] | _frequency | Timer frequency in Hz. |
#define NRFX_TIMER_FREQUENCY_STATIC_CHECK | ( | id, | |
frequency | |||
) | NRF_TIMER_FREQUENCY_STATIC_CHECK(NRF_TIMER_INST_GET(id), frequency) |
Macro for checking whether specified frequency can be achived for given timer instance.
[in] | id | Index of the specified timer instance. |
[in] | frequency | Desired frequency value in Hz. |
#define NRFX_TIMER_INST_HANDLER_GET | ( | idx | ) | NRFX_CONCAT_3(nrfx_timer_, idx, _irq_handler) |
Macro returning TIMER interrupt handler.
param[in] idx TIMER index.
#define NRFX_TIMER_INSTANCE | ( | id | ) |
Macro for creating a timer driver instance.
typedef void(* nrfx_timer_event_handler_t) (nrf_timer_event_t event_type, void *p_context) |
Timer driver event handler type.
[in] | event_type | Timer event. |
[in] | p_context | General purpose parameter set during initialization of the timer. This parameter can be used to pass additional information to the handler function, for example, the timer ID. |
uint32_t nrfx_timer_capture | ( | nrfx_timer_t const * | p_instance, |
nrf_timer_cc_channel_t | cc_channel | ||
) |
Function for capturing the timer value.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | cc_channel | Capture channel number. |
NRFX_STATIC_INLINE uint32_t nrfx_timer_capture_get | ( | nrfx_timer_t const * | p_instance, |
nrf_timer_cc_channel_t | cc_channel | ||
) |
Function for returning the capture value from the specified channel.
Use this function to read channel values when PPI is used for capturing.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | cc_channel | Capture channel number. |
NRFX_STATIC_INLINE uint32_t nrfx_timer_capture_task_address_get | ( | nrfx_timer_t const * | p_instance, |
uint32_t | channel | ||
) |
Function for returning the address of the specified timer capture task.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | channel | Capture channel number. |
void nrfx_timer_clear | ( | nrfx_timer_t const * | p_instance | ) |
Function for clearing the timer.
[in] | p_instance | Pointer to the driver instance structure. |
void nrfx_timer_compare | ( | nrfx_timer_t const * | p_instance, |
nrf_timer_cc_channel_t | cc_channel, | ||
uint32_t | cc_value, | ||
bool | enable_int | ||
) |
Function for setting the timer channel in compare mode.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | cc_channel | Compare channel number. |
[in] | cc_value | Compare value. |
[in] | enable_int | Enable or disable the interrupt for the compare channel. |
NRFX_STATIC_INLINE uint32_t nrfx_timer_compare_event_address_get | ( | nrfx_timer_t const * | p_instance, |
uint32_t | channel | ||
) |
Function for returning the address of the specified timer compare event.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | channel | Compare channel number. |
void nrfx_timer_compare_int_disable | ( | nrfx_timer_t const * | p_instance, |
uint32_t | channel | ||
) |
Function for disabling timer compare interrupt.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | channel | Compare channel. |
void nrfx_timer_compare_int_enable | ( | nrfx_timer_t const * | p_instance, |
uint32_t | channel | ||
) |
Function for enabling timer compare interrupt.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | channel | Compare channel. |
void nrfx_timer_disable | ( | nrfx_timer_t const * | p_instance | ) |
Function for turning off the timer.
The timer will allow to enter the lowest possible SYSTEM_ON state only after this function is called.
[in] | p_instance | Pointer to the driver instance structure. |
void nrfx_timer_enable | ( | nrfx_timer_t const * | p_instance | ) |
Function for turning on the timer.
[in] | p_instance | Pointer to the driver instance structure. |
NRFX_STATIC_INLINE uint32_t nrfx_timer_event_address_get | ( | nrfx_timer_t const * | p_instance, |
nrf_timer_event_t | timer_event | ||
) |
Function for returning the address of the specified timer event.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | timer_event | Timer event. |
void nrfx_timer_extended_compare | ( | nrfx_timer_t const * | p_instance, |
nrf_timer_cc_channel_t | cc_channel, | ||
uint32_t | cc_value, | ||
nrf_timer_short_mask_t | timer_short_mask, | ||
bool | enable_int | ||
) |
Function for setting the timer channel in the extended compare mode.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | cc_channel | Compare channel number. |
[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_int | Enable or disable the interrupt for the compare channel. |
void nrfx_timer_increment | ( | nrfx_timer_t const * | p_instance | ) |
Function for incrementing the timer.
[in] | p_instance | Pointer to the driver instance structure. |
nrfx_err_t nrfx_timer_init | ( | nrfx_timer_t const * | p_instance, |
nrfx_timer_config_t const * | p_config, | ||
nrfx_timer_event_handler_t | timer_event_handler | ||
) |
Function for initializing the timer.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | p_config | Pointer to the structure with the initial configuration. |
[in] | timer_event_handler | Event handler provided by the user. Can be NULL. |
NRFX_SUCCESS | Initialization was successful. |
NRFX_ERROR_INVALID_PARAM | Specified frequency is not supported by the TIMER instance. |
NRFX_ERROR_ALREADY | The driver is already initialized. |
NRFX_ERROR_INVALID_STATE | The driver is already initialized. Deprecated - use NRFX_ERROR_ALREADY instead. |
bool nrfx_timer_init_check | ( | nrfx_timer_t const * | p_instance | ) |
Function for checking if the TIMER driver instance is initialized.
[in] | p_instance | Pointer to the driver instance structure. |
true | Instance is already initialized. |
false | Instance is not initialized. |
bool nrfx_timer_is_enabled | ( | nrfx_timer_t const * | p_instance | ) |
Function for checking the timer state.
[in] | p_instance | Pointer to the driver instance structure. |
true | Timer is enabled. |
false | Timer is not enabled. |
uint32_t nrfx_timer_ms_to_ticks | ( | nrfx_timer_t const * | p_instance, |
uint32_t | time_ms | ||
) |
Function for converting time in milliseconds to timer ticks.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | time_ms | Time in milliseconds. |
void nrfx_timer_pause | ( | nrfx_timer_t const * | p_instance | ) |
Function for pausing the timer.
[in] | p_instance | Pointer to the driver instance structure. |
nrfx_err_t nrfx_timer_reconfigure | ( | nrfx_timer_t const * | p_instance, |
nrfx_timer_config_t const * | p_config | ||
) |
Function for reconfiguring the timer.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | p_config | Pointer to the structure with the configuration. |
NRFX_SUCCESS | Reconfiguration was successful. |
NRFX_ERROR_INVALID_PARAM | Specified frequency is not supported by the TIMER instance. |
NRFX_ERROR_INVALID_STATE | The driver is uninitialized. |
NRFX_ERROR_BUSY | The driver is enabled and cannot be reconfigured. |
void nrfx_timer_resume | ( | nrfx_timer_t const * | p_instance | ) |
Function for resuming the timer.
[in] | p_instance | Pointer to the driver instance structure. |
NRFX_STATIC_INLINE uint32_t nrfx_timer_task_address_get | ( | nrfx_timer_t const * | p_instance, |
nrf_timer_task_t | timer_task | ||
) |
Function for returning the address of the specified timer task.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | timer_task | Timer task. |
void nrfx_timer_uninit | ( | nrfx_timer_t const * | p_instance | ) |
Function for uninitializing the timer.
[in] | p_instance | Pointer to the driver instance structure. |
uint32_t nrfx_timer_us_to_ticks | ( | nrfx_timer_t const * | p_instance, |
uint32_t | time_us | ||
) |
Function for converting time in microseconds to timer ticks.
[in] | p_instance | Pointer to the driver instance structure. |
[in] | time_us | Time in microseconds. |