Skip to content

Commit

Permalink
ztimer/periodic: remove timer on init if already running
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Jul 12, 2023
1 parent 7cec791 commit eadb374
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sys/ztimer/periodic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit eadb374

Please sign in to comment.