new Core 3.x API: combine setup + attach#14
Conversation
|
this fix #13 |
In Arduino-ESP32 Core 3.x, the ledcSetup(...) and ledcAttachPin(...) APIs were removed and replaced by a new ledcAttach(...) API that merges setup + attach.
end2endzone
left a comment
There was a problem hiding this comment.
Thank you for this contribution!
|
@ryanhz Hi. How did you come up about macro If I compile the following code on esp32:esp32: #if defined(ESP32)
#if ARDUINO_ESP32_MAJOR >= 3
aaa
#elif ARDUINO_ESP32_MAJOR >= 2
bbb
#elif ARDUINO_ESP32_MAJOR >= 1
ccc
#else
yyy
#endif
#endifthe compilation fails with The macro I've installed the esp32 core 3.3.1. Please advise. |
|
@ryanhz #if !defined(ARDUINO_ESP32_MAJOR)
it_is_undefined
#endiffails with Are you using a custom framework for compiling your esp32 projects ? The appropriate way seems to be with the following: #if defined(ESP32)
#ifdef ESP_ARDUINO_VERSION
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
// Code specific to ESP32 core 3.x
q111
#elif ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0)
// Code specific to ESP32 core 2.x
q222
#else
#error ESP32 arduino version unsupported
#endif
#else
// Fallback for older versions (pre-2.x)
#error ESP32 arduino version unsupported
#endif
#endifwhich fails as expected with Reference: arduino-esp32's Compatibility Guide for ESP32 Arduino Core. |
|
@end2endzone Sorry, the macro should be So eventually, I rewrote the whole file at the help of GPT (this commit in my fork), which is working in Core 3.x as I tested, but I haven't test back on core.x. Do you want to to create another pull request? |
ledcSetup and ledcAttachPin have been removed and merged into ledcAttach new API in ESP32 Core 3.x API