From a73ddbd045808fd7dca0b68c6eb675d74ab77abc Mon Sep 17 00:00:00 2001 From: Dylan Laduranty Date: Wed, 28 Jun 2023 16:40:15 +0200 Subject: [PATCH] cpu/nrf5x_common: reset all available CC channels Except the last channel used for capture Signed-off-by: Dylan Laduranty --- cpu/nrf5x_common/periph/timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu/nrf5x_common/periph/timer.c b/cpu/nrf5x_common/periph/timer.c index ce0644e519..cefe07ddaf 100644 --- a/cpu/nrf5x_common/periph/timer.c +++ b/cpu/nrf5x_common/periph/timer.c @@ -82,9 +82,9 @@ int timer_init(tim_t tim, uint32_t freq, timer_cb_t cb, void *arg) } /* reset compare state */ - dev(tim)->EVENTS_COMPARE[0] = 0; - dev(tim)->EVENTS_COMPARE[1] = 0; - dev(tim)->EVENTS_COMPARE[2] = 0; + for (unsigned i = 0; i < timer_config[tim].channels; i++) { + dev(tim)->EVENTS_COMPARE[i] = 0; + } /* enable interrupts */ NVIC_EnableIRQ(timer_config[tim].irqn);