ws2812-rs

Crates.iows2812-rs
lib.rsws2812-rs
version0.1.0
created_at2025-07-07 13:44:22.305108+00
updated_at2025-07-07 13:44:22.305108+00
descriptionFlexible #![no_std] Rust driver for WS2812B LEDs — supports delay traits, spinloops, manual timing, and custom color patterns.
homepage
repositoryhttps://github.com/CosmoBunny/ws2812-rs
max_upload_size
id1741292
size54,888
CosmoBunny (CosmoBunny)

documentation

README

WS2812B Rust Driver (no_std)

A lightweight, platform-agnostic Rust driver for WS2812B RGB LEDs. Designed with embedded systems in mind, this crate provides configurable timing strategies for controlling LED strips using only a data line. Compatible with #![no_std].

✨ Features

  • WS2812B-compatible 1-wire RGB protocol
  • Multiple timing strategies:
    • own_delay: Uses an external delay provider implementing DelayNs
    • manual_delay: Expects delay objects at function call
    • spinloop_delay: Pure spin-loop timing using CPU frequency
  • Modular color abstraction via the Color struct
  • Flexible for boards without advanced peripherals
  • Compile-time control via Cargo features

🛠 Configuration

Enable your desired timing backend by activating one of the following features:

Feature Description
own_delay Use a mutable reference to a DelayNs trait impl
manual_delay Provide delay at each call to send_color
spinloop_delay(default) Delay through CPU spin-loops with known frequency

Note: Only one feature should be enabled at a time.

📦 Usage

Cargo.toml

[dependencies]
ws2812b = "*" 
embedded-hal = "1.*" # or compatible version
Commit count: 0

cargo fmt