led-strip
English | 简体中文
A no_std driver for single-wire addressable LED strips
(WS2812B, SK6812, WS2811, WS2816) with compile-time buffer sizing
and zero heap allocations.
Features
- 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
Usage
use ;
// Type-alias to reduce turbofish noise
type MyStrip = ;
let codec = for_protocol.unwrap;
let backend = new; // spi: impl embedded_hal::spi::SpiBus<u8>
let mut strip = new;
let pixels = ;
strip.write.unwrap;
Releasing
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 (
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.