14 releases (8 breaking)

0.9.0 Jul 6, 2024
0.7.1 Feb 3, 2024
0.6.0 Jul 10, 2023
0.5.0 Dec 24, 2022
0.2.2 Mar 21, 2022

#175 in Embedded development

Download history 49/week @ 2024-04-01 7/week @ 2024-04-08 23/week @ 2024-04-15 23/week @ 2024-04-22 92/week @ 2024-04-29 13/week @ 2024-05-06 11/week @ 2024-05-13 7/week @ 2024-05-20 13/week @ 2024-05-27 204/week @ 2024-06-03 40/week @ 2024-06-10 15/week @ 2024-06-17 29/week @ 2024-06-24 155/week @ 2024-07-01 33/week @ 2024-07-08 20/week @ 2024-07-15

239 downloads per month
Used in 2 crates

MIT license

35KB
676 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 = { version = "*", features = ["smart-leds-trait"] }

[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"] to enable embedded-graphics API ws2812_esp32_rmt_driver::lib_embedded_graphics.
  • features = ["smart-leds-trait"] to enable smart-leds API ws2812_esp32_rmt_driver::lib_smart_leds.
  • default feature to enable just only driver API.

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.3–7MB
~49K SLoC