Skip to content

Commit 99e68a0

Browse files
SuGliderlucasssvazpre-commit-ci-lite[bot]
authored
Change "neopixel" references to use RGB LED naming (#10225)
* fix(rgbled): fixes core rgbledWrite() * fix(rgbled): fixes examples - rgbledWrite() * fix(rgbled): fixes variants commetaries - rgbledWrite() * fix(rgbled): examples and doc - use RGB_LED naming * fix(rgbled): variants - use RGB_LED naming * fix(rgbled): other places for RGB LED naming * fix(typo): cores - rgbLed instead of rgbled * fix(typo): examples - rgbLed instead of rgbled * fix(typo): variants commentaties - rgbLed instead of rgbled * fix(rgbled): bad file name * fix(typo): typo and commentaries Co-authored-by: Lucas Saavedra Vaz <[email protected]> * fix(rgbled): deprecating neopixelWrite() * fix(rgbled): use RGB LED naming * fix(rgbled): document formatting * fix(rgbled): neopixelWrite() is now deprecated * fix(rgbled): removed attribute in wrong place * just a git push test * restart git bash test * ci(pre-commit): Apply automatic fixes * removed wrong test file * fix(rgbled): new Arduino style depreacted attribute --------- Co-authored-by: Lucas Saavedra Vaz <[email protected]> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 0539ebf commit 99e68a0

File tree

74 files changed

+176
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+176
-169
lines changed

cores/esp32/esp32-hal-gpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
166166
//use RMT to set all channels on/off
167167
RGB_BUILTIN_storage = val;
168168
const uint8_t comm_val = val != 0 ? RGB_BRIGHTNESS : 0;
169-
neopixelWrite(RGB_BUILTIN, comm_val, comm_val, comm_val);
169+
rgbLedWrite(RGB_BUILTIN, comm_val, comm_val, comm_val);
170170
return;
171171
}
172172
#endif // RGB_BUILTIN

cores/esp32/esp32-hal-rgb-led.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616

1717
#include "esp32-hal-rgb-led.h"
1818

19+
// Backward compatibility - Deprecated. It will be removed in future releases.
20+
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
21+
log_w("neopixelWrite() is deprecated. Use rgbLedWrite().");
22+
rgbLedWrite(pin, red_val, green_val, blue_val);
23+
}
24+
1925
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
2026
rgbLedWriteOrdered(pin, RGB_BUILTIN_LED_COLOR_ORDER, red_val, green_val, blue_val);
2127
}

cores/esp32/esp32-hal-rgb-led.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ void rgbLedWriteOrdered(uint8_t pin, rgb_led_color_order_t order, uint8_t red_va
2929
// Will use RGB_BUILTIN_LED_COLOR_ORDER
3030
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
3131

32-
// Backward compatibility
33-
#define neopixelWrite(p, r, g, b) rgbLedWrite(p, r, g, b)
32+
// Backward compatibility - Deprecated. It will be removed in future releases.
33+
[[deprecated("Use rgbLedWrite() instead.")]]
34+
void neopixelWrite(uint8_t p, uint8_t r, uint8_t g, uint8_t b);
3435

3536
#ifdef __cplusplus
3637
}

cores/esp32/io_pin_remap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ int8_t gpioNumberToDigitalPin(int8_t gpioNumber);
7777
#define pinMatrixOutDetach(pin, invertOut, invertEnable) pinMatrixOutDetach(digitalPinToGPIONumber(pin), invertOut, invertEnable)
7878

7979
// cores/esp32/esp32-hal-rgb-led.h
80-
#define neopixelWrite(pin, red_val, green_val, blue_val) neopixelWrite(digitalPinToGPIONumber(pin), red_val, green_val, blue_val)
80+
#define rgbLedWrite(pin, red_val, green_val, blue_val) rgbLedWrite(digitalPinToGPIONumber(pin), red_val, green_val, blue_val)
8181

