63 lines
1.5 KiB
C
63 lines
1.5 KiB
C
/**
|
|
* @file control.h
|
|
* @brief Control module for LED controller - handles initialization of LEDs, PWM
|
|
*/
|
|
|
|
#ifndef CONTROL_H
|
|
#define CONTROL_H
|
|
|
|
#include "esp_err.h"
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* @brief Configuration structure stored in NVS
|
|
*/
|
|
typedef struct
|
|
{
|
|
int8_t led_pin_strip_a; // GPIO pin for LED strip A (-1 = not configured)
|
|
int8_t led_pin_strip_b; // GPIO pin for LED strip B (-1 = not configured)
|
|
int8_t pwm_pin; // GPIO pin for PWM input (-1 = not configured)
|
|
uint32_t magic; // Magic number to validate config (0xDEADBEEF)
|
|
} controller_config_t;
|
|
|
|
/**
|
|
* @brief Initialize the control system
|
|
* Loads configuration from NVS and initializes subsystems
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t control_init(void);
|
|
|
|
/**
|
|
* @brief Get current configuration
|
|
* @return Pointer to current configuration (read-only)
|
|
*/
|
|
const controller_config_t *control_get_config(void);
|
|
|
|
/**
|
|
* @brief Update configuration and save to NVS
|
|
* @param config New configuration
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t control_update_config(const controller_config_t *config);
|
|
|
|
/**
|
|
* @brief Reset configuration to defaults
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t control_reset_config(void);
|
|
|
|
/**
|
|
* @brief Set animation mode manually
|
|
* @param mode Animation mode (0-13)
|
|
*/
|
|
void control_set_animation_mode(uint8_t mode);
|
|
|
|
/**
|
|
* @brief Get current animation mode
|
|
* @return Current mode (0-13)
|
|
*/
|
|
uint8_t control_get_animation_mode(void);
|
|
|
|
#endif // CONTROL_H
|