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

ztimer/periodic: acquire resp. release used ztimer clock

This commit is contained in:
Jue 2022-11-03 14:03:03 +01:00
parent bf5dd34deb
commit 96b7988511

View File

@ -68,6 +68,8 @@ void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer,
void ztimer_periodic_start(ztimer_periodic_t *timer)
{
ztimer_acquire(timer->clock);
uint32_t now = ztimer_now(timer->clock);
timer->last = now;
@ -77,4 +79,6 @@ void ztimer_periodic_start(ztimer_periodic_t *timer)
void ztimer_periodic_stop(ztimer_periodic_t *timer)
{
ztimer_remove(timer->clock, &timer->timer);
ztimer_release(timer->clock);
}