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 uint8_t timer_t#
RTC peripheral index.
-
typedef void (*timer_cb_t)(void)#
Callback function prototype, it is called when the timer fires an event.
Functions
-
void db_timer_init(timer_t timer)#
Configure an RTC timer with millisecond precision.
- Parameters:
timer – [in] timer reference used
-
uint32_t db_timer_ticks(timer_t timer)#
Returns the number of ticks since timer initialization.
- Parameters:
timer – [in] timer reference used
- Returns:
number of ticks (1 tick ~ 30us)
-
void db_timer_set_periodic_ms(timer_t timer, uint8_t channel, uint32_t ms, timer_cb_t cb)#
Set a callback to be called periodically.
- Parameters:
timer – [in] timer reference used
channel – [in] RTC channel used
ms – [in] periodicity in milliseconds
cb – [in] callback function
-
void db_timer_set_oneshot_ticks(timer_t timer, 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:
timer – [in] timer reference used
channel – [in] RTC channel used
ticks – [in] delay in ticks
cb – [in] callback function
-
void db_timer_set_oneshot_ms(timer_t timer, uint8_t channel, uint32_t ms, timer_cb_t cb)#
Set a callback to be called once after an amount of milliseconds.
- Parameters:
timer – [in] timer reference used
channel – [in] RTC channel used
ms – [in] delay in milliseconds
cb – [in] callback function
-
void db_timer_set_oneshot_s(timer_t timer, uint8_t channel, uint32_t s, timer_cb_t cb)#
Set a callback to be called once after an amount of seconds.
- Parameters:
timer – [in] timer reference used
channel – [in] RTC channel used
s – [in] delay in seconds
cb – [in] callback function
-
void db_timer_delay_ticks(timer_t timer, uint32_t ticks)#
Add a delay in ticks (1 tick ~ 30us)
- Parameters:
timer – [in] timer reference used
ticks – [in] delay in ticks