Espressif ESP32-S2 Programming Manual page 103

Table of Contents

Advertisement

Chapter 2. API Reference
• ifx: interface to be configured
• [out] bw: store bandwidth of interface ifx
esp_err_t
esp_wifi_set_channel(uint8_t primary,
Set primary/secondary channel of ESP32.
Attention 1. This API should be called after esp_wifi_start()
Attention 2. When ESP32 is in STA mode, this API should not be called when STA is scanning or connecting
to an external AP
Attention 3. When ESP32 is in softAP mode, this API should not be called when softAP has connected to
external STAs
Attention 4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios
described above
Return
• ESP_OK: succeed
• ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
• ESP_ERR_WIFI_IF: invalid interface
• ESP_ERR_INVALID_ARG: invalid argument
Parameters
• primary: for HT20, primary is the channel number, for HT40, primary is the primary channel
• second: for HT20, second is ignored, for HT40, second is the second channel
esp_err_t
esp_wifi_get_channel(uint8_t *primary,
Get the primary/secondary channel of ESP32.
Attention 1. API return false if try to get a interface that is not enable
Return
• ESP_OK: succeed
• ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
• ESP_ERR_INVALID_ARG: invalid argument
Parameters
• primary: store current primary channel
• [out] second: store current second channel
esp_err_t
esp_wifi_set_country(const
configure country info
Attention 1. It is discouraged to call this API since this doesn't validate the per-country rules, it's up to
the user to fill in all fields according to local regulations. Please use esp_wifi_set_country_code instead.
Attention 2.
The default country is CHINA {.cc="CN",
icy=WIFI_COUNTRY_POLICY_AUTO}
Attention 3. When the country policy is WIFI_COUNTRY_POLICY_AUTO, the country info of the AP to
which the station is connected is used. E.g. if the configured country info is {.cc="USA", .schan=1,
.nchan=11} and the country info of the AP to which the station is connected is {.cc="JP", .schan=1,
.nchan=14} then the country info that will be used is {.cc="JP", .schan=1, .nchan=14}. If the station
disconnected from the AP the country info is set back to the country info of the station automatically,
{.cc="US", .schan=1, .nchan=11} in the example.
Attention 4. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, then the configured coun-
try info is used always.
Attention 5. When the country info is changed because of configuration or because the station connects to a
different external AP, the country IE in probe response/beacon of the soft-AP is also changed.
Attention 6. The country configuration is stored into flash.
Attention 7. When this API is called, the PHY init data will switch to the PHY init data type corresponding
to the country info.
Return
• ESP_OK: succeed
• ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
• ESP_ERR_INVALID_ARG: invalid argument
Parameters
• country: the configured country info
Espressif Systems
wifi_second_chan_t
wifi_second_chan_t
wifi_country_t
*country)
92
Submit Document Feedback
second)
*second)
.schan=1,
.nchan=13,
Release v4.4
pol-

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF