Skip to content
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

WS2812 API rework #24364

Merged
merged 35 commits into from
Oct 6, 2024
Merged

WS2812 API rework #24364

merged 35 commits into from
Oct 6, 2024

Conversation

fauxpark
Copy link
Member

@fauxpark fauxpark commented Sep 5, 2024

Description

Some pretty huge changes to the WS2812 API in order to clean a few things up, in particular extrication of the WS2812-specific byte ordering from rgb_led_t.

The ws2812_setleds() API has been replaced with the more RGB Matrix-style init/set_color/set_color_all/flush system, with a new type ws2812_led_t and array of such in each driver to hold the pixel data. The init function has already been implemented, so not much to do there. set_color() and set_color_all() simply assign the RGB components to the given index(es) in the array. flush() mostly contains the existing setleds() functionality, but no longer takes the LED array and LED count as arguments.

Since this is a WIP, a bunch of things will now be broken:

  • The LED index adjustment for split boards in rgb_matrix_drivers.c has been removed for the moment, so split WS2812 likely no longer works
  • RGBLight (Underglow) has not been touched yet, this code won't compile as it relies on the old API

Testing progress (RGB Matrix):

Driver Channels Arch Board Status
Bitbang RGB AVR Pro Micro ✔️
Bitbang RGBW AVR Pro Micro ✔️
I2C RGB AVR JJ4x4 ✔️
Bitbang RGB ARM Proton-C ✔️
Bitbang RGBW ARM Proton-C ✔️
PIO RGB ARM RP2040 Pico ✔️
PIO RGBW ARM RP2040 Pico ✔️
PWM RGB ARM Proton-C ✔️
PWM RGBW ARM Proton-C ✔️
SPI RGB ARM Proton-C ✔️
SPI RGBW ARM Proton-C ✔️

Testing progress (RGBLight):

  • Animations ✔️
  • Index Remapping ✔️
  • Lighting Layers ✔️
  • Clipping Ranges ✔️
  • Split ✔️
  • Velocikey ✔️

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@fauxpark fauxpark requested a review from a team September 5, 2024 06:45
@fauxpark fauxpark marked this pull request as draft September 5, 2024 06:45
@fauxpark fauxpark mentioned this pull request Sep 5, 2024
14 tasks
@fauxpark
Copy link
Member Author

@daskygit Could you please test the Steelseries driver changes? And in future, avoid including quantum.h where it is not directly required.

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
@fauxpark fauxpark marked this pull request as ready for review September 21, 2024 22:02
@fauxpark fauxpark changed the title [WIP] WS2812 API rework WS2812 API rework Sep 21, 2024
@tzarc tzarc merged commit 208ebf5 into qmk:develop Oct 6, 2024
5 of 6 checks passed
@fauxpark fauxpark deleted the ws2812-api-rework branch October 9, 2024 06:04
ilham-agustiawan pushed a commit to ilham-agustiawan/qmk_firmware that referenced this pull request Nov 30, 2024
* Begin WS2812 API rework

* Move RGBW conversion, clean up color.h, fix RGBW for AVR bitbang

* Formatting & update PS2AVRGB I2C driver (untested)

* Tested ARM bitbang RGB+RGBW

* Tested ARM SPI RGB - RGBW not working

* Tested ARM PWM RGB+RGBW

* Tested RP2040 PIO driver RGB+RGBW

* Update RGBLight

* Formatting

* Fix BM60HSRGB rev2

* Fix oddforge/vea

* Fix 1k and XD002 RGBLite

* Fix model_m/mschwingen

* Fix handwired/promethium

* Rename `WS2812_LED_TOTAL` for BM60HSRGB

* Fix work_louder boards

* Fix dawn60

* Fix rgbkb/pan

* Fix neson_design/700e and n6

* Fix ergodox_ez/shine

* ergodox_ez/shine: invert indices for left half

* Fix matrix/abelx

* Fix matrix/m20add

* Remove custom rgblight driver for matrix/noah - should be done with lighting layers

* Fix LED indexes for RGBLight split

* Rename `convert_rgb_to_rgbw()` to `ws2812_rgb_to_rgbw()`

* Update WS2812 API docs

* `ergodox_ez/shine`: simplify LED index calculation

* LED/RGB Matrix: Add weak function for LED index resolution

* Bandaid fix for RGB Matrix splits not using WS2812

* `steelseries/prime_plus`: redo custom RGBLight driver

* Update keyboards/steelseries/prime_plus/rgblight_custom.c

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>

---------

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
smallketchup82 pushed a commit to smallketchup82/qmk_firmware that referenced this pull request Dec 1, 2024
* Begin WS2812 API rework

* Move RGBW conversion, clean up color.h, fix RGBW for AVR bitbang

* Formatting & update PS2AVRGB I2C driver (untested)

* Tested ARM bitbang RGB+RGBW

* Tested ARM SPI RGB - RGBW not working

* Tested ARM PWM RGB+RGBW

* Tested RP2040 PIO driver RGB+RGBW

* Update RGBLight

* Formatting

* Fix BM60HSRGB rev2

* Fix oddforge/vea

* Fix 1k and XD002 RGBLite

* Fix model_m/mschwingen

* Fix handwired/promethium

* Rename `WS2812_LED_TOTAL` for BM60HSRGB

* Fix work_louder boards

* Fix dawn60

* Fix rgbkb/pan

* Fix neson_design/700e and n6

* Fix ergodox_ez/shine

* ergodox_ez/shine: invert indices for left half

* Fix matrix/abelx

* Fix matrix/m20add

* Remove custom rgblight driver for matrix/noah - should be done with lighting layers

* Fix LED indexes for RGBLight split

* Rename `convert_rgb_to_rgbw()` to `ws2812_rgb_to_rgbw()`

* Update WS2812 API docs

* `ergodox_ez/shine`: simplify LED index calculation

* LED/RGB Matrix: Add weak function for LED index resolution

* Bandaid fix for RGB Matrix splits not using WS2812

* `steelseries/prime_plus`: redo custom RGBLight driver

* Update keyboards/steelseries/prime_plus/rgblight_custom.c

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>

---------

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants