HF-WS2812 Driver
ESP32 RMT-based driver for WS2812 / NeoPixel addressable RGB(W) LED strips
π Table of Contents
- Overview
- Features
- Quick Start
- Installation
- API Reference
- Examples
- Documentation
- Contributing
- License
π¦ Overview
π ππ Live Complete Documentation - Interactive guides, examples, and step-by-step tutorials
HF-WS2812 is an ESP32-specific driver for WS2812 and compatible addressable RGB(W) LED strips (commonly known as NeoPixels). The driver uses the ESP32βs RMT (Remote Control) peripheral to generate the precise timing signals required by WS2812 LEDs, providing hardware-accelerated LED control with minimal CPU overhead.
The driver supports both C and C++ APIs, includes built-in animation effects, and is fully configurable via ESP-IDFβs Kconfig system. Itβs compatible with WS2812, WS2812B, WS2813, SK6812, and other WS2812-compatible LED variants.
β¨ Features
- β Hardware-Accelerated: Uses ESP32 RMT peripheral for precise timing
- β Dual API: Both C and C++ interfaces available
- β Animation Effects: Built-in effects library (rainbow, chase, fade, etc.)
- β RGB and RGBW Support: 24-bit RGB and 32-bit RGBW LED types
- β Configurable Timing: Adjustable timing parameters for different LED variants
- β Brightness Control: Global brightness scaling (0-255)
- β Kconfig Integration: Full ESP-IDF Kconfig configuration support
- β Zero CPU Overhead: RMT handles signal generation automatically
π Quick Start
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "ws2812_cpp.hpp"
#include "ws2812_effects.hpp"
// Create strip: GPIO, RMT channel, LED count, LED type
WS2812Strip strip(GPIO_NUM_18, 0, 30, LedType::RGB);
WS2812Animator anim(strip);
void app_main(void) {
strip.begin();
anim.setEffect(WS2812Animator::Effect::Rainbow);
while (true) {
anim.tick();
vTaskDelay(pdMS_TO_TICKS(50));
}
}
For detailed setup, see Installation and Quick Start Guide.
π§ Installation
- Add as ESP-IDF component to your project
- Configure via Kconfig: Run
idf.py menuconfigβ Component Config β HF-ESP32-WS2812-RMT - Include the header in your code:
1 2 3
#include "ws2812_cpp.hpp" // C++ API // or #include "ws2812_control.h" // C API
For detailed installation instructions, see docs/installation.md.
π API Reference
| Method | Description |
|---|---|
begin() |
Initialize the LED strip |
setPixel() |
Set color of a single LED |
show() |
Send colors to LED strip |
setBrightness() |
Set global brightness |
setEffect() |
Set animation effect |
For complete API documentation, see docs/api_reference.md.
π Examples
For ESP32 examples, see the examples/esp32 directory.
Detailed example walkthroughs are available in docs/examples.md.
π Documentation
For complete documentation, see the docs directory.
π€ Contributing
Pull requests and suggestions are welcome! Please follow the existing code style and include tests for new features.
π License
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.