Provides timers for events up to $2^{32}$ milliseconds in the future.
More...
Provides timers for events up to $2^{32}$ milliseconds in the future.
- Note
- Experimental and likely to replaced with unified timer API
RIOT's main timer subsystem is ztimer but compared to ztimer, evtimer offers:
- only relative 32-bit millisecond timer values Events can be scheduled with a relative offset of up to ~49.7 days in the future. **For time-critical stuff, use ztimer!**
- more flexible, "intrusive" timer type evtimer_event_t only contains the necessary fields, which can be extended as needed, and handlers define actions taken on timer triggers. Check out evtimer_msg_event_t as example.
- when a number of timeouts with the same callback function need to be scheduled, evtimer is using less RAM (due to storing the callback function only once), while each ztimer has a function pointer for the callback.
◆ evtimer_callback_t
Event timer callback type.
Definition at line 64 of file evtimer.h.
◆ evtimer_msg_t
◆ _evtimer_mbox_handler()
Event handler for mbox events.
- Precondition
event
is not NULL.
- Parameters
-
[in] | event | The event to handle |
Definition at line 66 of file evtimer_mbox.h.
◆ _evtimer_msg_handler()
Event handler for IPC messages.
- Parameters
-
[in] | event | The event to handle |
Definition at line 67 of file evtimer_msg.h.
◆ evtimer_add()
Adds event to an event timer.
- Parameters
-
[in] | evtimer | An event timer |
[in] | event | An event |
◆ evtimer_add_mbox()
Adds mbox event to an event timer.
- Precondition
evtimer
is not NULL.
-
event
is not NULL.
-
mbox
is not NULL.
- Parameters
-
[in] | evtimer | Timer to add event . |
[in] | event | Event to add. |
[in] | mbox | Mbox to store event->msg timer expiration. |
Definition at line 50 of file evtimer_mbox.h.
◆ evtimer_add_msg()
Adds event to an event timer that handles events via IPC.
- Parameters
-
[in] | evtimer | An event timer |
[in] | event | An event |
[in] | target_pid | The PID of the thread that should receive the IPC message |
Definition at line 53 of file evtimer_msg.h.
◆ evtimer_del()
Removes an event from an event timer.
- Parameters
-
[in] | evtimer | An event timer |
[in] | event | An event |
◆ evtimer_init()
Initializes an event timer.
- Warning
- BEWARE! Callbacks from evtimer_init() are being executed in interrupt context. DON'T USE THIS FUNCTION unless you know exactly what that means.
- Parameters
-
[in] | evtimer | An event timer |
[in] | handler | An event handler function |
◆ evtimer_init_mbox()
static void evtimer_init_mbox |
( |
evtimer_t * |
evtimer | ) |
|
|
inlinestatic |
Initializes event timer for mbox events.
- Precondition
evtimer
is not NULL.
- Parameters
-
[in] | evtimer | An event timer |
Definition at line 80 of file evtimer_mbox.h.
◆ evtimer_init_msg()
static void evtimer_init_msg |
( |
evtimer_t * |
evtimer | ) |
|
|
inlinestatic |
Initializes event timer to handle events via IPC.
- Parameters
-
[in] | evtimer | An event timer |
Definition at line 78 of file evtimer_msg.h.
◆ evtimer_now_msec()
static uint32_t evtimer_now_msec |
( |
void |
| ) |
|
|
inlinestatic |
Return the current system time in msec.
Definition at line 115 of file evtimer.h.
◆ evtimer_print()
void evtimer_print |
( |
const evtimer_t * |
evtimer | ) |
|
Print overview of current state of an event timer.
- Parameters
-
[in] | evtimer | An event timer |