1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

event_periodic_callback: add event_periodic_callback_create()

This commit is contained in:
Benjamin Valentin 2024-03-12 11:06:37 +01:00
parent 1bf643dd5a
commit 6f604a8137

View File

@ -97,6 +97,28 @@ static inline void event_periodic_callback_start(event_periodic_callback_t *even
event_periodic_start(&event->periodic, interval);
}
/**
* @brief Initialize and start a periodic callback event
*
* This is a convenience function that combines @ref event_periodic_callback_init
* and @ref event_periodic_callback_start
*
* @param[out] event event_periodic_callback object to initialize
* @param[in] clock the clock to configure this timer on
* @param[in] interval period length for the event
* @param[in] queue queue that the timed-out event will be added to
* @param[in] callback callback to set up
* @param[in] arg callback argument to set up
*/
static inline 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)
{
event_periodic_callback_init(event, clock, queue, callback, arg);
event_periodic_callback_start(event, interval);
}
/**
* @brief Get the interval in which the periodic callback event repeats
*