rp-rs / ws2812-pio-rs

https://crates.io/crates/ws2812-pio/
Apache License 2.0
18 stars 26 forks source link

Add support for RGBW<u8> #19

Closed chrisprice closed 2 years ago

chrisprice commented 2 years ago

I've tried to add support for RGBW lightstrips (example here) without breaking backwards compatibility. However.... this is my first attempt at such a thing in Rust so I'm sure I've goofed! Any feedback is most welcome.

chrisprice commented 2 years ago

Thanks for the feedback, much appreciated.

I've been down a bit of a rabbit hole since posting the above. It was only once I'd reverse engineering the PIO code to check the timings, that I realised it was ported from the very well explained official guide/examples... And only after pouring over that, that I realised the seemingly undocumented feature magically changing the byte order from GRBW into RGBW, was in fact a "feature" of the product description page of the site I bought the board from - linking me to the wrong datasheet.

After looking at a lot of datasheets for similar chips I've realised that there is a lot of similarity in them but as you say they vary in timings and, as I've discovered, byte order. There is however, a lot of similarity in the format in which they present their timings. This has left me wondering if a good starting point for a somewhat more generic implementation might be building a macro to take these timings from their datasheet format and transform them into the PIO timings.

Anyhow, that's very much a departure from the original intention of this PR so I'm going to close it. If I were to come up with such an implementation, would you be interested if I dropped a comment here referencing it?

ithinuel commented 2 years ago

I would definitely be interested :)