Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update api adapt esp core 3.0.0-alpha2 #860

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ArduinoHal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,16 @@ void inline ArduinoHal::tone(uint32_t pin, unsigned int frequency, unsigned long
// ESP32 tone() emulation
(void)duration;
if(prev == -1) {
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
ledcAttachPin(pin, RADIOLIB_TONE_ESP32_CHANNEL);
#endif
}
if(prev != frequency) {
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
ledcWriteTone(RADIOLIB_TONE_ESP32_CHANNEL, frequency);
#else
ledcWriteTone(pin, frequency);
#endif
}
prev = frequency;
#elif defined(RADIOLIB_MBED_TONE_OVERRIDE)
Expand Down Expand Up @@ -178,8 +184,13 @@ void inline ArduinoHal::noTone(uint32_t pin) {
return;
}
// ESP32 tone() emulation
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5,0,0)
ledcDetachPin(pin);
ledcWrite(RADIOLIB_TONE_ESP32_CHANNEL, 0);
#else
ledcDetach(pin);
ledcWrite(pin, 0);
#endif
prev = -1;
#elif defined(RADIOLIB_MBED_TONE_OVERRIDE)
if(pin == RADIOLIB_NC) {
Expand Down
Loading