TIMER HALY

group nrfy_timer

Hardware access layer with cache and barrier support for managing the TIMER peripheral.

Defines

NRFY_TIMER_HAS_ONE_SHOT

See also

NRF_TIMER_HAS_ONE_SHOT Symbol indicating whether timer supports one-shot operation.

Functions

NRFY_STATIC_INLINE void nrfy_timer_periph_configure(NRF_TIMER_Type *p_reg, nrfy_timer_config_t const *p_config)

Function for configuring the TIMER.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • p_config[in] Pointer to the peripheral configuration structure.

NRFY_STATIC_INLINE void nrfy_timer_int_init(NRF_TIMER_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)

Function for initializing the specified TIMER interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be initialized.

  • irq_priority[in] Interrupt priority.

  • enable[in] True if the interrupts are to be enabled, false otherwise.

NRFY_STATIC_INLINE void nrfy_timer_int_uninit(NRF_TIMER_Type *p_reg)

Function for uninitializing the TIMER interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

NRFY_STATIC_INLINE uint32_t nrfy_timer_events_process(NRF_TIMER_Type *p_reg, uint32_t mask)

Function for processing the specified TIMER events.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK().

Returns:

Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

NRFY_STATIC_INLINE uint32_t nrfy_timer_capture_get(NRF_TIMER_Type *p_reg, nrf_timer_cc_channel_t channel)

Function for capturing the TIMER value.

Note

This function triggers the capture task for given channel and returns latched timer value.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • channel[in] Capture channel number.

Returns:

Captured value.

NRFY_STATIC_INLINE void nrfy_timer_task_trigger(NRF_TIMER_Type *p_reg, nrf_timer_task_t task)

See also

nrf_timer_task_trigger Function for activating the specified timer task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task to be activated.

NRFY_STATIC_INLINE uint32_t nrfy_timer_task_address_get(NRF_TIMER_Type const *p_reg, nrf_timer_task_t task)

See also

nrf_timer_task_address_get Function for getting the address of the specified timer task register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] The specified task.

Returns:

Address of the specified task register.

NRFY_STATIC_INLINE void nrfy_timer_event_clear(NRF_TIMER_Type *p_reg, nrf_timer_event_t event)

See also

nrf_timer_event_clear Function for clearing the specified timer event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to clear.

NRFY_STATIC_INLINE bool nrfy_timer_event_check(NRF_TIMER_Type const *p_reg, nrf_timer_event_t event)

See also

nrf_timer_event_check Function for retrieving the state of the TIMER event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event to be checked.

Return values:
  • true – The event has been generated.

  • false – The event has not been generated.

NRFY_STATIC_INLINE uint32_t nrfy_timer_event_address_get(NRF_TIMER_Type const *p_reg, nrf_timer_event_t event)

See also

nrf_timer_event_address_get Function for getting the address of the specified timer event register.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] The specified event.

Returns:

Address of the specified event register.

NRFY_STATIC_INLINE void nrfy_timer_shorts_enable(NRF_TIMER_Type *p_reg, uint32_t mask)

See also

nrf_timer_shorts_enable Function for enabling the specified shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be enabled.

NRFY_STATIC_INLINE void nrfy_timer_shorts_disable(NRF_TIMER_Type *p_reg, uint32_t mask)

See also

nrf_timer_shorts_disable Function for disabling the specified shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be disabled.

NRFY_STATIC_INLINE void nrfy_timer_shorts_set(NRF_TIMER_Type *p_reg, uint32_t mask)

See also

nrf_timer_shorts_set Function for setting the specified shortcuts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Shortcuts to be set.

NRFY_STATIC_INLINE void nrfy_timer_int_enable(NRF_TIMER_Type *p_reg, uint32_t mask)

See also

nrf_timer_int_enable Function for enabling the specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be enabled. Use nrf_timer_int_mask_t values for bit masking.

NRFY_STATIC_INLINE void nrfy_timer_int_disable(NRF_TIMER_Type *p_reg, uint32_t mask)

See also

nrf_timer_int_disable Function for disabling the specified interrupts.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be disabled. Use nrf_timer_int_mask_t values for bit masking.

NRFY_STATIC_INLINE uint32_t nrfy_timer_int_enable_check(NRF_TIMER_Type const *p_reg, uint32_t mask)

See also

nrf_timer_int_enable_check Function for checking if the specified interrupts are enabled.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mask[in] Mask of interrupts to be checked. Use nrf_timer_int_mask_t values for bit masking.

Returns:

Mask of enabled interrupts.

NRFY_STATIC_INLINE void nrfy_timer_subscribe_set(NRF_TIMER_Type *p_reg, nrf_timer_task_t task, uint8_t channel)

See also

nrf_timer_subscribe_set Function for setting the subscribe configuration for a given TIMER task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to set the configuration.

  • channel[in] Channel through which to subscribe events.

NRFY_STATIC_INLINE void nrfy_timer_subscribe_clear(NRF_TIMER_Type *p_reg, nrf_timer_task_t task)

