Timer_hf#

group bsp_timer_hf

High level timing functions on top of the TIMER peripheral.

Author

Alexandre Abadie alexandre.abadie@inria.fr

Copyright

Inria, 2022

Typedefs

typedef uint8_t timer_hf_t#

TIMER peripheral index.

typedef void (*timer_hf_cb_t)(void)#

Callback function prototype, it is called when the timer fires an event.

Functions

void db_timer_hf_init(timer_hf_t timer)#

Configure a high frequency timer with microsecond precision.

Parameters:
  • timer[in] timer reference used

uint32_t db_timer_hf_now(timer_hf_t timer)#

Return the current timer time in microseconds.

Parameters:
  • timer[in] timer reference used

void db_timer_hf_set_periodic_us(timer_hf_t timer, uint8_t channel, uint32_t us, timer_hf_cb_t cb)#

Set a callback to be called periodically using the high frequency timer.

Parameters:
  • timer[in] timer reference used

  • channel[in] TIMER channel used

  • us[in] periodicity in microseconds

  • cb[in] callback function

void db_timer_hf_set_oneshot_us(timer_hf_t timer, uint8_t channel, uint32_t us, timer_hf_cb_t cb)#

Set a callback to be called once after an amount of microseconds.

Parameters:
  • timer[in] timer reference used

  • channel[in] TIMER channel used

  • us[in] delay in microseconds

  • cb[in] callback function

void db_timer_hf_set_oneshot_ms(timer_hf_t timer, uint8_t channel, uint32_t ms, timer_hf_cb_t cb)#

Set a callback to be called once after an amount of milliseconds.

Parameters:
  • timer[in] timer reference used

  • channel[in] TIMER channel used

  • ms[in] delay in milliseconds

  • cb[in] callback function

void db_timer_hf_set_oneshot_s(timer_hf_t timer, uint8_t channel, uint32_t s, timer_hf_cb_t cb)#

Set a callback to be called after an amount of seconds.

Parameters:
  • timer[in] timer reference used

  • channel[in] TIMER channel used

  • s[in] delay in seconds

  • cb[in] callback function

void db_timer_hf_delay_us(timer_hf_t timer, uint32_t us)#

Add a delay in us using the high frequency timer.

Parameters:
  • timer[in] timer reference used

  • us[in] delay in us

void db_timer_hf_delay_ms(timer_hf_t timer, uint32_t ms)#

Add a delay in milliseconds using the high frequency timer.

Parameters:
  • timer[in] timer reference used

  • ms[in] delay in milliseconds

void db_timer_hf_delay_s(timer_hf_t timer, uint32_t s)#

Add a delay in seconds using the high frequency timer.

Parameters:
  • timer[in] timer reference used

  • s[in] delay in seconds