kalkyl / ws2812-async

Async SPI driver for ws2812 smart LEDs
4 stars 9 forks source link

Use structs for reordering #7

Open chmanie opened 4 days ago

chmanie commented 4 days ago

This PR uses marker structs to set the color order. This should save one match statement as the Color order is determined at compile time (which can be assumed as the Led ordering should not change during runtime).

Usage now would be:

use ws2812_async::{Ws2812, Grb};
let mut ws: Ws2812<_, Grb, { 12 * 18 }> = Ws2812::new(spi);

The rest of the API stays the same (except that there's no set_color_order method anymore).

Furthermore I allowed myself to also implement the preliminary async smart-leds-trait from here: https://github.com/smart-leds-rs/smart-leds-trait/pull/13

Let me know what you think!

Note: the Cargo.toml still references my fork of the smart-leds-trait. Let's hope the async trait will be added in the next version, so that we can reference it properly.

Closes #3

chmanie commented 4 days ago

I converted it into a draft PR until https://github.com/smart-leds-rs/smart-leds-trait/pull/13 is merged and released.