ESP32/components/wifi_cfg/wifi_cfg.h

58 lines
1.3 KiB
C

#ifndef WIFI_CFG_H
#define WIFI_CFG_H
#include "esp_wifi.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
// Bandwidth constants - Define WIFI_BW_HT80 if not already defined by ESP-IDF
// ESP-IDF defines WIFI_BW_HT20 (0) and WIFI_BW_HT40 (1), but WIFI_BW_HT80 (2) may not exist yet
#ifndef WIFI_BW_HT80
#define WIFI_BW_HT80 WIFI_BW80 // 80MHz bandwidth (VHT80) for ESP32-C5/C6 on 5GHz
#endif
/**
* @brief Initialize the WiFi configuration system
*
* Spawns listener tasks for both UART and USB-Serial/JTAG interfaces
* to receive configuration commands.
*/
void wifi_cfg_init(void);
/**
* @brief Apply WiFi configuration from NVS
*
* @return true if configuration was found and applied, false otherwise
*/
bool wifi_cfg_apply_from_nvs(void);
/**
* @brief Force DHCP mode enable/disable
*
* @param enable true to enable DHCP, false to disable
*/
void wifi_cfg_force_dhcp(bool enable);
/**
* @brief Get the configured power save mode from NVS
*
* @return wifi_ps_type_t Power save mode (WIFI_PS_NONE, WIFI_PS_MIN_MODEM, or WIFI_PS_MAX_MODEM)
*/
wifi_ps_type_t wifi_cfg_get_power_save_mode(void);
/**
* @brief Ensure WiFi driver is initialized (thread-safe, idempotent)
*
* @return ESP_OK on success, error code otherwise
*/
esp_err_t wifi_ensure_inited(void);
#ifdef __cplusplus
}
#endif
#endif // WIFI_CFG_H