Function esp_idf_sys::esp_wifi_set_channel
source ยท pub unsafe extern "C" fn esp_wifi_set_channel(
primary: u8,
second: wifi_second_chan_t,
) -> esp_err_t
Expand description
@brief Set primary/secondary channel of device
@attention 1. This API should be called after esp_wifi_start() and before esp_wifi_stop()
@attention 2. When device is in STA mode, this API should not be called when STA is scanning or connecting to an external AP
@attention 3. When device is in softAP mode, this API should not be called when softAP has connected to external STAs
@attention 4. When device is in STA+softAP mode, this API should not be called when in the scenarios described above
@attention 5. The channel info set by this API will not be stored in NVS. So If you want to remeber the channel used before wifi stop,
you need to call this API again after wifi start, or you can call esp_wifi_set_config()
to store the channel info in NVS.
@param primary for HT20, primary is the channel number, for HT40, primary is the primary channel @param second for HT20, second is ignored, for HT40, second is the second channel
@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
- ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start