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: replace RGBLED_NUM with driver-owned constant to decouple driver from RGBLEDs/RGBMATRIX defines #18036

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

Kriechi
Copy link
Contributor

@Kriechi Kriechi commented Aug 14, 2022

Description

Currently, using ws2812 driver with RGBMATRIX still requires a RGBLED_NUM constant to be defined - which is not documented. Only DRIVER_LED_TOTAL is mentioned - which is currently not sufficient to compile cleanly.

This PR simply checks which defines are available and then defines a new driver-owned constant for the number of ws2812 LEDs to allocate the necessary data structures with the correct size.

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).

drivers/ws2812.h Outdated Show resolved Hide resolved
drivers/ws2812.h Outdated Show resolved Hide resolved
@fauxpark
Copy link
Member

I'm thinking, for consistency, perhaps this define should be named WS2812_LED_COUNT.

@Kriechi
Copy link
Contributor Author

Kriechi commented Sep 23, 2022

Thanks - changed to WS2812_LED_COUNT!

drivers/ws2812.h Outdated Show resolved Hide resolved
@tzarc tzarc merged commit c4f99f0 into qmk:develop Oct 20, 2022
@Kriechi Kriechi deleted the ws2812-rgbled-num branch October 20, 2022 21:28
ramonimbao pushed a commit to ramonimbao/qmk_firmware that referenced this pull request Nov 28, 2022
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.

None yet

4 participants