ESP32/components/status_led/status_led.h

43 lines
1.0 KiB
C

#pragma once
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
// Logical states for the device
typedef enum {
LED_STATE_NO_CONFIG,
LED_STATE_WAITING,
LED_STATE_CONNECTED,
LED_STATE_MONITORING,
LED_STATE_TRANSMITTING, // Busy / Fast Flash (Healthy)
LED_STATE_TRANSMITTING_SLOW, // Slow Pulse (Falling behind)
LED_STATE_STALLED, // Solid Purple (Blocked)
LED_STATE_FAILED
} led_state_t;
/**
* @brief Initialize the status LED driver
* Supports both Addressable RGB (WS2812) and Simple GPIO LEDs.
* @param gpio_pin The GPIO pin number
* @param is_rgb_strip Set true for NeoPixel/WS2812, false for simple ON/OFF LED
*/
void status_led_init(int gpio_pin, bool is_rgb_strip);
/**
* @brief Thread-safe function to set the visual state
* @param state Desired logical state
*/
void status_led_set_state(led_state_t state);
/**
* @brief Get current state (useful for status console commands)
*/
led_state_t status_led_get_state(void);
#ifdef __cplusplus
}
#endif