diff --git a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c index 0e673549b..7cdfa3fbc 100644 --- a/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c +++ b/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_digital.c @@ -139,6 +139,21 @@ extern void __detachInterrupt(uint8_t pin) { } } +static uint32_t interruptState = 0; + +void xt_disable_interrupts() +{ + __asm__ __volatile__("rsil %0,15":"=a" (interruptState)); + __asm__("esync"); + __asm__("isync"); + __asm__("dsync"); +} +void xt_enable_interrupts() +{ + __asm__ __volatile__("wsr %0,ps"::"a" (interruptState) : "memory"); + __asm__("esync"); +} + void initPins() { //Disable UART interrupts system_set_os_print(0);