From 018df62d0c5114d354d78f310e69514b6c68dbd7 Mon Sep 17 00:00:00 2001 From: ppakotze <89007963+ppakotze@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:52:20 -0600 Subject: [PATCH 1/4] Update dscClassic.cpp Fix compiler error for updated timerBegin parameters starting ESP v.3.0 --- src/dscClassic.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/dscClassic.cpp b/src/dscClassic.cpp index c674ba9..25944fe 100644 --- a/src/dscClassic.cpp +++ b/src/dscClassic.cpp @@ -64,11 +64,15 @@ void dscClassicInterface::begin(Stream &_stream) { // esp32 timer1 calls dscDataInterrupt() from dscClockInterrupt() #elif defined(ESP32) - timer1 = timerBegin(1, 80, true); + //timer1 = timerBegin(1, 80, true); + //timerStop(timer1); + //timerAttachInterrupt(timer1, &dscDataInterrupt, true); + //timerAlarmWrite(timer1, 250, true); + //timerAlarmEnable(timer1); + timer1 = timerBegin(1000000); // 1 MHz = 1 µs per tick timerStop(timer1); - timerAttachInterrupt(timer1, &dscDataInterrupt, true); - timerAlarmWrite(timer1, 250, true); - timerAlarmEnable(timer1); + timerAttachInterrupt(timer1, &dscDataInterrupt); + timerAlarm(timer1, 250, true, 0); // 1000 ticks = 1 ms interval #endif // Generates an interrupt when the Keybus clock rises or falls - requires a hardware interrupt pin on Arduino/AVR @@ -89,8 +93,11 @@ void dscClassicInterface::stop() { // Disables esp32 timer1 #elif defined(ESP32) - timerAlarmDisable(timer1); - timerEnd(timer1); + //timerAlarmDisable(timer1); + //timerEnd(timer1); + timerDetachInterrupt(timer1); // Detach the interrupt handler + timerStop(timer1); // Stop counting + timerEnd(timer1); // Free the timer resource #endif // Disables the Keybus clock pin interrupt From cc25fdbfc351e438e35706b6941d377f45700831 Mon Sep 17 00:00:00 2001 From: ppakotze <89007963+ppakotze@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:55:35 -0600 Subject: [PATCH 2/4] Update dscClassicKeypad.cpp --- src/dscClassicKeypad.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dscClassicKeypad.cpp b/src/dscClassicKeypad.cpp index bde8357..b5be5d2 100644 --- a/src/dscClassicKeypad.cpp +++ b/src/dscClassicKeypad.cpp @@ -62,11 +62,15 @@ void dscClassicKeypadInterface::begin(Stream &_stream) { // esp32 timer1 calls dscClockInterrupt() #elif defined(ESP32) - timer1 = timerBegin(1, 80, true); + //timer1 = timerBegin(1, 80, true); + //timerStop(timer1); + //timerAttachInterrupt(timer1, &dscClockInterrupt, true); + //timerAlarmWrite(timer1, 1000, true); + //timerAlarmEnable(timer1); + timer1 = timerBegin(1000000); // 1 MHz = 1 µs per tick timerStop(timer1); - timerAttachInterrupt(timer1, &dscClockInterrupt, true); - timerAlarmWrite(timer1, 1000, true); - timerAlarmEnable(timer1); + timerAttachInterrupt(timer1, &dscClockInterrupt); + timerAlarm(timer1, 1000, true, 0); // 1000 ticks = 1 ms interval #endif intervalStart = millis(); From 4b81961e8435a6a9d87f6254aedd0b4be1906827 Mon Sep 17 00:00:00 2001 From: ppakotze <89007963+ppakotze@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:57:48 -0600 Subject: [PATCH 3/4] Update dscKeybusInterface.cpp --- src/dscKeybusInterface.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/dscKeybusInterface.cpp b/src/dscKeybusInterface.cpp index e694851..4a4a0f5 100644 --- a/src/dscKeybusInterface.cpp +++ b/src/dscKeybusInterface.cpp @@ -62,11 +62,15 @@ void dscKeybusInterface::begin(Stream &_stream) { // esp32 timer1 calls dscDataInterrupt() from dscClockInterrupt() #elif defined(ESP32) - timer1 = timerBegin(1, 80, true); + //timer1 = timerBegin(1, 80, true); + //timerStop(timer1); + //timerAttachInterrupt(timer1, &dscDataInterrupt, true); + //timerAlarmWrite(timer1, 250, true); + //timerAlarmEnable(timer1); + timer1 = timerBegin(1000000); // 1 MHz = 1 µs per tick timerStop(timer1); - timerAttachInterrupt(timer1, &dscDataInterrupt, true); - timerAlarmWrite(timer1, 250, true); - timerAlarmEnable(timer1); + timerAttachInterrupt(timer1, &dscDataInterrupt); + timerAlarm(timer1, 250, true, 0); // 1000 ticks = 1 ms interval #endif // Generates an interrupt when the Keybus clock rises or falls - requires a hardware interrupt pin on Arduino/AVR @@ -87,8 +91,11 @@ void dscKeybusInterface::stop() { // Disables esp32 timer1 #elif defined(ESP32) - timerAlarmDisable(timer1); - timerEnd(timer1); + //timerAlarmDisable(timer1); + //timerEnd(timer1); + timerDetachInterrupt(timer1); // Detach the interrupt handler + timerStop(timer1); // Stop counting + timerEnd(timer1); // Free the timer resource #endif // Disables the Keybus clock pin interrupt From f5b654e87747a95ac40106ce7ca34ea3aeee384b Mon Sep 17 00:00:00 2001 From: ppakotze <89007963+ppakotze@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:59:29 -0600 Subject: [PATCH 4/4] Update dscKeypad.cpp --- src/dscKeypad.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dscKeypad.cpp b/src/dscKeypad.cpp index cd946a0..a63c5b1 100644 --- a/src/dscKeypad.cpp +++ b/src/dscKeypad.cpp @@ -62,11 +62,15 @@ void dscKeypadInterface::begin(Stream &_stream) { // esp32 timer1 calls dscClockInterrupt() #elif defined(ESP32) - timer1 = timerBegin(1, 80, true); + //timer1 = timerBegin(1, 80, true); + //timerStop(timer1); + //timerAttachInterrupt(timer1, &dscClockInterrupt, true); + //timerAlarmWrite(timer1, 500, true); + //timerAlarmEnable(timer1); + timer1 = timerBegin(1000000); // 1 MHz = 1 µs per tick timerStop(timer1); - timerAttachInterrupt(timer1, &dscClockInterrupt, true); - timerAlarmWrite(timer1, 500, true); - timerAlarmEnable(timer1); + timerAttachInterrupt(timer1, &dscClockInterrupt); + timerAlarm(timer1, 500, true, 0); // 1000 ticks = 1 ms interval #endif intervalStart = millis();