49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
/**
|
|
* @file config.h
|
|
* @brief Config module for LED controller - handles read and store of persistent data
|
|
*/
|
|
|
|
#ifndef CONFIG_H
|
|
#define CONFIG_H
|
|
|
|
#include "esp_err.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#define CONFIG_HASH_LEN 32 // SHA256
|
|
/**
|
|
* @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 led_count_strip_a; // LED count for LED strip A (-1 = not configured)
|
|
int8_t led_count_strip_b; // LED count for LED strip B (-1 = not configured)
|
|
int8_t pwm_pin; // GPIO pin for PWM input (-1 = not configured)
|
|
int8_t localBtn_pin; // GPIO pin for local btn input (-1 = not configured)
|
|
uint8_t hash[CONFIG_HASH_LEN]; // SHA256 Hash of config
|
|
} config_t;
|
|
|
|
/**
|
|
* @brief Initialize the config system
|
|
* Loads configuration from NVS
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t config_init(void);
|
|
|
|
/**
|
|
* @brief Get current configuration
|
|
* @param Pointer to current configuration (read-only)
|
|
*/
|
|
void config_get_config(config_t *const cnf);
|
|
|
|
/**
|
|
* @brief Reset configuration to defaults
|
|
* @return ESP_OK on success
|
|
*/
|
|
esp_err_t config_reset_config(void);
|
|
|
|
#endif // CONFIG_H
|