Provides functionality to trigger periodic event callbacks. More...
Provides functionality to trigger periodic event callbacks.
This provides convenience functions to trigger periodic event callbacks executed by the event thread.
Event Periodic Callback API
Definition in file periodic_callback.h.
Go to the source code of this file.
Data Structures | |
struct | event_periodic_callback_t |
Periodic Callback Event structure. More... | |
static void * | event_periodic_callback_get_arg (event_periodic_callback_t *event) |
Get user context from Periodic Callback Event. | |
static void | event_periodic_callback_init (event_periodic_callback_t *event, ztimer_clock_t *clock, event_queue_t *queue, void(*callback)(void *), void *arg) |
Initialize a periodic callback event. | |
static void | event_periodic_callback_start (event_periodic_callback_t *event, uint32_t interval) |
Starts a periodic callback event. | |
static void | event_periodic_callback_create (event_periodic_callback_t *event, ztimer_clock_t *clock, uint32_t interval, event_queue_t *queue, void(*callback)(void *), void *arg) |
Initialize and start a periodic callback event. | |
static uint32_t | event_periodic_callback_get_interval (const event_periodic_callback_t *event) |
Get the interval in which the periodic callback event repeats. | |
static void | event_periodic_callback_set_count (event_periodic_callback_t *event, uint32_t count) |
Set the amount of times the periodic callback event should repeat itself. | |
static uint32_t | event_periodic_callback_get_count (const event_periodic_callback_t *event) |
Get the amount of times the periodic callback event should repeat itself. | |
static void | event_periodic_callback_stop (event_periodic_callback_t *event) |
Stop a periodic callback event. | |
|
inlinestatic |
Initialize and start a periodic callback event.
This is a convenience function that combines event_periodic_callback_init and event_periodic_callback_start
[out] | event | event_periodic_callback object to initialize |
[in] | clock | the clock to configure this timer on |
[in] | interval | period length for the event |
[in] | queue | queue that the timed-out event will be added to |
[in] | callback | callback to set up |
[in] | arg | callback argument to set up |
Definition at line 115 of file periodic_callback.h.
|
inlinestatic |
Get user context from Periodic Callback Event.
[in] | event | event_periodic_callback object to initialize |
Definition at line 50 of file periodic_callback.h.
|
inlinestatic |
Get the amount of times the periodic callback event should repeat itself.
[in] | event | event_periodic_callback context object to use |
Definition at line 156 of file periodic_callback.h.
|
inlinestatic |
Get the interval in which the periodic callback event repeats.
[in] | event | event_periodic_callback context object to use |
Definition at line 131 of file periodic_callback.h.
|
inlinestatic |
Initialize a periodic callback event.
[in] | event | event_periodic_callback 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] | callback | callback to set up |
[in] | arg | callback argument to set up |
Definition at line 66 of file periodic_callback.h.
|
inlinestatic |
Set the amount of times the periodic callback event should repeat itself.
[in] | event | event_periodic_callback context object to use |
[in] | count | times the event should repeat itself, EVENT_PERIODIC_FOREVER to run for ever. |
Definition at line 143 of file periodic_callback.h.
|
inlinestatic |
Starts a periodic callback event.
If the event is already started, it's interval will be updated and it will be scheduled with the new interval.
This will make the event as configured in event
be triggered at every interval ticks (based on event->periodic.clock).
[in] | event | event_periodic_callback context object to use |
[in] | interval | period length for the event |
Definition at line 95 of file periodic_callback.h.
|
inlinestatic |
Stop a periodic callback 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 | event_periodic_callback context object to use |
Definition at line 175 of file periodic_callback.h.