8282
// cores/esp32/esp32-hal-rmt.h
8383
#define rmtInit(pin, channel_direction, memsize, frequency_Hz) rmtInit(digitalPinToGPIONumber(pin), channel_direction, memsize, frequency_Hz)

docs/en/api/rmt.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Example
1414

1515
To get started with RMT, you can try:
1616

17-
RMT Write Neo Pixel
18-
*******************
17+
RMT Write RGB LED
18+
*****************
1919

20-
.. literalinclude:: ../../../libraries/ESP32/examples/RMT/RMTWriteNeoPixel/RMTWriteNeoPixel.ino
20+
.. literalinclude:: ../../../libraries/ESP32/examples/RMT/RMTWrite_RGB_LED/RMTWrite_RGB_LED.ino
2121
:language: arduino
2222

2323

libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Calling digitalWrite(RGB_BUILTIN, HIGH) will use hidden RGB driver.
77
88
RGBLedWrite demonstrates control of each channel:
9-
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
9+
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
1010
1111
WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin
1212
with normal HIGH/LOW level
@@ -27,13 +27,13 @@ void loop() {
2727
digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off
2828
delay(1000);
2929

30-
neopixelWrite(RGB_BUILTIN, RGB_BRIGHTNESS, 0, 0); // Red
30+
rgbLedWrite(RGB_BUILTIN, RGB_BRIGHTNESS, 0, 0); // Red
3131
delay(1000);
32-
neopixelWrite(RGB_BUILTIN, 0, RGB_BRIGHTNESS, 0); // Green
32+
rgbLedWrite(RGB_BUILTIN, 0, RGB_BRIGHTNESS, 0); // Green
3333
delay(1000);
34-
neopixelWrite(RGB_BUILTIN, 0, 0, RGB_BRIGHTNESS); // Blue
34+
rgbLedWrite(RGB_BUILTIN, 0, 0, RGB_BRIGHTNESS); // Blue
3535
delay(1000);
36-
neopixelWrite(RGB_BUILTIN, 0, 0, 0); // Off / black
36+
rgbLedWrite(RGB_BUILTIN, 0, 0, 0); // Off / black
3737
delay(1000);
3838
#endif
3939
}

libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/Legacy_RMT_Driver_Compatible.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#else
1818

1919
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NO_RGB_BUILTIN" to use the RMT Legacy driver
20-
// neoPixelWrite() is a function that writes to the RGB LED and it won't be available here
20+
// rgbLedWrite() is a function that writes to the RGB LED and it won't be available here
2121
#include "driver/rmt.h"
2222

2323
bool installed = false;

libraries/ESP32/examples/RMT/RMTWriteNeoPixel/RMTWriteNeoPixel.ino renamed to libraries/ESP32/examples/RMT/RMTWrite_RGB_LED/RMTWrite_RGB_LED.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Espressif Systems (Shanghai) PTE LTD
1+
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -20,17 +20,17 @@
2020
*/
2121

2222
// The effect seen in (Espressif devkits) ESP32C6, ESP32H2, ESP32C3, ESP32S2 and ESP32S3 is like a Blink of RGB LED
23-
#ifdef PIN_NEOPIXEL
24-
#define BUILTIN_RGBLED_PIN PIN_NEOPIXEL
23+
#ifdef PIN_LED_RGB
24+
#define BUILTIN_RGBLED_PIN PIN_LED_RGB
2525
#else
26-
#define BUILTIN_RGBLED_PIN 21 // ESP32 has no builtin RGB LED (PIN_NEOPIXEL)
26+
#define BUILTIN_RGBLED_PIN 21 // ESP32 has no builtin RGB LED (PIN_LED_RGB)
2727
#endif
2828

2929
#define NR_OF_LEDS 8 * 4
3030
#define NR_OF_ALL_BITS 24 * NR_OF_LEDS
3131

