mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[LIB] AnyRtttl cherry-picked latest updates, disable unused function that causes a compiler warning
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -121,16 +121,16 @@ uint16_t getBpmsCount()
|
||||
return gNoteBpmsCount;
|
||||
}
|
||||
|
||||
BPM_INDEX findBpmIndex(RTTTL_BPM n)
|
||||
{
|
||||
for(BPM_INDEX i=0; i<gNoteBpmsCount; i++)
|
||||
{
|
||||
if (getBpmFromIndex(i) == n)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return INVALID_BPM_INDEX;
|
||||
}
|
||||
// BPM_INDEX findBpmIndex(RTTTL_BPM n)
|
||||
// {
|
||||
// for(BPM_INDEX i=0; i<gNoteBpmsCount; i++)
|
||||
// {
|
||||
// if (getBpmFromIndex(i) == n)
|
||||
// {
|
||||
// return i;
|
||||
// }
|
||||
// }
|
||||
// return INVALID_BPM_INDEX;
|
||||
// }
|
||||
|
||||
}; //anyrtttl namespace
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef unsigned char BPM_INDEX;
|
||||
// static DURATION_INDEX INVALID_DURATION_INDEX = (DURATION_INDEX)-1;
|
||||
// static NOTE_LETTER_INDEX INVALID_NOTE_LETTER_INDEX = (NOTE_LETTER_INDEX)-1;
|
||||
// static OCTAVE_INDEX INVALID_OCTAVE_INDEX = (OCTAVE_INDEX)-1;
|
||||
static BPM_INDEX INVALID_BPM_INDEX = (BPM_INDEX)-1;
|
||||
// static BPM_INDEX INVALID_BPM_INDEX = (BPM_INDEX)-1;
|
||||
|
||||
typedef unsigned short RTTTL_DURATION;
|
||||
typedef char RTTTL_NOTE_LETTER;
|
||||
@@ -100,7 +100,7 @@ OCTAVE_INDEX findNoteOctaveIndex(RTTTL_OCTAVE_VALUE n);
|
||||
//allowed values: 25, 28, 31, 35, 40, 45, 50, 56, 63, 70, 80, 90, 100, 112, 125, 140, 160, 180, 200, 225, 250, 285, 320, 355, 400, 450, 500, 565, 635, 715, 800 and 900.
|
||||
RTTTL_BPM getBpmFromIndex(BPM_INDEX iIndex);
|
||||
uint16_t getBpmsCount();
|
||||
BPM_INDEX findBpmIndex(RTTTL_BPM n);
|
||||
// BPM_INDEX findBpmIndex(RTTTL_BPM n); // tonhuisman: Disabled as we don't use this, and we can avoid a compilation warning
|
||||
|
||||
}; //anyrtttl namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user