Skip to content

Commit e0e8159

Browse files
committed
Use RAII idiom
(cherry picked from commit 15c0b5b356aad0c3032b96ed6db0ec70cbf719d3) # Conflicts: # cores/esp8266/core_esp8266_wiring_digital.cpp
1 parent 422cdeb commit e0e8159

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp8266/core_esp8266_wiring_digital.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "ets_sys.h"
2727
#include "user_interface.h"
2828
#include "core_esp8266_waveform.h"
29+
#include "interrupts.h"
2930

3031
extern "C" {
3132

@@ -147,7 +148,7 @@ void ICACHE_RAM_ATTR interrupt_handler(void*)
147148
(handler->mode & 1) == !!(levels & (1 << i)))) {
148149
// to make ISR compatible to Arduino AVR model where interrupts are disabled
149150
// we disable them before we call the client ISR
150-
uint32_t savedPS = xt_rsil(15); // stop other interrupts
151+
esp8266::InterruptLock irqLock; // stop other interrupts
151152
if (handler->functional)
152153
{
153154
ArgStructure* localArg = (ArgStructure*)handler->arg;
@@ -166,7 +167,6 @@ void ICACHE_RAM_ATTR interrupt_handler(void*)
166167
{
167168
handler->fn();
168169
}
169-
xt_wsr_ps(savedPS);
170170
}
171171
}
172172
ETS_GPIO_INTR_ENABLE();

0 commit comments

Comments
 (0)