12 releases (6 breaking)

0.7.1 Feb 3, 2024
0.6.0 Jul 10, 2023
0.5.0 Dec 24, 2022
0.4.0 Aug 14, 2022
0.2.2 Mar 21, 2022

#1 in #rgb-led

Download history 34/week @ 2023-12-23 15/week @ 2023-12-30 18/week @ 2024-01-06 18/week @ 2024-01-13 20/week @ 2024-01-20 2/week @ 2024-01-27 9/week @ 2024-02-03 11/week @ 2024-02-10 38/week @ 2024-02-17 85/week @ 2024-02-24 39/week @ 2024-03-02 38/week @ 2024-03-09 19/week @ 2024-03-16 9/week @ 2024-03-23 45/week @ 2024-03-30 6/week @ 2024-04-06

86 downloads per month
Used in 2 crates

MIT license

35KB
684 lines

ws2812-esp32-rmt-driver

A rust driver library to control WS2812B (NeoPixel) RGB LED pixels/strips using ESP32 RMT (Remote Control) module.

Rust ws2812-esp32-rmt-driver at crates.io API

By disabling the carrier generator of the RMT's transmitter , it can be used as just a PWM signal generator for WS2812B data signal. This control way is the same as major Arduino/C++ library such as FastLED, Adafruit_NeoPixel.

The RMT (Remote Control) module is specific to ESP32. Hence, it can be used only for ESP32 SoC.

This library also support SK6812-RGBW 4-color LED pixels/strips (smart-leds API only).

Usage

Install rust with Xtensa support. Refer esp-rs/rust-build for the setup instruction.

Add following dependency to your Cargo.toml. Note that version is stripped in this example but it is recommended to specify version explicitly in your project.

[dependencies]
esp-idf-sys = { version = "*", features = ["binstart"] }
esp-idf-hal = "*"
smart-leds = "*"

ws2812-esp32-rmt-driver = "*"

[build-dependencies]
embuild = "*"
anyhow = "1"

Refer examples/ directory for the source code.

Make ensure esp toolchain is available and xtensa-esp32-elf-clang is in your $PATH. And then, run as follows

$ cargo build
$ cargo espflash

Features

  • features = ["embedded-graphics-core", "unstable"] to enable embedded-graphics API ws2812_esp32_rmt_driver::lib_embedded_graphics.
  • features = ["smart-leds"] or default to enable minimum smart-leds API.
  • features = ["smart-leds", "unstable"] to enable detailed smart-leds API ws2812_esp32_rmt_driver::lib_smart_leds.

Development

To run the test locally, specify the local toolchain (stable, nightly, etc...) and target explicitly and disable example builds (specify --lib) .

$ cargo +stable test --target x86_64-unknown-linux-gnu --lib

Dependencies

~0.9–9.5MB
~60K SLoC