mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/ztimer: add ztimer_periodic_start_now()
This commit is contained in:
parent
0ffad1d65f
commit
2b682585a7
@ -130,6 +130,19 @@ void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer,
|
||||
*/
|
||||
void ztimer_periodic_start(ztimer_periodic_t *timer);
|
||||
|
||||
/**
|
||||
* @brief Start or restart a periodic timer without initial timer delay
|
||||
*
|
||||
* When called on a newly initialized timer, the timer will start.
|
||||
*
|
||||
* When called on an already running timer, the current interval is reset to its
|
||||
* start (thus the next callback will be called after the configured interval
|
||||
* has passed).
|
||||
*
|
||||
* @param[in] timer periodic timer object to work on
|
||||
*/
|
||||
void ztimer_periodic_start_now(ztimer_periodic_t *timer);
|
||||
|
||||
/**
|
||||
* @brief Stop a periodic timer
|
||||
*
|
||||
|
@ -75,6 +75,11 @@ void ztimer_periodic_start(ztimer_periodic_t *timer)
|
||||
timer->last = ztimer_set(timer->clock, &timer->timer, timer->interval) + timer->interval;
|
||||
}
|
||||
|
||||
void ztimer_periodic_start_now(ztimer_periodic_t *timer)
|
||||
{
|
||||
timer->last = ztimer_set(timer->clock, &timer->timer, 0);
|
||||
}
|
||||
|
||||
void ztimer_periodic_stop(ztimer_periodic_t *timer)
|
||||
{
|
||||
ztimer_remove(timer->clock, &timer->timer);
|
||||
|
Loading…
Reference in New Issue
Block a user