Merge pull request #169 from brentru/fix-for-esp32-backwards-compat

Add backwards compatibility with ESP32 BSP's stable release
This commit is contained in:
Brent Rubell 2023-10-12 12:23:26 -04:00 committed by GitHub
commit 7f04b63811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 5 deletions

View file

@ -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

View file

@ -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);

View file

@ -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.