esp-rs / std-training

Embedded Rust on Espressif training material.
https://esp-rs.github.io/std-training
Apache License 2.0
606 stars 78 forks source link

Allow parameters when constructing rgb-led #190

Closed sredman closed 1 year ago

sredman commented 1 year ago

I wanted to "borrow" the rgb-led library for my own project, but my devboard uses pin 8.

Update rgb-led's constructor to allow the user to pass different pins (and channels).

Tested in my own project and by building the std-training/advanced/button-interrupt project in this repository.

sredman commented 1 year ago

By the way, is the rgb-led library available as a crate? It seems like a good fit for it, and with this bit of "polish" it's probably in good enough shape. From my perspective, getting the LED blinking on my board is my traditional "Hello World", but it took me quite some time to dig up this code so that I could make that happen!

SergioGasquez commented 1 year ago

By the way, is the rgb-led library available as a crate? It seems like a good fit for it, and with this bit of "polish" it's probably in good enough shape. From my perspective, getting the LED blinking on my board is my traditional "Hello World", but it took me quite some time to dig up this code so that I could make that happen!

Hi! I am not sure how useful it would be to have it as a crate, it would require some maintenance and there are some crates for that LED that should do pretty much the same: https://crates.io/search?q=WS2812.