HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
Loading...
Searching...
No Matches
Ws2812Handler.h File Reference

Unified handler for WS2812 addressable LED strips using RMT peripheral. More...

#include <cstdint>
#include <memory>
#include <type_traits>
#include <utility>
#include "core/hf-core-drivers/external/hf-ws2812-rmt-driver/inc/ws2812_cpp.hpp"
#include "core/hf-core-drivers/external/hf-ws2812-rmt-driver/inc/ws2812_effects.hpp"
#include "RtosMutex.h"
Include dependency graph for Ws2812Handler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Ws2812Handler
 Unified handler for WS2812 addressable LED strips. More...
 
struct  Ws2812Handler::Config
 Configuration structure for the WS2812 handler. More...
 

Typedefs

using gpio_num_t = int
 

Detailed Description

Unified handler for WS2812 addressable LED strips using RMT peripheral.

Provides HAL-level lifecycle management for WS2812/SK6812/NeoPixel LED strips. Features:

  • Thread-safe lifecycle management (Initialize, Deinitialize)
  • Direct access to underlying WS2812Strip and WS2812Animator objects
  • Lazy initialization pattern
  • Comprehensive diagnostics

All pixel operations and animation effects should be performed through GetStrip() and GetAnimator() which expose the full driver API.

Usage Example

.gpio_pin = GPIO_NUM_48,
.num_leds = 30,
.led_type = LedType::RGB,
.brightness = 50
});
if (leds.Initialize() == ESP_OK) {
auto* strip = leds.GetStrip();
auto* anim = leds.GetAnimator();
strip->SetPixel(0, 0xFF0000); // Red
strip->Show();
}
Unified handler for WS2812 addressable LED strips.
Definition Ws2812Handler.h:71
WS2812Strip * GetStrip() noexcept
Get the underlying LED strip object.
Definition Ws2812Handler.cpp:106
Configuration structure for the WS2812 handler.
Definition Ws2812Handler.h:76
gpio_num_t gpio_pin
GPIO pin connected to LED data line.
Definition Ws2812Handler.h:77
Note
This handler provides lifecycle management and direct access to the underlying WS2812Strip and WS2812Animator objects. All pixel operations and effects should be performed through GetStrip() and GetAnimator().
Author
HardFOC Team
Date
2025

Typedef Documentation

◆ gpio_num_t

using gpio_num_t = int