2.10. esp_wifi
— Espressif WiFi¶
This module is a wrapper for the Espressif WiFi interface.
Configure the WiFi as a Station and an Access Point at the same time. The application tries to connect to a Wifi with SSID ssid and will accept connections to the SSID Simba.
esp_wifi_set_op_mode(esp_wifi_op_mode_station_softap_t);
esp_wifi_softap_init("Simba", NULL);
esp_wifi_station_init("ssid", "password", NULL);
Configure the WiFi as an Access Point. The application will accept connections to the SSID Simba.
esp_wifi_set_op_mode(esp_wifi_op_mode_softap_t);
esp_wifi_softap_init("Simba", NULL);
Configure the WiFi as a Station. The application tries to connect to a Wifi with SSID ssid.
esp_wifi_set_op_mode(esp_wifi_op_mode_station_t);
esp_wifi_station_init("ssid", "password", NULL);
Submodules:
Source code: src/drivers/esp_wifi.h, src/drivers/esp_wifi.c
Test code: tst/drivers/esp_wifi/main.c
Enums
-
enum type
esp_wifi_op_mode_t
¶ Values:
- = 0
-
enum type
esp_wifi_phy_mode_t
¶ Physical WiFi mode.
Values:
- = 1
-
enum type
esp_wifi_dhcp_status_t
¶ DHCP status.
Values:
- = 0
Functions
-
int
esp_wifi_module_init
(void)¶ Initialize the Espressif WiFi module. This function must be called before calling any other function in this module.
The module will only be initialized once even if this function is called multiple times.
- Return
- zero(0) or negative error code.
-
int
esp_wifi_set_op_mode
(enum esp_wifi_op_mode_t mode)¶ Set the WiFi operating mode to None, Station, SoftAP or Station + SoftAP. The default mode is SoftAP.
- Return
- zero(0) or negative error code.
- Parameters
mode
: Operating mode to set.
-
enum esp_wifi_op_mode_t
esp_wifi_get_op_mode
(void)¶ Get the current WiFi operating mode. The operating mode can be None, Station, SoftAP, or Station + SoftAP.
- Return
- Current operating mode.
-
int
esp_wifi_set_phy_mode
(enum esp_wifi_phy_mode_t mode)¶ Set the WiFi physical mode (802.11b/g/n).
The SoftAP only supports b/g.
- Return
- zero(0) or negative error code.
- Parameters
mode
: Physical mode.
-
enum esp_wifi_phy_mode_t
esp_wifi_get_phy_mode
(void)¶ Get the physical mode (802.11b/g/n).
- Return
- WiFi physical mode.
-
void
esp_wifi_print
(void *chout_p)¶ Print information about the WiFi.