Skip to content

Low Level Timer

Types

miramesh_timer_callback_t

typedef void(* miramesh_timer_callback_t) (miracore_timer_time_t now, void *storage);

Functions

miramesh_timer_schedule

void miramesh_timer_schedule(miracore_timer_time_t time, miramesh_timer_callback_t callback, void *storage);

Schedule a timer.

If scheduled to the past, the execution will be done immediately.

Previous scheduling for the given channel is replaced.

Note

The callback is called from an interrupt context. The function may only be called from the callback or from an application context.

Use miramesh_timer_get_time_now to get the current time.

Parameters

Name Description
time When the callback should be called
callback The function being called
storage This argument is passed to the callback function

miramesh_timer_clear

void miramesh_timer_clear(void);

Remove a scheduled timer.

The function can be called from any IRQ level. It is still possible the timer will be called after the current IRQ finishes or that the timer callback is called during the call.

miramesh_timer_get_time_now

miracore_timer_time_t miramesh_timer_get_time_now(void);

Gets the current time.

miramesh_timer_time_add_us

miracore_timer_time_t miramesh_timer_time_add_us(miracore_timer_time_t time, int32_t interval);

Add an interval in microseconds to the given time.

Parameters

Name Description
time The time to be added to.
interval How much (in microseconds) the time should change.
Back to top