HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions
LedManager.h File Reference

LED management for the HardFOC Flux V1 platform (single WS2812). More...

#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/base/HardwareTypes.h"
#include "handlers/logger/Logger.h"
#include "RtosMutex.h"
#include "flux_hal/flux_hal_types.hpp"
#include "core/hf-core-drivers/internal/hf-pincfg/src/hf_functional_pin_config_flux_v1.hpp"
#include <cstdint>
#include <atomic>
Include dependency graph for LedManager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LedColor
 Simple RGB colour triplet. More...
 
struct  LedSystemDiagnostics
 Snapshot of LED subsystem health and counters. More...
 
class  LedManager
 Singleton that drives the on-board WS2812 status LED. More...
 

Namespaces

namespace  LedColors
 Predefined named colour constants.
 

Enumerations

enum class  LedError : uint8_t {
  SUCCESS = 0 , NOT_INITIALIZED , INITIALIZATION_FAILED , INVALID_PARAMETER ,
  HARDWARE_ERROR , ANIMATION_FAILED , INVALID_COLOR , INVALID_BRIGHTNESS
}
 Error codes returned by LedManager operations. More...
 
enum class  LedAnimation : uint8_t {
  OFF = 0 , SOLID , BLINK , BREATH ,
  RAINBOW , STATUS_OK , STATUS_WARN , STATUS_ERROR ,
  STATUS_BOOT , STATUS_CALIBRATE
}
 Available LED animation modes. More...
 

Functions

constexpr const char * LedErrorToString (LedError error) noexcept
 Convert a LedError to a human-readable C-string.
 
constexpr const char * LedAnimationToString (LedAnimation animation) noexcept
 Convert a LedAnimation to a human-readable C-string.
 
static constexpr LedColor LedColors::BLACK (0, 0, 0)
 Off / black.
 
static constexpr LedColor LedColors::RED (255, 0, 0)
 Pure red.
 
static constexpr LedColor LedColors::GREEN (0, 255, 0)
 Pure green.
 
static constexpr LedColor LedColors::BLUE (0, 0, 255)
 Pure blue.
 
static constexpr LedColor LedColors::YELLOW (255, 255, 0)
 Yellow.
 
static constexpr LedColor LedColors::CYAN (0, 255, 255)
 Cyan.
 
static constexpr LedColor LedColors::MAGENTA (255, 0, 255)
 Magenta.
 
static constexpr LedColor LedColors::WHITE (255, 255, 255)
 Full white.
 
static constexpr LedColor LedColors::ORANGE (255, 165, 0)
 Orange.
 
static constexpr LedColor LedColors::PURPLE (128, 0, 128)
 Purple.
 
LedManager & GetLedManager () noexcept
 Convenience accessor — equivalent to LedManager::GetInstance().
 

Detailed Description

LED management for the HardFOC Flux V1 platform (single WS2812).

Identical hardware to Vortex: a single WS2812 LED on GPIO3. Provides solid/blink/breath/rainbow animations plus convenience status-indication methods (boot, ready, error…).

The strip itself (the WS2812 RMT driver on the ESP32-S3) lives in the platform binding (bsp_bind/FluxPlatformBind.h, LedStrip*), in static storage; this manager holds only the animation state, so the header is MCU-free.

Author
HardFOC Team
Date
2026
Version
1.0

Enumeration Type Documentation

◆ LedAnimation

enum class LedAnimation : uint8_t
strong

Available LED animation modes.

Enumerator
OFF 

LED turned off (no animation).

SOLID 

Constant colour, no animation.

BLINK 

On/off blink at BLINK_SPEED interval.

BREATH 

Smooth brightness ramp up/down.

RAINBOW 

Continuous colour-wheel cycle.

STATUS_OK 

System-ready indicator (solid green).

STATUS_WARN 

Warning indicator (yellow blink).

STATUS_ERROR 

Error indicator (red fast-blink).

STATUS_BOOT 

Boot-up indicator (blue blink).

STATUS_CALIBRATE 

Calibration indicator (cyan breathe).

◆ LedError

enum class LedError : uint8_t
strong

Error codes returned by LedManager operations.

Enumerator
SUCCESS 

Operation completed successfully.

NOT_INITIALIZED 

Manager has not been initialized yet.

INITIALIZATION_FAILED 

WS2812 strip/RMT setup failed.

INVALID_PARAMETER 

Argument out of valid range.

HARDWARE_ERROR 

RMT peripheral or strip communication error.

ANIMATION_FAILED 

Animation start/update failed.

INVALID_COLOR 

Colour value rejected.

INVALID_BRIGHTNESS 

Brightness value out of [0, max] range.

Function Documentation

◆ GetLedManager()

LedManager & GetLedManager ( )
inlinenoexcept

Convenience accessor — equivalent to LedManager::GetInstance().

Returns
Reference to the singleton LedManager.
Here is the call graph for this function:

◆ LedAnimationToString()

constexpr const char * LedAnimationToString ( LedAnimation  animation)
constexprnoexcept

Convert a LedAnimation to a human-readable C-string.

Parameters
animationThe animation type to convert.
Returns
Null-terminated string describing animation.
Here is the caller graph for this function:

◆ LedErrorToString()

constexpr const char * LedErrorToString ( LedError  error)
constexprnoexcept

Convert a LedError to a human-readable C-string.

Parameters
errorThe error code to convert.
Returns
Null-terminated string describing error.
Here is the caller graph for this function: