Skip to main content

esp_wifi_set_band_mode

Function esp_wifi_set_band_mode 

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

@brief Set WiFi band mode.

@attention 1. When the WiFi band mode is set to 2.4G only, it operates exclusively on the 2.4GHz channels. @attention 2. When the WiFi band mode is set to 5G only, it operates exclusively on the 5GHz channels. @attention 3. When the WiFi band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO), it can operate on both the 2.4GHz and 5GHz channels. @attention 4. WiFi band mode can be set to 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO) if CONFIG_SOC_WIFI_SUPPORT_5G is supported. @attention 5. If CONFIG_SOC_WIFI_SUPPORT_5G is not supported, the API will return ESP_ERR_INVALID_ARG when the band mode is set to either 5G only or 2.4G + 5G (WIFI_BAND_MODE_AUTO). @attention 6. When a WiFi band mode change triggers a band change, if no channel is set for the current band, a default channel will be assigned: channel 1 for 2.4G band and channel 36 for 5G band.

@param[in] band_mode store the band mode of WiFi

@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