Initial commit
This commit is contained in:
97
led_manager.h
Normal file
97
led_manager.h
Normal file
@@ -0,0 +1,97 @@
|
||||
#ifndef LED_MANAGER_H
|
||||
#define LED_MANAGER_H
|
||||
|
||||
#include "led_strip.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_err.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief LED color names available for use
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LED_COLOR_RED,
|
||||
LED_COLOR_ORANGE,
|
||||
LED_COLOR_YELLOW,
|
||||
LED_COLOR_GREEN,
|
||||
LED_COLOR_BLUE
|
||||
} led_color_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize the LED manager with GPIO pin
|
||||
*
|
||||
* @param gpio_pin GPIO pin number where the LED strip is connected
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_init(int gpio_pin);
|
||||
|
||||
/**
|
||||
* @brief Set LED color using color name with optional blinking
|
||||
*
|
||||
* @param color_name String name of the color (e.g., "Red", "Green", "Blue")
|
||||
* @param blink Enable blinking (true) or solid color (false)
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_set_color_by_name(const char *color_name, bool blink);
|
||||
|
||||
/**
|
||||
* @brief Set LED color using color enum with optional blinking
|
||||
*
|
||||
* @param color Color enum value
|
||||
* @param blink Enable blinking (true) or solid color (false)
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_set_color(led_color_t color, bool blink);
|
||||
|
||||
/**
|
||||
* @brief Set LED color using RGB values
|
||||
*
|
||||
* @param red Red component (0-255)
|
||||
* @param green Green component (0-255)
|
||||
* @param blue Blue component (0-255)
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_set_rgb(uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
/**
|
||||
* @brief Clear/turn off the LED
|
||||
*
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_clear(void);
|
||||
|
||||
/**
|
||||
* @brief Stop blinking and keep current color
|
||||
*
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_stop_blinking(void);
|
||||
|
||||
/**
|
||||
* @brief Set blink rate
|
||||
*
|
||||
* @param rate_ms Blink rate in milliseconds (default: 500ms)
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_set_blink_rate(uint32_t rate_ms);
|
||||
|
||||
/**
|
||||
* @brief Deinitialize the LED manager and free resources
|
||||
*
|
||||
* @return esp_err_t ESP_OK on success, error code on failure
|
||||
*/
|
||||
esp_err_t led_manager_deinit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LED_MANAGER_H
|
||||
Reference in New Issue
Block a user