From f8115c32c937733c07232a33a8d6187af669d032 Mon Sep 17 00:00:00 2001 From: "Dirk O. Kaar" Date: Sat, 21 Nov 2020 18:25:51 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20callback=20expected=20return=20to=20CPU?= =?UTF-8?q?=20cycles=20instead=20of=20=C2=B5s=20for=20PR=207022.=20Fix=20i?= =?UTF-8?q?nline=20documentaton=20for=20both?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit waveform "flavors". --- cores/esp8266/core_esp8266_waveform_phase.cpp | 2 +- cores/esp8266/core_esp8266_waveform_phase.h | 2 +- cores/esp8266/core_esp8266_waveform_pwm.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cores/esp8266/core_esp8266_waveform_phase.cpp b/cores/esp8266/core_esp8266_waveform_phase.cpp index 62e3ad3dd..3d8eb1a89 100644 --- a/cores/esp8266/core_esp8266_waveform_phase.cpp +++ b/cores/esp8266/core_esp8266_waveform_phase.cpp @@ -405,7 +405,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { int32_t callbackCcys = 0; if (waveform.timer1CB) { - callbackCcys = scaleCcys(microsecondsToClockCycles(waveform.timer1CB()), isCPU2X); + callbackCcys = scaleCcys(waveform.timer1CB(), isCPU2X); } now = ESP.getCycleCount(); int32_t nextEventCcys = waveform.nextEventCcy - now; diff --git a/cores/esp8266/core_esp8266_waveform_phase.h b/cores/esp8266/core_esp8266_waveform_phase.h index e24819a65..dff8fe502 100644 --- a/cores/esp8266/core_esp8266_waveform_phase.h +++ b/cores/esp8266/core_esp8266_waveform_phase.h @@ -75,7 +75,7 @@ int startWaveformClockCycles(uint8_t pin, uint32_t timeHighCcys, uint32_t timeLo int stopWaveform(uint8_t pin); // Add a callback function to be called on *EVERY* timer1 trigger. The -// callback returns the number of microseconds until the next desired call. +// callback must return the number of CPU clock cycles until the next desired call. // However, since it is called every timer1 interrupt, it may be called // again before this period. It should therefore use the ESP Cycle Counter // to determine whether or not to perform an operation. diff --git a/cores/esp8266/core_esp8266_waveform_pwm.h b/cores/esp8266/core_esp8266_waveform_pwm.h index 8d60e4e7c..3d66bc141 100644 --- a/cores/esp8266/core_esp8266_waveform_pwm.h +++ b/cores/esp8266/core_esp8266_waveform_pwm.h @@ -62,7 +62,7 @@ int startWaveformClockCycles(uint8_t pin, uint32_t timeHighCycles, uint32_t time int stopWaveform(uint8_t pin); // Add a callback function to be called on *EVERY* timer1 trigger. The -// callback returns the number of microseconds until the next desired call. +// callback must return the number of CPU clock cycles until the next desired call. // However, since it is called every timer1 interrupt, it may be called // again before this period. It should therefore use the ESP Cycle Counter // to determine whether or not to perform an operation.