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

ztimer/periodic: remove timer on init if already running

This commit is contained in:
Benjamin Valentin 2023-07-06 18:39:39 +02:00
parent 7cec79188b
commit eadb3741e3

View File

@ -57,6 +57,7 @@ void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer,
bool (*callback)(
void *), void *arg, uint32_t interval)
{
ztimer_remove(clock, &timer->timer);
*timer =
(ztimer_periodic_t){ .clock = clock, .interval = interval,
.callback = callback, .arg = arg,