Changed ESP32 tone emulation channel to 1
This commit is contained in:
parent
dbc35c814e
commit
4cdbcb60c5
2 changed files with 7 additions and 7 deletions
|
@ -128,7 +128,10 @@
|
|||
#define RADIOLIB_PROGMEM_READ_BYTE(addr) pgm_read_byte(addr)
|
||||
#define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED
|
||||
#define RADIOLIB_HARDWARE_SERIAL_PORT Serial1
|
||||
|
||||
// ESP32 doesn't support tone(), but it can be emulated via LED control peripheral
|
||||
#define RADIOLIB_TONE_UNSUPPORTED
|
||||
#define RADIOLIB_TONE_ESP32_CHANNEL (1)
|
||||
|
||||
#elif defined(ARDUINO_ARCH_STM32)
|
||||
// official STM32 Arduino core (https://github.com/stm32duino/Arduino_Core_STM32)
|
||||
|
|
|
@ -344,12 +344,9 @@ void Module::tone(RADIOLIB_PIN_TYPE pin, uint16_t value) {
|
|||
::tone(pin, value);
|
||||
#else
|
||||
#if defined(ESP32)
|
||||
// ESP32 - emulate tone() via LED driver on channel 15
|
||||
if(ledcRead(15)) {
|
||||
return;
|
||||
}
|
||||
ledcAttachPin(pin, 15);
|
||||
ledcWriteTone(15, value);
|
||||
// ESP32 tone() emulation
|
||||
ledcAttachPin(pin, RADIOLIB_TONE_ESP32_CHANNEL);
|
||||
ledcWriteTone(RADIOLIB_TONE_ESP32_CHANNEL, value);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -364,7 +361,7 @@ void Module::noTone(RADIOLIB_PIN_TYPE pin) {
|
|||
#else
|
||||
#if defined(ESP32)
|
||||
ledcDetachPin(pin);
|
||||
ledcWrite(15, 0);
|
||||
ledcWrite(RADIOLIB_TONE_ESP32_CHANNEL, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue