/**
 * @file potentiometer_manager.h
 * @brief Potentiometer Manager for Volume & Brightness Control
 * 
 * Features:
 * - Volume control (0-100%)
 * - Brightness control (10-100%)
 * - ADC reading with smoothing
 * - Automatic updates
 */

#pragma once

#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Potentiometer change callback
 * @param volume Current volume (0-100%)
 * @param brightness Current brightness (10-100%)
 */
typedef void (*poti_change_callback_t)(uint8_t volume, uint8_t brightness);

/**
 * @brief Initialize potentiometer manager
 * @return ESP_OK on success
 */
esp_err_t poti_manager_init(void);

/**
 * @brief Start potentiometer monitoring task
 * @param callback Callback function for changes (can be NULL)
 * @return ESP_OK on success
 */
esp_err_t poti_manager_start(poti_change_callback_t callback);

/**
 * @brief Stop potentiometer monitoring task
 */
void poti_manager_stop(void);

/**
 * @brief Get current volume (0-100%)
 * @return Volume percentage
 */
uint8_t poti_get_volume(void);

/**
 * @brief Get current brightness (10-100%)
 * @return Brightness percentage
 */
uint8_t poti_get_brightness(void);

/**
 * @brief Manual update (read ADC values)
 * @return ESP_OK on success
 */
esp_err_t poti_update(void);

#ifdef __cplusplus
}
#endif
