Skip to main content

esp_wifi_set_band

Function esp_wifi_set_band 

Source
pub unsafe extern "C" fn esp_wifi_set_band(band: u32) -> i32
Expand description

@brief Set WiFi current band.

@attention 1. This API is only operational when the WiFi band mode is configured to 2.4G + 5G (WIFI_BAND_MODE_AUTO) @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. It is recommended not to use this API. If you want to change the current band, you can use esp_wifi_set_channel instead.

@param[in] band WiFi band 2.4G / 5G

@return

  • ESP_OK: succeed
  • ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
  • ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
  • ESP_ERR_INVALID_ARG: invalid argument