From 7cbf516e3b8167100eb4ce90c170afbdaf25d47a Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 1 Feb 2024 17:11:37 +0100 Subject: [PATCH] event_periodic_callback: add getter for interval & count --- sys/include/event/periodic_callback.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sys/include/event/periodic_callback.h b/sys/include/event/periodic_callback.h index 8c430ff984..dac03c5ca5 100644 --- a/sys/include/event/periodic_callback.h +++ b/sys/include/event/periodic_callback.h @@ -97,6 +97,18 @@ static inline void event_periodic_callback_start(event_periodic_callback_t *even event_periodic_start(&event->periodic, interval); } +/** + * @brief Get the interval in which the periodic callback event repeats + * + * @param[in] event event_periodic_callback context object to use + * + * @returns The interval of the underlying timer in which the event repeats + */ +static inline uint32_t event_periodic_callback_get_interval(const event_periodic_callback_t *event) +{ + return event->periodic.timer.interval; +} + /** * @brief Set the amount of times the periodic callback event should repeat itself. * @@ -110,6 +122,18 @@ static inline void event_periodic_callback_set_count(event_periodic_callback_t * event_periodic_set_count(&event->periodic, count); } +/** + * @brief Get the amount of times the periodic callback event should repeat itself. + * + * @param[in] event event_periodic_callback context object to use + * @returns times the event should repeat itself, + * EVENT_PERIODIC_FOREVER if it will repeat forever or is exhausted + */ +static inline uint32_t event_periodic_callback_get_count(const event_periodic_callback_t *event) +{ + return event->periodic.count; +} + /** * @brief Stop a periodic callback event *