Skip to content

Add backwards compatibility with ESP32 BSP's stable release #169

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

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ void setup() {

// set up led pin as an analog output
#if defined(ARDUINO_ARCH_ESP32)
ledcAttach(LED_PIN, 12000, 8); // 12 kHz PWM, 8-bit resolution
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1)
// New ESP32 LEDC API
ledcAttach(LED_PIN, 12000, 8); // 12 kHz PWM, 8-bit resolution
#else
// Legacy ESP32 LEDC API
ledcAttachPin(LED_PIN, 1);
ledcSetup(1, 1200, 8);
#endif
#else
pinMode(LED_PIN, OUTPUT);
#endif
Expand Down
17 changes: 14 additions & 3 deletions examples/adafruitio_13_rgb/adafruitio_13_rgb.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@ void setup() {


#if defined(ARDUINO_ARCH_ESP32) // ESP32 pinMode
ledcAttach(RED_PIN, 12000, 8); // 12 kHz PWM, 8-bit resolution
ledcAttach(GREEN_PIN, 12000, 8);
ledcAttach(BLUE_PIN, 12000, 8);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 1)
// New ESP32 LEDC API
ledcAttach(RED_PIN, 12000, 8); // 12 kHz PWM, 8-bit resolution
ledcAttach(GREEN_PIN, 12000, 8);
ledcAttach(BLUE_PIN, 12000, 8);
#else
// Legacy ESP32 LEDC API
ledcAttachPin(RED_PIN, 1);
ledcAttachPin(GREEN_PIN, 2);
ledcAttachPin(BLUE_PIN, 3);
ledcSetup(1, 12000, 8);
ledcSetup(2, 12000, 8);
ledcSetup(3, 12000, 8);
#endif
#else
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit IO Arduino
version=4.2.8
version=4.2.9
author=Adafruit
maintainer=Adafruit <adafruitio@adafruit.com>
sentence=Arduino library to access Adafruit IO.
Expand Down