Timer#
- group bsp_timer
High level timing functions on top of the RTC peripheral.
- Author
Alexandre Abadie alexandre.abadie@inria.fr
- Copyright
Inria, 2022
Typedefs
-
typedef void (*timer_cb_t)(void)#
Callback function prototype, it is called when the timer fires an event.
Functions
-
void db_timer_init(void)#
Configure an RTC timer with millisecond precision.
-
uint32_t db_timer_ticks(void)#
Returns the number of ticks since timer initialization.
- Returns:
number of ticks (1 tick ~ 30us)
-
void db_timer_set_periodic_ms(uint8_t channel, uint32_t ms, timer_cb_t cb)#
Set a callback to be called periodically.
- Parameters:
channel – [in] RTC channel used
ms – [in] periodicity in milliseconds
cb – [in] callback function
-
void db_timer_set_oneshot_ticks(uint8_t channel, uint32_t ticks, timer_cb_t cb)#
Set a callback to be called once after an amount of ticks (1 tick ~= 30us)
- Parameters:
channel – [in] RTC channel used
ticks – [in] delay in ticks
cb – [in] callback function
-
void db_timer_set_oneshot_ms(uint8_t channel, uint32_t ms, timer_cb_t cb)#
Set a callback to be called once after an amount of milliseconds.
- Parameters:
channel – [in] RTC channel used
ms – [in] delay in milliseconds
cb – [in] callback function
-
void db_timer_set_oneshot_s(uint8_t channel, uint32_t s, timer_cb_t cb)#
Set a callback to be called once after an amount of seconds.
- Parameters:
channel – [in] RTC channel used
s – [in] delay in seconds
cb – [in] callback function
-
void db_timer_delay_ticks(uint32_t ticks)#
Add a delay in ticks (1 tick ~ 30us)
- Parameters:
ticks – [in] delay in ticks
-
void db_timer_delay_ms(uint32_t ms)#
Add a delay in milliseconds.
- Parameters:
ms – [in] delay in milliseconds
-
void db_timer_delay_s(uint32_t s)#
Add a delay in seconds.
- Parameters:
s – [in] delay in seconds