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:
parent
7cec79188b
commit
eadb3741e3
@ -57,6 +57,7 @@ void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer,
|
|||||||
bool (*callback)(
|
bool (*callback)(
|
||||||
void *), void *arg, uint32_t interval)
|
void *), void *arg, uint32_t interval)
|
||||||
{
|
{
|
||||||
|
ztimer_remove(clock, &timer->timer);
|
||||||
*timer =
|
*timer =
|
||||||
(ztimer_periodic_t){ .clock = clock, .interval = interval,
|
(ztimer_periodic_t){ .clock = clock, .interval = interval,
|
||||||
.callback = callback, .arg = arg,
|
.callback = callback, .arg = arg,
|
||||||
|
Loading…
Reference in New Issue
Block a user