Implementing missing BlinkM LED features
The BlinkM LED is a programmable full-color RGB LED with use cases including industrial design, hobbyist projects, automotive lighting, and wearables. The device is programmable in that specific commands can be send over I2C, including scripts, for more complicated lighting effects. The datasheet can be found here: https://static1.squarespace.com/static/5c155684f407b4100552994c/t/5c2d20ca0e2e7292108eadf8/1546461407535/BlinkM_datasheet.pdf
After glancing through the source code for the existing driver, leds-blinkm.c, I noticed a TODO for implementing several of the device's key features, including setting the time adjust, fade speed, and writing and reading script lines. I would be happy to try implementing and contributing those features, but I wanted to hear some of your thoughts on it before I get started and if you think it would be worth everyone's time.
Best Regards,
Joe
Hi!
Quoted 4 lines
The BlinkM LED is a programmable full-color RGB LED with use cases including industrial design, hobbyist projects, automotive lighting, and wearables. The device is programmable in that specific commands can be send over I2C, including scripts, for more complicated lighting effects. The datasheet can be found here: https://static1.squarespace.com/static/5c155684f407b4100552994c/t/5c2d20ca0e2e7292108eadf8/1546461407535/BlinkM_datasheet.pdf
After glancing through the source code for the existing driver,
leds-blinkm.c, I noticed a TODO for implementing several of the device's key features, including setting the time adjust, fade speed, and writing and reading script lines. I would be happy to try implementing and contributing those features, but I wanted to hear some of your thoughts on it before I get started and if you think it would be worth everyone's time.
Take a look at pattern trigger. If you can implement that with hw acceleration...
Actually first step may be rgb-aware pattern trigger, then same interface with hw acceleration.
Best regards,
Pavel
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
A message that is not in the archive (sent off-list or not yet received): 20220821224442.dyip3dig3g2isqmi@libretux
Hi!
Please cc lists on communications.
Quoted 2 lines
Thank you. This would be my first time contributing to the kernel, so there are just a few things I wanted to clarify :)
Hmm, good luck.
Quoted 2 lines
I looked into the pattern trigger you mentioned, and from what I found in the sources and mailing list, it seems like an alternative to manually sending a stream of BlinkM script bytes. That is, the user instead sets a brightness and delay and then turns the LED on and off at whatever interval they choose. So it is preferable for the user to send their lighting sequence to the pattern trigger file, rather than with some other file/interface I create?
Yes, please. Use existing interface.
Quoted 2 lines
You also mentioned an RGB-aware pattern trigger, which would be necessary for implementing this driver feature. Did you mean I should first patch the existing
ledtrig-pattern.cto support changing RGB values, or is that something I would implement within the BlinkM driver?
You should patch ledtrig-pattern.c first.
Best regards,
Pavel
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Hello,
I have begun look at the source code for the BlinkM driver and the pattern trigger to get an idea of the best way to implement an RGB-aware pattern trigger. I was thinking that instead of sending patterns of brightness values and time intervals, the user of the trigger could send RGB hex values and time intervals. Let me know if there is some other way that would make more sense.
The main roadblock I ran into was the way RGB is done in the subsystem currently. From what I gather, each color has its own sysfs class and there is a seperate pattern trigger for each. For an RGB-aware pattern trigger, I assume there would need to be a more general sysfs class. But again, struct led_classdev doesn't have a property for colors.
Additionally, in the current pattern trigger source code, after performing all of the necessary computations, it hands the brightness value off to the LED core with the led_set_brightness() function. Even if the pattern trigger computed RGB values from its input, they would have no place to go, since the LED subsystem has no interface for setting colors, only brightness. Therefore, do you have any suggestions on what would be the best way for the trigger to read RGB values and send those values to the device? Or did you mean that I should work on adding RGB support to the subsystem as a whole? I see that there have been some attempts at it before, but I'm not sure why those were never merged.
Best Regards,
Joe
Quoted 23 lines · Pavel Machek
Hi!
Please cc lists on communications.
Quoted 2 lines
Thank you. This would be my first time contributing to the kernel, so there are just a few things I wanted to clarify :)
Hmm, good luck.
Quoted 2 lines
I looked into the pattern trigger you mentioned, and from what I found in the sources and mailing list, it seems like an alternative to manually sending a stream of BlinkM script bytes. That is, the user instead sets a brightness and delay and then turns the LED on and off at whatever interval they choose. So it is preferable for the user to send their lighting sequence to the pattern trigger file, rather than with some other file/interface I create?
Yes, please. Use existing interface.
Quoted 2 lines
You also mentioned an RGB-aware pattern trigger, which would be necessary for implementing this driver feature. Did you mean I should first patch the existing
ledtrig-pattern.cto support changing RGB values, or is that something I would implement within the BlinkM driver?You should patch
ledtrig-pattern.cfirst.Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.