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:
parent
87d00ab294
commit
8e7a1edd11
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user