8000 Make waveform generator a NMI to run always, increase accuracy by earlephilhower · Pull Request #5578 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Make waveform generator a NMI to run always, increase accuracy #5578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 11, 2019
Merged
Prev Previous commit
Next Next commit
Fix boolean/bitmask typo in starting waveform
  • Loading branch information
earlephilhower committed Jan 5, 2019
commit 923f2f41033ebecfdfc64a7d4caa4a1f6d4b24d4
4 changes: 2 additions & 2 deletions cores/esp8266/core_esp8266_waveform.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
}

uint32_t mask = 1<<pin;
if (!waveformEnabled && mask) {
if (!(waveformEnabled & mask)) {
// Actually set the pin high or low in the IRQ service to guarantee times
wave->nextServiceCycle = GetCycleCount() + MicrosecondsToCycles(1);
waveformToEnable |= mask;
Expand All @@ -143,7 +143,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
}
timer1_write(MicrosecondsToCycles(1)); // Cause an interrupt post-haste
while (waveformToEnable) {
delay(1); // Wait for waveform to update
delay(0); // Wait for waveform to update
}
}

Expand Down
0