Skip to content

Commit 32dbc2c

Browse files
authored
Merge pull request #7717 from dok-net/phaselocked_cb_fix
Waveform, fix callback return to CPU cycles instead of µs (wrt PR 7022)
2 parents 47a57e1 + f8115c3 commit 32dbc2c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Diff for: cores/esp8266/core_esp8266_waveform_phase.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
405405

406406
int32_t callbackCcys = 0;
407407
if (waveform.timer1CB) {
408-
callbackCcys = scaleCcys(microsecondsToClockCycles(waveform.timer1CB()), isCPU2X);
408+
callbackCcys = scaleCcys(waveform.timer1CB(), isCPU2X);
409409
}
410410
now = ESP.getCycleCount();
411411
int32_t nextEventCcys = waveform.nextEventCcy - now;

Diff for: cores/esp8266/core_esp8266_waveform_phase.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int startWaveformClockCycles(uint8_t pin, uint32_t timeHighCcys, uint32_t timeLo
7575
int stopWaveform(uint8_t pin);
7676

7777
// Add a callback function to be called on *EVERY* timer1 trigger. The
78-
// callback returns the number of microseconds until the next desired call.
78+
// callback must return the number of CPU clock cycles until the next desired call.
7979
// However, since it is called every timer1 interrupt, it may be called
8080
// again before this period. It should therefore use the ESP Cycle Counter
8181
// to determine whether or not to perform an operation.

Diff for: cores/esp8266/core_esp8266_waveform_pwm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int startWaveformClockCycles(uint8_t pin, uint32_t timeHighCycles, uint32_t time
6262
int stopWaveform(uint8_t pin);
6363

6464
// Add a callback function to be called on *EVERY* timer1 trigger. The
65-
// callback returns the number of microseconds until the next desired call.
65+
// callback must return the number of CPU clock cycles until the next desired call.
6666
// However, since it is called every timer1 interrupt, it may be called
6767
// again before this period. It should therefore use the ESP Cycle Counter
6868
// to determine whether or not to perform an operation.

0 commit comments

Comments
 (0)