7 unstable releases (3 breaking)

Uses new Rust 2021

0.4.0 Aug 14, 2022
0.3.1 Apr 10, 2022
0.2.2 Mar 21, 2022
0.2.0 Feb 27, 2022
0.1.0 Feb 17, 2022

#494 in Embedded development

Download history 53/week @ 2022-08-10 23/week @ 2022-08-17 26/week @ 2022-08-24 18/week @ 2022-08-31 28/week @ 2022-09-07 20/week @ 2022-09-14 16/week @ 2022-09-21 26/week @ 2022-09-28 33/week @ 2022-10-05 18/week @ 2022-10-12 24/week @ 2022-10-19 15/week @ 2022-10-26 4/week @ 2022-11-02 5/week @ 2022-11-09 33/week @ 2022-11-16 21/week @ 2022-11-23

64 downloads per month

MIT license

30KB
616 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"] }
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.8–2.1MB
~41K SLoC