mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/nrf5x: Tolerate NULL callback in timers
timer_set has no documented restriction on this being not null, other implementations explicitly tolerate it (rpx0xx checks inside the ISR, but doing it at init time keeps the ISR slim). This is useful when using a timer just to read, without any action when it triggers (the action is taken depending on read values, eg. in a thread context).
This commit is contained in:
parent
5ba18df6fb
commit
abf95d14a6
@ -111,7 +111,9 @@ int timer_init(tim_t tim, uint32_t freq, timer_cb_t cb, void *arg)
|
||||
}
|
||||
|
||||
/* enable interrupts */
|
||||
NVIC_EnableIRQ(timer_config[tim].irqn);
|
||||
if (cb != NULL) {
|
||||
NVIC_EnableIRQ(timer_config[tim].irqn);
|
||||
}
|
||||
/* start the timer */
|
||||
dev(tim)->TASKS_START = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user