Provides functionality to trigger periodic events. More...
Provides functionality to trigger periodic events.
event_periodic intentionally doesn't extend event structures in order to support events that are integrated in larger structs intrusively.
Example:
Event Periodic API
Definition in file periodic.h.
Go to the source code of this file.
Data Structures | |
struct | event_periodic_t |
Timeout Event structure. More... | |
#define | EVENT_PERIODIC_FOREVER 0 |
Run the periodic event forever. | |
void | event_periodic_init (event_periodic_t *event_periodic, ztimer_clock_t *clock, event_queue_t *queue, event_t *event) |
Initialize a periodic event timeout. | |
static void | event_periodic_start_now (event_periodic_t *event_periodic, uint32_t interval) |
Starts a periodic timeout without delay for the first occurrence. | |
static void | event_periodic_start (event_periodic_t *event_periodic, uint32_t interval) |
Starts a periodic timeout. | |
static void | event_periodic_set_count (event_periodic_t *event_periodic, uint32_t count) |
Set the amount of times the periodic event should repeat itself. | |
static void | event_periodic_stop (event_periodic_t *event_periodic) |
Stop a periodic timeout event. | |
#define EVENT_PERIODIC_FOREVER 0 |
Run the periodic event forever.
Definition at line 49 of file periodic.h.
void event_periodic_init | ( | event_periodic_t * | event_periodic, |
ztimer_clock_t * | clock, | ||
event_queue_t * | queue, | ||
event_t * | event | ||
) |
Initialize a periodic event timeout.
[in] | event_periodic | event_periodic object to initialize |
[in] | clock | the clock to configure this timer on |
[in] | queue | queue that the timed-out event will be added to |
[in] | event | event to add to queue after timeout |
|
inlinestatic |
Set the amount of times the periodic event should repeat itself.
[in] | event_periodic | event_timout context object to use |
[in] | count | times the event should repeat itself, EVENT_PERIODIC_FOREVER to run for ever. |
Definition at line 124 of file periodic.h.
|
inlinestatic |
Starts a periodic timeout.
This will make the event as configured in event_periodic
be triggered at every interval ticks (based on event_periodic->clock).
[in] | event_periodic | event_timout context object to use |
[in] | interval | period length for the event |
Definition at line 111 of file periodic.h.
|
inlinestatic |
Starts a periodic timeout without delay for the first occurrence.
This will make the event as configured in event_periodic
be triggered at every interval ticks (based on event_periodic->clock).
[in] | event_periodic | event_timout context object to use |
[in] | interval | period length for the event |
Definition at line 91 of file periodic.h.
|
inlinestatic |
Stop a periodic timeout event.
Calling this function will cancel the timeout by removing its underlying timer. If the timer has already fired before calling this function, the connected event will be put already into the given event queue and this function does not have any effect.
[in] | event_periodic | event_periodic_timeout context object to use |
Definition at line 146 of file periodic.h.