-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
caf: modules: leds: fix support GPIO-based LED devicetree definitions #19703
Conversation
Thank you for your contribution! Note: This comment is automatically posted and updated by the Contribs GitHub Action. |
When CONFIG_CAF_LEDS_GPIO was chosen over CONFIG_CAF_LEDS_PWM, an assertion fails that checks whether a gpio-leds compatible node has either 1 or 3 child nodes to define multi-color LEDs. However, most Nordic development boards have 4 leds, which the CAF leds module does not support and hence breaks these builds. This commit adds support for up to a combination of 4 leds in what could be analogous to an RGBW LED. The changes are made as such that as little application code as possible is affected by the change. If user code wants to take full advantage of the full channel color support it will have to redefine the OFF, ON, ON_GO_OFF, BLINK, BLINK2, BREATH, and CLOCK effects since LED_NOCOLOR is only defined for 3 channels. Signed-off-by: Jelle De Vleeschouwer <jelle.devleeschouwer@classified-cycling.cc>
9cd1a9b
to
3f29b30
Compare
CC: @MarekPieta, @nordicjm, @tejlmand, @pdunaj |
Hi @jelledevleeschouwer, Thanks for the contribution. The CAF LEDs module documentation states that:
Controlling 4 monochromatic LEDs as a single RGBW LED is not consistent with the described assumptions. It would also be problematic if the monochromatic LEDs are controlled by multiple modules - for example if module A controls the first LED and module B controls the second LED for another purpose. Every module controlling any of the monochromatic LEDs would need to know what colors/effects are set to all 4 monochromatic LEDs to submit a proper LED event, because a LED event updates all color channels of a given logical LED (https://docs.nordicsemi.com/bundle/ncs-2.7.99-cs1/page/nrf/libraries/caf/caf_overview.html#c.led_event). Would this approach be acceptable for your use-case? |
When CONFIG_CAF_LEDS_GPIO was chosen over CONFIG_CAF_LEDS_PWM, an assertion fails that checks whether a gpio-leds compatible node has either 1 or 3 child nodes to define multi-color LEDs. However, most Nordic development boards have 4 leds, which the CAF leds module does not support and hence breaks these builds. This commit adds support for up to a combination of 4 leds in what could be analogous to an RGBW LED. The changes are made as such that as little application code as possible is affected by the change. If user code wants to take full advantage of the full channel color support it will have to redefine the OFF, ON, ON_GO_OFF, BLINK, BLINK2, BREATH, and CLOCK effects since LED_NOCOLOR is only defined for 3 channels.