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

drivers/periph_common/timer: protect timer_set from IRQs

This commit is contained in:
Michel Rottleuthner 2020-01-09 15:51:59 +01:00
parent 87d00ab294
commit 8e7a1edd11

View File

@ -19,10 +19,14 @@
*/
#include "periph/timer.h"
#include "irq.h"
#ifndef PERIPH_TIMER_PROVIDES_SET
int timer_set(tim_t dev, int channel, unsigned int timeout)
{
return timer_set_absolute(dev, channel, timer_read(dev) + timeout);
unsigned int state = irq_disable();
int res = timer_set_absolute(dev, channel, timer_read(dev) + timeout);
irq_restore(state);
return res;
}
#endif