See also

nrf_timer_subscribe_clear Function for clearing the subscribe configuration for a given TIMER task.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • task[in] Task for which to clear the configuration.

NRFY_STATIC_INLINE void nrfy_timer_publish_set(NRF_TIMER_Type *p_reg, nrf_timer_event_t event, uint8_t channel)

See also

nrf_timer_publish_set Function for setting the publish configuration for a given TIMER event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to set the configuration.

  • channel[in] Channel through which to publish the event.

NRFY_STATIC_INLINE void nrfy_timer_publish_clear(NRF_TIMER_Type *p_reg, nrf_timer_event_t event)

See also

nrf_timer_publish_clear Function for clearing the publish configuration for a given TIMER event.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • event[in] Event for which to clear the configuration.

NRFY_STATIC_INLINE void nrfy_timer_mode_set(NRF_TIMER_Type *p_reg, nrf_timer_mode_t mode)

See also

nrf_timer_mode_set Function for setting the timer mode.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • mode[in] Timer mode.

NRFY_STATIC_INLINE nrf_timer_mode_t nrfy_timer_mode_get(NRF_TIMER_Type const *p_reg)

See also

nrf_timer_mode_get Function for retrieving the timer mode.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Timer mode.

NRFY_STATIC_INLINE void nrfy_timer_bit_width_set(NRF_TIMER_Type *p_reg, nrf_timer_bit_width_t bit_width)

See also

nrf_timer_bit_width_set Function for setting the timer bit width.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • bit_width[in] Timer bit width.

NRFY_STATIC_INLINE nrf_timer_bit_width_t nrfy_timer_bit_width_get(NRF_TIMER_Type const *p_reg)

See also

nrf_timer_bit_width_get Function for retrieving the timer bit width.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Timer bit width.

NRFY_STATIC_INLINE void nrfy_timer_prescaler_set(NRF_TIMER_Type *p_reg, uint32_t prescaler_factor)

See also

nrf_timer_prescaler_set Function for setting the prescaler factor.

Note

Prescaler value is expressed as \( 2^{prescaler\_factor} \).

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • prescaler_factor[in] Prescaler factor.

NRFY_STATIC_INLINE uint32_t nrfy_timer_prescaler_get(NRF_TIMER_Type const *p_reg)

See also

nrf_timer_prescaler_get Function for retrieving the prescaler factor.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

Returns:

Prescaler factor.

NRFY_STATIC_INLINE void nrfy_timer_cc_set(NRF_TIMER_Type *p_reg, nrf_timer_cc_channel_t cc_channel, uint32_t cc_value)

See also

nrf_timer_cc_set Function for setting the capture/compare register for the specified channel.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • cc_channel[in] The specified capture/compare channel.

  • cc_value[in] Value to write to the capture/compare register.

NRFY_STATIC_INLINE uint32_t nrfy_timer_cc_get(NRF_TIMER_Type const *p_reg, nrf_timer_cc_channel_t cc_channel)

See also

nrf_timer_cc_get Function for retrieving the capture/compare value for a specified channel.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • cc_channel[in] The specified capture/compare channel.

Returns:

Value from the specified capture/compare register.

NRFY_STATIC_INLINE nrf_timer_task_t nrfy_timer_capture_task_get(uint8_t channel)

See also

nrf_timer_capture_task_get Function for getting the specified timer capture task.

Parameters:
  • channel[in] Capture channel.

Returns:

Capture task.

NRFY_STATIC_INLINE nrf_timer_event_t nrfy_timer_compare_event_get(uint8_t channel)

See also

nrf_timer_compare_event_get Function for getting the specified timer compare event.

Parameters:
  • channel[in] Compare channel.

Returns:

Compare event.

NRFY_STATIC_INLINE nrf_timer_int_mask_t nrfy_timer_compare_int_get(uint8_t channel)

See also

nrf_timer_compare_int_get Function for getting the specified timer compare interrupt.

Parameters:
  • channel[in] Compare channel.

Returns:

Compare interrupt.

NRFY_STATIC_INLINE void nrfy_timer_one_shot_enable(NRF_TIMER_Type *p_reg, nrf_timer_cc_channel_t cc_channel)

See also

nrf_timer_one_shot_enable Function for enabling one-shot operation for the specified capture/compare channel.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • cc_channel[in] Capture/compare channel.

NRFY_STATIC_INLINE void nrfy_timer_one_shot_disable(NRF_TIMER_Type *p_reg, nrf_timer_cc_channel_t cc_channel)

See also

nrf_timer_one_shot_disable Function for disabling one-shot operation for the specified capture/compare channel.

Parameters:
  • p_reg[in] Pointer to the structure of registers of the peripheral.

  • cc_channel[in] Capture/compare channel.

struct nrfy_timer_config_t
#include <nrfy_timer.h>

TIMER configuration structure.

Public Members

uint32_t prescaler

Prescaler value.

nrf_timer_mode_t mode

Mode of operation.

nrf_timer_bit_width_t bit_width

Bit width.