diff --git a/lib/AnyRtttl/CHANGES b/lib/AnyRtttl/CHANGES index 491a02e4d1..2b93602049 100644 --- a/lib/AnyRtttl/CHANGES +++ b/lib/AnyRtttl/CHANGES @@ -1,6 +1,8 @@ Changes for 2.3 +* New feature: Official support for ESP8266 and ESP32. * Fixed issue #2 - Support for PROGMEM / FLASH melodies in non-blocking mode. +* Fixed issue #6 - Error compiling for board ESP32 Wrover Kit (all versions). Changes for 2.2.1: diff --git a/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino b/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino index e5039c79fb..b05f803d1f 100644 --- a/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino +++ b/lib/AnyRtttl/examples/ESP32Rtttl/ESP32Rtttl.ino @@ -9,6 +9,7 @@ const char arkanoid[] PROGMEM = "Arkanoid:d=4,o=5,b=140:8g6,16p,16g.6,2a#6,32p,8 const char mario[] PROGMEM = "mario:d=4,o=5,b=140:16e6,16e6,32p,8e6,16c6,8e6,8g6,8p,8g,8p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,16p,8c6,16p,8g,16p,8e,16p,8a,8b,16a#,8a,16g.,16e6,16g6,8a6,16f6,8g6,8e6,16c6,16d6,8b,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16c7,16p,16c7,16c7,p,16g6,16f#6,16f6,16d#6,16p,16e6,16p,16g#,16a,16c6,16p,16a,16c6,16d6,8p,16d#6,8p,16d6,8p,16c6"; // James Bond theme defined in inline code below (also stored in flash memory) +#ifdef ESP32 // tone() and noTone() are not implemented for Arduino core for the ESP32 // See https://github.com/espressif/arduino-esp32/issues/980 // and https://github.com/espressif/arduino-esp32/issues/1720 @@ -24,17 +25,19 @@ void esp32Tone(uint8_t pin, unsigned int frq, unsigned long duration) { } void esp32ToneSetup(uint8_t pin) { - ledcSetup(0, 1000, 10); // resolution always seems to be 10bit, no matter what is given - ledcAttachPin(pin, 0); + ledcAttach(pin, 1000, 10); // resolution always seems to be 10bit, no matter what is given } +#endif void setup() { pinMode(BUZZER_PIN, OUTPUT); +#ifdef ESP32 // setup AnyRtttl for ESP32 esp32ToneSetup(BUZZER_PIN); anyrtttl::setToneFunction(&esp32Tone); anyrtttl::setNoToneFunction(&esp32NoTone); +#endif Serial.begin(115200); diff --git a/lib/AnyRtttl/src/anyrtttl.h b/lib/AnyRtttl/src/anyrtttl.h index a27c84eb59..ba1aaae4af 100644 --- a/lib/AnyRtttl/src/anyrtttl.h +++ b/lib/AnyRtttl/src/anyrtttl.h @@ -28,13 +28,13 @@ namespace anyrtttl * Description: * Defines a function pointer to a tone() function ****************************************************************************/ -typedef void (*ToneFuncPtr)(uint8_t _pin, unsigned int, unsigned long); +typedef void (*ToneFuncPtr)(uint8_t pin, unsigned int frequency, unsigned long duration); /**************************************************************************** * Description: * Defines a function pointer to a noTone() function ****************************************************************************/ -typedef void (*NoToneFuncPtr)(uint8_t); +typedef void (*NoToneFuncPtr)(uint8_t pin); /**************************************************************************** * Description: diff --git a/lib/AnyRtttl/src/binrtttl.cpp b/lib/AnyRtttl/src/binrtttl.cpp index 0f7206f073..ef5cae95bd 100644 --- a/lib/AnyRtttl/src/binrtttl.cpp +++ b/lib/AnyRtttl/src/binrtttl.cpp @@ -121,16 +121,16 @@ uint16_t getBpmsCount() return gNoteBpmsCount; } -BPM_INDEX findBpmIndex(RTTTL_BPM n) -{ - for(BPM_INDEX i=0; i