diff --git a/drivers/periph_common/timer.c b/drivers/periph_common/timer.c index 5fcf6275f1..8e657312a8 100644 --- a/drivers/periph_common/timer.c +++ b/drivers/periph_common/timer.c @@ -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