diff --git a/cores/esp32/esp32-hal-gpio.c b/cores/esp32/esp32-hal-gpio.c index ceef3bdfa5c..f0f99db9abf 100644 --- a/cores/esp32/esp32-hal-gpio.c +++ b/cores/esp32/esp32-hal-gpio.c @@ -91,9 +91,9 @@ static InterruptHandle_t __pinInterruptHandlers[SOC_GPIO_PIN_COUNT] = {0,}; extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode) { -#ifdef BOARD_HAS_NEOPIXEL - if (pin == LED_BUILTIN){ - __pinMode(LED_BUILTIN-SOC_GPIO_PIN_COUNT, mode); +#ifdef RGB_BUILTIN + if (pin == RGB_BUILTIN){ + __pinMode(RGB_BUILTIN-SOC_GPIO_PIN_COUNT, mode); return; } #endif @@ -134,11 +134,11 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode) extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val) { - #ifdef BOARD_HAS_NEOPIXEL - if(pin == LED_BUILTIN){ + #ifdef RGB_BUILTIN + if(pin == RGB_BUILTIN){ //use RMT to set all channels on/off - const uint8_t comm_val = val != 0 ? LED_BRIGHTNESS : 0; - neopixelWrite(LED_BUILTIN, comm_val, comm_val, comm_val); + const uint8_t comm_val = val != 0 ? RGB_BRIGHTNESS : 0; + neopixelWrite(RGB_BUILTIN, comm_val, comm_val, comm_val); return; } #endif diff --git a/cores/esp32/esp32-hal-rgb-led.c b/cores/esp32/esp32-hal-rgb-led.c index 6776d324d99..61558b86ee6 100644 --- a/cores/esp32/esp32-hal-rgb-led.c +++ b/cores/esp32/esp32-hal-rgb-led.c @@ -7,9 +7,9 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue static bool initialized = false; uint8_t _pin = pin; -#ifdef BOARD_HAS_NEOPIXEL - if(pin == LED_BUILTIN){ - _pin = LED_BUILTIN-SOC_GPIO_PIN_COUNT; +#ifdef RGB_BUILTIN + if(pin == RGB_BUILTIN){ + _pin = RGB_BUILTIN-SOC_GPIO_PIN_COUNT; } #endif diff --git a/cores/esp32/esp32-hal-rgb-led.h b/cores/esp32/esp32-hal-rgb-led.h index e2db0e91046..f3539a22513 100644 --- a/cores/esp32/esp32-hal-rgb-led.h +++ b/cores/esp32/esp32-hal-rgb-led.h @@ -7,8 +7,8 @@ extern "C" { #include "esp32-hal.h" -#ifndef LED_BRIGHTNESS - #define LED_BRIGHTNESS 64 +#ifndef RGB_BRIGHTNESS + #define RGB_BRIGHTNESS 64 #endif void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val); diff --git a/libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino b/libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino index 3c2ed4864c1..3bc0e6a3116 100644 --- a/libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino +++ b/libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino @@ -3,7 +3,7 @@ Demonstrates usage of onboard RGB LED on some ESP dev boards. - Calling digitalWrite(LED_BUILTIN, HIGH) will use hidden RGB driver. + Calling digitalWrite(RGB_BUILTIN, HIGH) will use hidden RGB driver. RGBLedWrite demonstrates controll of each channel: void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) @@ -11,7 +11,7 @@ WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin with normal HIGH/LOW level */ -//#define LED_BRIGHTNESS 64 // Change white brightness (max 255) +//#define RGB_BRIGHTNESS 64 // Change white brightness (max 255) // the setup function runs once when you press reset or power the board @@ -21,19 +21,19 @@ void setup() { // the loop function runs over and over again forever void loop() { -#ifdef BOARD_HAS_NEOPIXEL - digitalWrite(LED_BUILTIN, HIGH); // Turn the RGB LED white +#ifdef RGB_BUILTIN + digitalWrite(RGB_BUILTIN, HIGH); // Turn the RGB LED white delay(1000); - digitalWrite(LED_BUILTIN, LOW); // Turn the RGB LED off + digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off delay(1000); - neopixelWrite(LED_BUILTIN,LED_BRIGHTNESS,0,0); // Red + neopixelWrite(RGB_BUILTIN,RGB_BRIGHTNESS,0,0); // Red delay(1000); - neopixelWrite(LED_BUILTIN,0,LED_BRIGHTNESS,0); // Green + neopixelWrite(RGB_BUILTIN,0,RGB_BRIGHTNESS,0); // Green delay(1000); - neopixelWrite(LED_BUILTIN,0,0,LED_BRIGHTNESS); // Blue + neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue delay(1000); - neopixelWrite(LED_BUILTIN,0,0,0); // Off / black + neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black delay(1000); #endif } diff --git a/variants/esp32c3/pins_arduino.h b/variants/esp32c3/pins_arduino.h index 0fce6340e08..ab28240d4b4 100644 --- a/variants/esp32c3/pins_arduino.h +++ b/variants/esp32c3/pins_arduino.h @@ -11,8 +11,8 @@ static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+8; #define BUILTIN_LED LED_BUILTIN // backward compatibility #define LED_BUILTIN LED_BUILTIN -#define BOARD_HAS_NEOPIXEL -#define LED_BRIGHTNESS 64 +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 #define analogInputToDigitalPin(p) (((p)