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

cpu/nrf5x_common/periph_timer: fix spurious IRQs

This commit is contained in:
Marian Buschsieweke 2022-11-24 15:03:10 +01:00
parent 26d5b7ca0b
commit fbd7b77331
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -102,6 +102,12 @@ int timer_set_absolute(tim_t tim, int chan, unsigned int value)
ctx[tim].flags |= (1 << chan);
dev(tim)->CC[chan] = value;
/* clear spurious IRQs */
dev(tim)->EVENTS_COMPARE[chan] = 0;
(void)dev(tim)->EVENTS_COMPARE[chan];
/* enable IRQ */
dev(tim)->INTENSET = (TIMER_INTENSET_COMPARE0_Msk << chan);
return 0;
@ -126,6 +132,12 @@ int timer_set_periodic(tim_t tim, int chan, unsigned int value, uint8_t flags)
if (flags & TIM_FLAG_RESET_ON_SET) {
dev(tim)->TASKS_CLEAR = 1;
}
/* clear spurious IRQs */
dev(tim)->EVENTS_COMPARE[chan] = 0;
(void)dev(tim)->EVENTS_COMPARE[chan];
/* enable IRQ */
dev(tim)->INTENSET = (TIMER_INTENSET_COMPARE0_Msk << chan);
/* re-start timer */