[HAL] Added check for defined ESP version macro (#860)
This commit is contained in:
parent
039fa0fc59
commit
912333c408
1 changed files with 8 additions and 8 deletions
|
@ -145,12 +145,12 @@ void inline ArduinoHal::tone(uint32_t pin, unsigned int frequency, unsigned long
|
||||||
// ESP32 tone() emulation
|
// ESP32 tone() emulation
|
||||||
(void)duration;
|
(void)duration;
|
||||||
if(prev == -1) {
|
if(prev == -1) {
|
||||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
|
#if !defined(ESP_IDF_VERSION) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0))
|
||||||
ledcAttachPin(pin, RADIOLIB_TONE_ESP32_CHANNEL);
|
ledcAttachPin(pin, RADIOLIB_TONE_ESP32_CHANNEL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(prev != frequency) {
|
if(prev != frequency) {
|
||||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
|
#if !defined(ESP_IDF_VERSION) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0))
|
||||||
ledcWriteTone(RADIOLIB_TONE_ESP32_CHANNEL, frequency);
|
ledcWriteTone(RADIOLIB_TONE_ESP32_CHANNEL, frequency);
|
||||||
#else
|
#else
|
||||||
ledcWriteTone(pin, frequency);
|
ledcWriteTone(pin, frequency);
|
||||||
|
@ -184,7 +184,7 @@ void inline ArduinoHal::noTone(uint32_t pin) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// ESP32 tone() emulation
|
// ESP32 tone() emulation
|
||||||
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
|
#if !defined(ESP_IDF_VERSION) || (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0))
|
||||||
ledcDetachPin(pin);
|
ledcDetachPin(pin);
|
||||||
ledcWrite(RADIOLIB_TONE_ESP32_CHANNEL, 0);
|
ledcWrite(RADIOLIB_TONE_ESP32_CHANNEL, 0);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Reference in a new issue