ws2812: add vcc enable pin support#26215
Open
damex wants to merge 1 commit into
Open
Conversation
Author
|
i have decided to make it a list of pins that is driven together. please let me know if we should decouple that list to have separate named pins |
opt in mechanism for boards that gate the WS2812 chain
vcc rail through one or more gpio.
ws2812 draw ~1ma each even when displaying black
long chains dominate standby drain on battery powered keyboards.
configured via ws2812.vcc_enable_pins (array)
and ws2812.vcc_active_low (bool) in keyboard.json.
drivers/led/ws2812.{c,h}: new ws2812_set_power(bool on),
compiled only when WS2812_VCC_ENABLE_PINS is defined.
polarity from WS2812_VCC_ACTIVE_LOW.
pins driven together in lockstep.
The driver dedupes consecutive identical calls and lazily flips
pins to output (write-then-set-output to avoid an active-low
glitch on the first call).
quantum/rgb_matrix/rgb_matrix_drivers.{c,h} and
quantum/rgblight/rgblight_drivers.{c,h}:
optional set_power vtable entry. ws2812 driver wires it only
when WS2812_VCC_ENABLE_PINS is defined; other drivers and
unconfigured ws2812 builds leave NULL. callers branch on
set_power != NULL so unconfigured boards keep their existing
render-zero-and-flush behavior.
quantum/rgb_matrix/rgb_matrix.c: drive set_power from
rgb_task_start with the composite enable state - user toggle,
usb suspend (via rgb_matrix_set_suspend_state), idle timeout.
gate path runs independently of RGB_MATRIX_SLEEP.
quantum/rgblight/rgblight.c: drive set_power from
rgblight_init, the rgblight_enable variants, and rgblight_set
(which also catches the rgblight_disable variants via the
enable=false branch). rgblight_suspend and rgblight_wakeup
compile unconditionally; they take the gate path when set_power
is wired and otherwise fall back to the legacy RGBLIGHT_SLEEP
code or early-return.
quantum/quantum.c: drop RGBLIGHT_SLEEP from the suspend
and wakeup guards so gate-only boards receive the hooks.
matches the existing rgb_matrix_set_suspend_state call pattern.
data/schemas/keyboard.jsonschema and
data/mappings/info_config.hjson:
schema entries and macro mappings for the two new fields.
docs/drivers/ws2812.md: new "VCC Enable Pin" section.
Signed-off-by: Roman Kuzmitskii <roman@damex.org>
16e58b9 to
636f2ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
opt in mechanism for boards that gate the WS2812 chain vcc rail through one or more gpio.
ws2812 draw ~1ma each even when displaying black
long chains dominate standby drain on battery powered keyboards. configured via ws2812.vcc_enable_pins (array)
and ws2812.vcc_active_low (bool) in keyboard.json.
drivers/led/ws2812.{c,h}: new ws2812_set_power(bool on), compiled only when WS2812_VCC_ENABLE_PINS is defined. polarity from WS2812_VCC_ACTIVE_LOW.
pins driven together in lockstep.
The driver dedupes consecutive identical calls and lazily flips pins to output (write-then-set-output to avoid an active-low glitch on the first call).
quantum/rgb_matrix/rgb_matrix_drivers.{c,h} and
quantum/rgblight/rgblight_drivers.{c,h}:
optional set_power vtable entry. ws2812 driver wires it only when WS2812_VCC_ENABLE_PINS is defined; other drivers and unconfigured ws2812 builds leave NULL. callers branch on set_power != NULL so unconfigured boards keep their existing render-zero-and-flush behavior.
quantum/rgb_matrix/rgb_matrix.c: drive set_power from rgb_task_start with the composite enable state - user toggle, usb suspend (via rgb_matrix_set_suspend_state), idle timeout. gate path runs independently of RGB_MATRIX_SLEEP.
quantum/rgblight/rgblight.c: drive set_power from
rgblight_init, the rgblight_enable variants, and rgblight_set (which also catches the rgblight_disable variants via the enable=false branch). rgblight_suspend and rgblight_wakeup compile unconditionally; they take the gate path when set_power is wired and otherwise fall back to the legacy RGBLIGHT_SLEEP code or early-return.
quantum/quantum.c: drop RGBLIGHT_SLEEP from the suspend and wakeup guards so gate-only boards receive the hooks. matches the existing rgb_matrix_set_suspend_state call pattern.
data/schemas/keyboard.jsonschema and
data/mappings/info_config.hjson:
schema entries and macro mappings for the two new fields.
docs/drivers/ws2812.md: new "VCC Enable Pin" section.
Types of Changes
Issues Fixed or Closed by This PR
Checklist