Skip to content

Commit

Permalink
Make waveform generator a NMI to run always
Browse files Browse the repository at this point in the history
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
  • Loading branch information
earlephilhower committed Jan 3, 2019
1 parent b26c19e commit c43b321
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cores/esp8266/core_esp8266_waveform.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*/

#include <Arduino.h>
#include "ets_sys.h"
#include "core_esp8266_waveform.h"

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

static void initTimer() {
timer1_disable();
timer1_isr_init();
timer1_attachInterrupt(timer1Interrupt);
ETS_FRC_TIMER1_INTR_ATTACH(NULL, NULL);
ETS_FRC_TIMER1_NMI_INTR_ATTACH(timer1Interrupt);
lastCycleCount = GetCycleCount();
timer1_enable(TIM_DIV1, TIM_EDGE, TIM_SINGLE);
timerRunning = true;
}

static void ICACHE_RAM_ATTR deinitTimer() {
timer1_attachInterrupt(NULL);
ETS_FRC_TIMER1_NMI_INTR_ATTACH(NULL);
timer1_disable();
timer1_isr_init();
timerRunning = false;
Expand Down

0 comments on commit c43b321

Please sign in to comment.