-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Improve RGB driver in pull #6808; solves #6968 #6979
Conversation
Replaces the use of the `LED_BUILTIN` variable by creating a new variable called `RGB_BUILTIN`. On boards with both a regular LED and RGB LED, this change provides functionality to control either LED. The `LED_BRIGHTNESS` variable is changed to `RGB_BRIGHTNESS`, which aligns more closely with the `RGB_BUILTIN` variable name. `BOARD_HAS_NEOPIXEL` is no longer necessary; it is replaced by `RGB_BUILTIN`.
Update example code for changes with the RGB driver: - Replace `LED_BUILTIN` and `BOARD_HAS_NEOPIXEL` with `RGB_BUILTIN` - Replace `LED_BRIGHTNESS` with `RGB_BRIGHTNESS`
Update board variants for changes with the RGB driver: - Remove `BOARD_HAS_NEOPIXEL` - Define `RGB_BUILTIN` pin - Replace `LED_BRIGHTNESS` with `RGB_BRIGHTNESS` to align with `RGB_BUILTIN` name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks great, tested on S2 Kaluga and C3.
@P-R-O-C-H-Y tested on S3
I have mixed feelings about this PR... It looks like it just changes the name of the symbols.
It actually replaces, it doesn't add anything. |
It is related to #6968 where it stated that some boards with both normal LED and RGB LED can use only the RGB. This PR will enable use both |
@SuGlider Yes, from the initial commit, it may seem like I have only replaced variable names. However, my pull request allows boards with a both a regular LED and RGB LED to be controlled with the
I caught this issue with our board that we were about to submit a pull request for. Our board has both types of LEDs and the regular LED is already silked with
My changes basically have users define the current
As you can see, the primary change is in (1), where the |
@PilnyTomas Haha, you beat me to it |
Thanks @santaimpersonator @PilnyTomas for the clarification. it just makes me wonder that maybe we may need to review all the variants and their |
@SuGlider Awesome! Thanks for the approval. NOTE: For reviewing the variant files:
|
Please see PR #7015 |
* Added support for Cytron Maker Feather AIoT S3. * 1. Select OPI PSRAM by default. 2. Fixed pin name error in variant.cpp. 3. Added definition for RGB_BUILTIN. * Define the RGB_BUILTIN as shown in #6979. * Added pin definition for A12 (Vin Sense).
Description of Change
This solution adds a
RGB_BUILTIN
variable to pull request #6808. With the original solution (#6808), users were limited to controlling a single built-in LED. By creating a new variableRGB_BUILTIN
, users are able to control a regular LED and RGB LED with thedigitalWrite()
function, separately from each other.LED_BUILTIN
variable for the RGB LEDBOARD_HAS_NEOPIXEL
LED_BRIGHTNESS
to match new variable nameRGB_BRIGHTNESS
For boards that have a regular LED and RGB LED on their board, users can define the pin configuration (below) and the
Blink.ino
andBlinkRGB.ino
example sketches would operate on the regular and RGB LEDs separately.Tests scenarios
I have tested the proposed changes with the regular
Blink.ino
and the ESP32>GPIO>BlinkRGB.ino
example sketches. These tests were performed on an ESP32-WROOM board with a regular LED and RGB LED. The sketches were also tested for the following pin configurations:Blink.ino
only controls regular LEDBlinkRGB.ino
only controls the RGB LEDBlink.ino
andBlinkRGB.ino
both control the RGB LEDBlink.ino
works with the regular LEDRelated links
Closes #6968
*Based on original pull request (#6808) and issue (#6783)