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 xtimer, but for many applications xtimer's 64-bit absolute time values are wasteful or clumsy to use.
Compared to xtimer, 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 xtimer!**
- 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.
- uses xtimer as backend by default. Alternatively, with the pseudomodule "evtimer_on_ztimer" compiled in, evtimer is backend by ZTIMER_MSEC.
◆ _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_print()
void evtimer_print |
( |
const evtimer_t * |
evtimer | ) |
|
Print overview of current state of an event timer.
- Parameters
-
[in] | evtimer | An event timer |