3232
//
33-
// Note: This example uses Neopixel LED board, 32 LEDs chained one
33+
// Note: This example uses a board with 32 WS2812b LEDs chained one
3434
// after another, each RGB LED has its 24 bit value
3535
// for color configuration (8b for each color)
3636
//

libraries/ESP32/examples/RMT/RMT_CPUFreq_Test/RMT_CPUFreq_Test.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* that RMT works on any CPU/APB Frequency.
1818
*
1919
* It uses an ESP32 Arduino builtin RGB NeoLED function based on RMT:
20-
* void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
20+
* void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
2121
*
2222
* The output is a visual WS2812 RGB LED color change routine using each time a
2323
* different CPU Frequency, just to illustrate how it works. Serial output indicates
@@ -26,10 +26,10 @@
2626

2727
// Default DevKit RGB LED GPIOs:
2828
// The effect seen in (Espressif devkits) ESP32C6, ESP32H2, ESP32C3, ESP32S2 and ESP32S3 is like a Blink of RGB LED
29-
#ifdef PIN_NEOPIXEL
30-
#define MY_LED_GPIO PIN_NEOPIXEL
29+
#ifdef PIN_RGB_LED
30+
#define MY_LED_GPIO PIN_RGB_LED
3131
#else
32-
#define MY_LED_GPIO 21 // ESP32 has no builtin RGB LED (PIN_NEOPIXEL)
32+
#define MY_LED_GPIO 21 // ESP32 has no builtin RGB LED (PIN_RGB_LED)
3333
#endif
3434

3535
// Set the correct GPIO to any necessary by changing RGB_LED_GPIO value
@@ -65,22 +65,22 @@ void loop() {
6565
Serial.updateBaudRate(115200);
6666
Serial.printf("\n--changed CPU Frequency to %lu MHz\n", getCpuFrequencyMhz());
6767

68-
neopixelWrite(RGB_LED_GPIO, BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); // White
68+
rgbLedWrite(RGB_LED_GPIO, BRIGHTNESS, BRIGHTNESS, BRIGHTNESS); // White
6969
Serial.println("White");
7070
delay(1000);
71-
neopixelWrite(RGB_LED_GPIO, 0, 0, 0); // Off
71+
rgbLedWrite(RGB_LED_GPIO, 0, 0, 0); // Off
7272
Serial.println("Off");
7373
delay(1000);
74-
neopixelWrite(RGB_LED_GPIO, BRIGHTNESS, 0, 0); // Red
74+
rgbLedWrite(RGB_LED_GPIO, BRIGHTNESS, 0, 0); // Red
7575
Serial.println("Red");
7676
delay(1000);
77-
neopixelWrite(RGB_LED_GPIO, 0, BRIGHTNESS, 0); // Green
77+
rgbLedWrite(RGB_LED_GPIO, 0, BRIGHTNESS, 0); // Green
7878
Serial.println("Green");
7979
delay(1000);
80-
neopixelWrite(RGB_LED_GPIO, 0, 0, BRIGHTNESS); // Blue
80+
rgbLedWrite(RGB_LED_GPIO, 0, 0, BRIGHTNESS); // Blue
8181
Serial.println("Blue");
8282
delay(1000);
83-
neopixelWrite(RGB_LED_GPIO, 0, 0, 0); // Off
83+
rgbLedWrite(RGB_LED_GPIO, 0, 0, 0); // Off
8484
Serial.println("Off");
8585
delay(1000);
8686
}

libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Currently, this example supports the following targets.
2020
### Configure the Project
2121

2222
Set the LED GPIO by changing the `LED_PIN` definition. By default, the LED_PIN is `RGB_BUILTIN`.
23-
By default, the `neoPixelWrite` function is used to control the LED. You can change it to digitalWrite to control a simple LED.
23+
By default, the `rgbLedWrite` function is used to control the LED. You can change it to digitalWrite to control a simple LED.
2424

2525
#### Using Arduino IDE
2626

0 commit comments

Comments
 (0)