Skip to content

Commit c43b321

Browse files
Make waveform generator a NMI to run always
Make the waveform generator an NMI using the same code as in 2.4.0. Making it NMI will ensure it runs even when interrupts are disabled. Fixes esp8266#5568
1 parent b26c19e commit c43b321

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cores/esp8266/core_esp8266_waveform.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
*/
3939

4040
#include <Arduino.h>
41+
#include "ets_sys.h"
4142
#include "core_esp8266_waveform.h"
4243

4344
// Need speed, not size, here
@@ -130,15 +131,15 @@ static uint32_t lastCycleCount = 0; // Last ESP cycle counter on running the int
130131

131132
static void initTimer() {
132133
timer1_disable();
133-
timer1_isr_init();
134-
timer1_attachInterrupt(timer1Interrupt);
134+
ETS_FRC_TIMER1_INTR_ATTACH(NULL, NULL);
135+
ETS_FRC_TIMER1_NMI_INTR_ATTACH(timer1Interrupt);
135136
lastCycleCount = GetCycleCount();
136137
timer1_enable(TIM_DIV1, TIM_EDGE, TIM_SINGLE);
137138
timerRunning = true;
138139
}
139140

140141
static void ICACHE_RAM_ATTR deinitTimer() {
141-
timer1_attachInterrupt(NULL);
142+
ETS_FRC_TIMER1_NMI_INTR_ATTACH(NULL);
142143
timer1_disable();
143144
timer1_isr_init();
144145
timerRunning = false;

0 commit comments

Comments
 (0)