basic led control with local btn
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file control.h
|
||||
* @brief Control module for LED controller - handles initialization of LEDs, PWM, and Bluetooth
|
||||
* @brief Control module for LED controller - handles initialization of LEDs, PWM
|
||||
*/
|
||||
|
||||
#ifndef CONTROL_H
|
||||
@ -10,24 +10,15 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief BLE auto-off timeout options
|
||||
*/
|
||||
typedef enum {
|
||||
BLE_TIMEOUT_NEVER = 0,
|
||||
BLE_TIMEOUT_1MIN = 60,
|
||||
BLE_TIMEOUT_5MIN = 300
|
||||
} ble_timeout_t;
|
||||
|
||||
/**
|
||||
* @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)
|
||||
ble_timeout_t ble_timeout; // BLE auto-off timeout
|
||||
uint32_t magic; // Magic number to validate config (0xDEADBEEF)
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -41,14 +32,14 @@ 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);
|
||||
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);
|
||||
esp_err_t control_update_config(const controller_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Reset configuration to defaults
|
||||
@ -56,22 +47,6 @@ esp_err_t control_update_config(const controller_config_t* config);
|
||||
*/
|
||||
esp_err_t control_reset_config(void);
|
||||
|
||||
/**
|
||||
* @brief Get BLE enabled status
|
||||
* @return true if BLE is enabled
|
||||
*/
|
||||
bool control_is_ble_enabled(void);
|
||||
|
||||
/**
|
||||
* @brief Manually disable BLE
|
||||
*/
|
||||
void control_disable_ble(void);
|
||||
|
||||
/**
|
||||
* @brief Emulate PWM pulse (for web button)
|
||||
*/
|
||||
void control_emulate_pwm_pulse(void);
|
||||
|
||||
/**
|
||||
* @brief Set animation mode manually
|
||||
* @param mode Animation mode (0-13)
|
||||
|
||||
Reference in New Issue
Block a user