English | 简体中文
A no_std driver for single-wire addressable LED strips
(WS2812B, SK6812, WS2811, WS2816) with compile-time buffer sizing
and zero heap allocations.
- SPI backend via
embedded-hal— the only fully implemented backend today - RMT & PIO backends — compile-time skeletons; full transmit/encode paths pending
- Typed pixel formats:
Rgb(8-bit),Rgbw(8-bit + white),Rgb16(16-bit) - Typed protocol presets:
Ws2812,Ws2812B,Ws2811,Sk6812,Ws2816 - Compile-time capacity checks in
LedStrip::write; encode + transmit in one call - SPI encoding plan validation at construction time (bit-by-bit symbol simulation + timing tolerance vs protocol spec)
- Explicit
SpiEncodeError::InternalConsistencyfor impossible post-check encode overflows invert_outputsupport for boards with external inverter circuits- Destructure with
into_parts()to reuse backends across multiple strips
use led_strip::{LedStrip, SpiCodec, SpiBackend, SpiEncodingPlan, Rgb, RgbOrder, Ws2812B};
// Type-alias to reduce turbofish noise
type MyStrip = LedStrip<Rgb, Ws2812B, SpiCodec<Rgb, Ws2812B>, SpiBackend<MySpi>, 1024>;
let codec = SpiCodec::<Rgb, Ws2812B>::for_protocol(SpiEncodingPlan::ws2812_3bit(), false).unwrap();
let backend = SpiBackend::new(spi); // spi: impl embedded_hal::spi::SpiBus<u8>
let mut strip = MyStrip::new(RgbOrder::Grb, codec, backend);
let pixels = [Rgb::new(255, 0, 0); 60];
strip.write(&pixels).unwrap();This project uses release-plz to automate releases:
- Every push to
maintriggers release-plz to open/update a Release PR with the correct version bumps and a changelog derived from Conventional Commits. - Merge the Release PR when ready — release-plz will then:
- Create the git tag (
led-strip-v<version>) - Publish to crates.io
- Create a GitHub release with release notes
- Create the git tag (
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.