Peripheral: LED: Add pulsing LED API #84468
Replies: 3 comments 1 reply
-
Hello @MetaGlennA, Thanks for starting this discussion. Do you own a LED controller with a pulse capability you need to take advantage of ? For me the question is: is the kernel the right place to implement software LED effects ? So far, my opinion is no. I think that sotfware LED effects should go in a user module/library/layer on the top of the kernel API. And the kernel API should be limited to expose the hardware capabilities to userland. So the relevance of a pulse API depends on the availability of a such feature on LED controllers. About the API proposal itself, it could be interesting to split the On my side I am using the following definitions for a breathing/pulse LED effect:
|
Beta Was this translation helpful? Give feedback.
-
This is a proposal to modify the Zephyr LED interface for multi-channel ‘breathing’ LED drivers.
A breathing LED driver may have the following parameters per channel:
The current LED API only has a square-wave On-Time and Off-Time for the
led_blink()
function.The
led_blink()
function also does not support synchronizing the start of blinking on a multi-channel device.I propose an
led_pulse()
function to handle multi-channel breathing LEDs.The function signature would be:
The parameters argument takes a pointer to an array of
struct led_pulse_parameter
objects with the following members:The number of items in the array is the same as the number of channels on the device.
If a channel is to be set to always on or always off rather than pulsing this can be accomplished through the
led_pulse()
command as well:on_time_ms
off_time_ms
The API already has a brightness command, so having it in the
led_pulse_parameter
struct is open to debate.Beta Was this translation helpful? Give feedback.
All reactions