fix(wifi): add comments for the new API and fix code comments

This commit is contained in:
xuxiao 2024-07-22 12:08:50 +08:00
parent a481b6c78d
commit a397d31162
22 changed files with 180 additions and 125 deletions

View File

@ -397,7 +397,7 @@ esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_INVALID_ARG: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the wifi related config is correct
* - ESP_ERR_INVALID_ARG: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the WiFi related config is correct
* - ESP_ERR_NO_MEM: out of memory
* - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
* - ESP_FAIL: other WiFi internal errors
@ -511,7 +511,7 @@ esp_err_t esp_wifi_deauth_sta(uint16_t aid);
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi was not started by esp_wifi_start
* - ESP_ERR_WIFI_TIMEOUT: blocking scan is timeout
* - ESP_ERR_WIFI_STATE: wifi still connecting when invoke esp_wifi_scan_start
* - ESP_ERR_WIFI_STATE: WiFi still connecting when invoke esp_wifi_scan_start
* - others: refer to error code in esp_err.h
*/
esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, bool block);
@ -630,7 +630,7 @@ esp_err_t esp_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record);
* - 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_WIFI_MODE: WiFi mode is wrong
* - ESP_ERR_INVALID_ARG: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the wifi related config is correct
* - ESP_ERR_INVALID_ARG: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the WiFi related config is correct
*/
esp_err_t esp_wifi_clear_ap_list(void);
@ -676,20 +676,23 @@ esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type);
/**
* @brief Set protocol type of specified interface
* The default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N).
* if CONFIG_SOC_WIFI_HE_SUPPORT and band is 2.4G, the default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AX).
* if CONFIG_SOC_WIFI_HE_SUPPORT and band is 5G, the default protocol is (WIFI_PROTOCOL_11A|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AC|WIFI_PROTOCOL_11AX).
* if CONFIG_SOC_WIFI_HE_SUPPORT and band mode is 2.4G, the default protocol is (WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AX).
* if CONFIG_SOC_WIFI_HE_SUPPORT_5G and band mode is 5G, the default protocol is (WIFI_PROTOCOL_11A|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_11AC|WIFI_PROTOCOL_11AX).
*
* @attention 2.4G: Support 802.11b or 802.11bg or 802.11bgn or 802.11bgnax or LR mode
* 5G: Support 802.11a or 802.11an or 802.11anac or 802.11anacax
* @attention can not set wifi protocol under band 2.4G + 5G mode
* @attention 1. When WiFi band mode is 2.4G only, support 802.11b or 802.11bg or 802.11bgn or 802.11bgnax or LR mode
* @attention 2. When WiFi band mode is 5G only, support 802.11a or 802.11an or 802.11anac or 802.11anacax
* @attention 3. Can not set WiFi protocol under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_protocols instead
* @attention 4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
*
* @param ifx interfaces
* @param ifx interface
* @param protocol_bitmap WiFi protocol bitmap
*
* @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_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
@ -697,7 +700,10 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
/**
* @brief Get the current protocol bitmap of the specified interface
*
* @attention can not get wifi protocol under band 2.4G + 5G mode
* @attention 1. When WiFi band mode is 2.4G only, it will return the protocol supported in the 2.4G band
* @attention 2. When WiFi band mode is 5G only, it will return the protocol supported in the 5G band
* @attention 3. Can not get WiFi protocol under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_get_protocols instead
* @attention 4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
*
* @param ifx interface
* @param[out] protocol_bitmap store current WiFi protocol bitmap of interface ifx
@ -707,6 +713,7 @@ esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
* - 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_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
@ -714,9 +721,10 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
/**
* @brief Set the bandwidth of specified interface
*
* @attention 1. API return false if try to configure an interface that is not enabled
* @attention 2. WIFI_BW_HT40 is supported only when the interface support 11N
* @attention 3. can not get wifi bandwidth under band 2.4G + 5G mode
* @attention 1. WIFI_BW_HT40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20.
* @attention 3. Can not set WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_bandwidths instead
* @attention 4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
*
* @param ifx interface to be configured
* @param bw bandwidth
@ -726,6 +734,7 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
* - 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_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
@ -733,8 +742,8 @@ esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
/**
* @brief Get the bandwidth of specified interface
*
* @attention 1. API return false if try to get a interface that is not enable
* @attention 2. can not get wifi bandwidth under band 2.4G + 5G mode
* @attention 1. Can not get WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_get_bandwidths instead
* @attention 2. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
*
* @param ifx interface to be configured
* @param[out] bw store bandwidth of interface ifx
@ -744,6 +753,7 @@ esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
* - 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_NOT_SUPPORTED: This API is not supported when the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
*/
esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
@ -754,8 +764,8 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
* @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 remember 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.
* @attention 5. The channel info set by this API will not be stored in NVS. So If you want to remember 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
@ -1094,7 +1104,7 @@ esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
/**
* @brief Set maximum transmitting power after WiFi start.
*
* @attention 1. Maximum power before wifi startup is limited by PHY init data bin.
* @attention 1. Maximum power before WiFi startup is limited by PHY init data bin.
* @attention 2. The value set by this API will be mapped to the max_tx_power of the structure wifi_country_t variable.
* @attention 3. Mapping Table {Power, max_tx_power} = {{8, 2}, {20, 5}, {28, 7}, {34, 8}, {44, 11},
* {52, 13}, {56, 14}, {60, 15}, {66, 16}, {72, 18}, {80, 20}}.
@ -1607,11 +1617,16 @@ esp_err_t esp_wifi_set_dynamic_cs(bool enabled);
*/
esp_err_t esp_wifi_sta_get_rssi(int *rssi);
#if SOC_WIFI_HE_SUPPORT_5G
/**
* @brief Set wifi band.
* @brief Set WiFi current band.
*
* @param[in] band wifi band 2.4G / 5G / 2.4G + 5G
* @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
@ -1621,9 +1636,9 @@ esp_err_t esp_wifi_sta_get_rssi(int *rssi);
esp_err_t esp_wifi_set_band(wifi_band_t band);
/**
* @brief Get wifi band.
* @brief Get WiFi current band.
*
* @param[in] band store band of wifi
* @param[in] band store current band of WiFi
*
* @return
* - ESP_OK: succeed
@ -1633,17 +1648,37 @@ esp_err_t esp_wifi_set_band(wifi_band_t band);
esp_err_t esp_wifi_get_band(wifi_band_t* band);
/**
* @brief Get wifi current band.
* @brief Set WiFi band mode.
*
* @param[in] band store the current band of wifi
* @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_HE_SUPPORT_5G is supported.
* @attention 5. If CONFIG_SOC_WIFI_HE_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_INVALID_ARG: invalid argument
*
*/
esp_err_t esp_wifi_set_band_mode(wifi_band_mode_t band_mode);
/**
* @brief get WiFi band mode.
*
* @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_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_current_band(wifi_band_t* band);
#endif /* SOC_WIFI_HE_SUPPORT_5G */
esp_err_t esp_wifi_get_band_mode(wifi_band_mode_t* band_mode);
#if CONFIG_ESP_COEX_POWER_MANAGEMENT
/**
@ -1663,8 +1698,12 @@ esp_err_t esp_wifi_coex_pwr_configure(bool enabled);
/**
* @brief Set the supported WiFi protocols for the specified interface.
*
* @param ifx interfaces
* @param bitmap WiFi protocol bitmap
* @attention 1. When the WiFi band mode is set to 2.4G only, it will not set 5G protocol
* @attention 2. When the WiFi band mode is set to 5G only, it will not set 2.4G protocol
* @attention 3. This API supports setting the maximum protocol. For example, if the 2.4G protocol is set to 802.11n, it will automatically configure to 802.11b/g/n.
*
* @param ifx interface
* @param protocols WiFi protocols include 2.4G protocol and 5G protocol
*
* @return
* - ESP_OK: succeed
@ -1672,13 +1711,17 @@ esp_err_t esp_wifi_coex_pwr_configure(bool enabled);
* - ESP_ERR_WIFI_IF: invalid interface
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_set_protocols(wifi_interface_t ifx, wifi_protocol_bitmap_t *bitmap);
esp_err_t esp_wifi_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols);
/**
* @brief Get the current protocol bitmap of the specified interface and specified band
* @brief Get the current protocol of the specified interface and specified band
*
* @attention 1. The 5G protocol can only be read when CONFIG_SOC_WIFI_HE_SUPPORT_5G is enabled.
* @attention 2. When the WiFi band mode is set to 2.4G only, it will not get 5G protocol
* @attention 3. When the WiFi band mode is set to 5G only, it will not get 2.4G protocol
*
* @param ifx interface
* @param[out] bitmap store current WiFi protocol bitmap of interface ifx
* @param[out] protocols store current WiFi protocols of interface ifx
*
* @return
* - ESP_OK: succeed
@ -1687,16 +1730,18 @@ esp_err_t esp_wifi_set_protocols(wifi_interface_t ifx, wifi_protocol_bitmap_t *b
* - ESP_ERR_INVALID_ARG: invalid argument
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_get_protocols(wifi_interface_t ifx, wifi_protocol_bitmap_t *bitmap);
esp_err_t esp_wifi_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols);
/**
* @brief Set the bandwidth of specified interface and specified band
*
* @attention 1. API return false if try to configure an interface that is not enabled
* @attention 2. WIFI_BW_HT40 is supported only when the interface support 11N
* @attention 1. WIFI_BW_HT40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20.
* @attention 3. When the WiFi band mode is set to 2.4G only, it will not set 5G bandwidth
* @attention 4. When the WiFi band mode is set to 5G only, it will not set 2.4G bandwidth
*
* @param ifx interface to be configured
* @param bw bandwidth
* @param bw WiFi bandwidths include 2.4G bandwidth and 5G bandwidth
*
* @return
* - ESP_OK: succeed
@ -1705,15 +1750,17 @@ esp_err_t esp_wifi_get_protocols(wifi_interface_t ifx, wifi_protocol_bitmap_t *b
* - ESP_ERR_INVALID_ARG: invalid argument
* - others: refer to error codes in esp_err.h
*/
esp_err_t esp_wifi_set_bandwidths(wifi_interface_t ifx, wifi_band_bw_t* bw);
esp_err_t esp_wifi_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t* bw);
/**
* @brief Get the bandwidth of specified interface and specified band
*
* @attention 1. API return false if try to get a interface that is not enable
* @attention 1. The 5G bandwidth can only be read when CONFIG_SOC_WIFI_HE_SUPPORT_5G is enabled.
* @attention 2. When the WiFi band mode is set to 2.4G only, it will not get 5G bandwidth
* @attention 3. When the WiFi band mode is set to 5G only, it will not get 2.4G bandwidth
*
* @param ifx interface to be configured
* @param[out] bw store bandwidth of interface ifx
* @param[out] bw store bandwidths of interface ifx
*
* @return
* - ESP_OK: succeed
@ -1721,7 +1768,7 @@ esp_err_t esp_wifi_set_bandwidths(wifi_interface_t ifx, wifi_band_bw_t* bw);
* - ESP_ERR_WIFI_IF: invalid interface
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_get_bandwidths(wifi_interface_t ifx, wifi_band_bw_t *bw);
esp_err_t esp_wifi_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw);
#ifdef __cplusplus
}

View File

@ -35,7 +35,7 @@ extern "C" {
* - ESP_ERR_WIFI_TWT_FULL: no available flow id
* - ESP_ERR_INVALID_ARG: invalid argument
*/
esp_err_t esp_wifi_sta_itwt_setup(wifi_twt_setup_config_t *setup_config);
esp_err_t esp_wifi_sta_itwt_setup(wifi_itwt_setup_config_t *setup_config);
/**
* @brief Tear down individual TWT agreements
@ -181,7 +181,7 @@ esp_err_t esp_wifi_sta_btwt_setup(wifi_btwt_setup_config_t *config);
esp_err_t esp_wifi_sta_btwt_teardown(uint8_t btwt_id);
/**
* @brief Get number of btwts supported by the connected AP
* @brief Get number of broadcast TWTs supported by the connected AP
*
* @param[out] btwt_number store number of btwts supported by the connected AP
*
@ -197,7 +197,7 @@ esp_err_t esp_wifi_sta_get_btwt_num(uint8_t *btwt_number);
* @brief Get broadcast TWT information
*
* @param[in] btwt_number As input param, it stores max btwt number AP supported.
* @param[in] btwt_info array to hold the btwt information supported by AP
* @param[in] btwt_info array to hold the btwt information supported by AP, and the array size must be at least as large as the BTWT number.
*
* @return
* - ESP_OK: succeed
@ -207,9 +207,9 @@ esp_err_t esp_wifi_sta_get_btwt_num(uint8_t *btwt_number);
esp_err_t esp_wifi_sta_btwt_get_info(uint8_t btwt_number, esp_wifi_btwt_info_t *btwt_info);
/**
* @brief Set wifi TWT config
* @brief Set WiFi TWT config
*
* @param[in] config pointer to the wifi TWT configure structure.
* @param[in] config pointer to the WiFi TWT configure structure.
*
* @return
* - ESP_OK: succeed

View File

@ -120,28 +120,30 @@ typedef struct {
uint8_t btwt_id; /**< When set up an broadcast TWT agreement, the broadcast twt id will be assigned by AP after a successful agreement setup.
broadcast twt id could be specified to a value in the range of [1, 31], but it might be change by AP in the response.
When change TWT parameters of the existing TWT agreement, broadcast twt id should be an existing one. The value range is [1, 31].*/
uint16_t timeout_time_ms; /**< Timeout times of receving setup action frame response, default 5s*/
uint16_t timeout_time_ms; /**< Timeout times of receiving setup action frame response, default 5s*/
} wifi_btwt_setup_config_t;
/**
* @brief TWT setup config
* @brief Individual TWT setup config
*/
typedef struct {
wifi_twt_setup_cmds_t setup_cmd; /**< Indicates the type of TWT command */
uint16_t trigger : 1; /**< 1: a trigger-enabled TWT, 0: a non-trigger-enabled TWT */
uint16_t flow_type : 1; /**< 0: an announced TWT, 1: an unannounced TWT */
uint16_t trigger : 1; /**< 1: a trigger-enabled individual TWT, 0: a non-trigger-enabled individual TWT */
uint16_t flow_type : 1; /**< 0: an announced individual TWT, 1: an unannounced individual TWT */
uint16_t flow_id : 3; /**< When set up an individual TWT agreement, the flow id will be assigned by AP after a successful agreement setup.
flow_id could be specified to a value in the range of [0, 7], but it might be changed by AP in the response.
When change TWT parameters of the existing TWT agreement, flow_id should be an existing one. The value range is [0, 7]. */
uint16_t wake_invl_expn : 5; /**< TWT Wake Interval Exponent. The value range is [0, 31]. */
uint16_t wake_duration_unit : 1; /**< TWT Wake duration unit, 0: 256us 1: TU (TU = 1024us)*/
uint16_t wake_invl_expn : 5; /**< Individual TWT Wake Interval Exponent. The value range is [0, 31]. */
uint16_t wake_duration_unit : 1; /**< Individual TWT Wake duration unit, 0: 256us 1: TU (TU = 1024us)*/
uint16_t reserved : 5; /**< bit: 11.15 reserved */
uint8_t min_wake_dura; /**< Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the TWT requesting STA expects that it needs to be awake. The value range is [1, 255]. */
uint16_t wake_invl_mant; /**< TWT Wake Interval Mantissa. The value range is [1, 65535]. */
uint16_t twt_id; /**< TWT connection id, the value range is [0, 32767]. */
uint8_t min_wake_dura; /**< Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the individual TWT requesting STA expects that it needs to be awake. The value range is [1, 255]. */
uint16_t wake_invl_mant; /**< Individual TWT Wake Interval Mantissa. The value range is [1, 65535]. */
uint16_t twt_id; /**< Individual TWT connection id, the value range is [0, 32767]. */
uint16_t timeout_time_ms; /**< Timeout times of receiving setup action frame response, default 5s*/
} wifi_twt_setup_config_t;
typedef wifi_twt_setup_config_t wifi_itwt_setup_config_t;
/**
* @brief HE SU GI and LTF types
*/
@ -313,14 +315,14 @@ typedef enum {
BTWT_SETUP_TXFAIL, /**< station sends btwt setup request frame fail */
BTWT_SETUP_SUCCESS, /**< station receives btwt setup response frame and setup btwt sucessfully */
BTWT_SETUP_TIMEOUT, /**< timeout of receiving btwt setup response frame */
BTWT_SETUP_FULL, /**< indicate there is no avaliable btwt id */
BTWT_SETUP_FULL, /**< indicate there is no available btwt id */
BTWT_SETUP_INVALID_ARG, /**< indicate invalid argument to setup btwt */
BTWT_SETUP_INTERNAL_ERR, /**< indicate internal error to setup btwt */
} wifi_btwt_setup_status_t;
/** Argument structure for WIFI_EVENT_TWT_SET_UP event */
typedef struct {
wifi_twt_setup_config_t config; /**< itwt setup config, this value is determined by the AP */
wifi_itwt_setup_config_t config; /**< itwt setup config, this value is determined by the AP */
esp_err_t status; /**< itwt setup status, 1: indicate setup success, others : indicate setup fail */
uint8_t reason; /**< itwt setup frame tx fail reason */
uint64_t target_wake_time; /**< TWT SP start time */

View File

@ -291,13 +291,19 @@ typedef enum {
WIFI_PS_MAX_MODEM, /**< Maximum modem power saving. In this mode, interval to receive beacons is determined by the listen_interval parameter in wifi_sta_config_t */
} wifi_ps_type_t;
/** Argument structure for wifi band */
/** Argument structure for WiFi band */
typedef enum {
WIFI_BAND_2G = 1, /* Band is 2.4G */
WIFI_BAND_5G = 2, /* Band is 5G */
WIFI_BAND_2G_5G = 3, /* Band is 2,4G + 5G */
} wifi_band_t;
/** Argument structure for WiFi band mode */
typedef enum {
WIFI_BAND_MODE_2G_ONLY = 1, /* WiFi band mode is 2.4G only */
WIFI_BAND_MODE_5G_ONLY = 2, /* WiFi band mode is 5G only */
WIFI_BAND_MODE_AUTO = 3, /* WiFi band mode is 2.4G + 5G */
} wifi_band_mode_t;
#define WIFI_PROTOCOL_11B 0x1
#define WIFI_PROTOCOL_11G 0x2
#define WIFI_PROTOCOL_11N 0x4
@ -306,11 +312,11 @@ typedef enum {
#define WIFI_PROTOCOL_11AC 0x20
#define WIFI_PROTOCOL_11AX 0x40
/** @brief Description of a WiFi protocol bitmap */
/** @brief Description of a WiFi protocols */
typedef struct {
int ghz_2g_protocol; /**< Represents 2.4 GHz protocol bitmap */
int ghz_5g_protocol; /**< Represents 5 GHz protocol bitmap */
} wifi_protocol_bitmap_t;
uint16_t ghz_2g; /**< Represents 2.4 GHz protocol, support 802.11b or 802.11g or 802.11n or 802.11ax or LR mode */
uint16_t ghz_5g; /**< Represents 5 GHz protocol, support 802.11a or 802.11n or 802.11ac or 802.11ax */
} wifi_protocols_t;
typedef enum {
WIFI_BW_HT20 = 1, /* Bandwidth is HT20 */
@ -326,7 +332,7 @@ typedef enum {
typedef struct {
wifi_bandwidth_t ghz_2g; /* Represents 2.4 GHz bandwidth */
wifi_bandwidth_t ghz_5g; /* Represents 5 GHz bandwidth */
} wifi_band_bw_t;
} wifi_bandwidths_t;
/** Configuration structure for Protected Management Frame */
typedef struct {
@ -354,7 +360,7 @@ typedef struct {
uint8_t ssid[32]; /**< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
uint8_t password[64]; /**< Password of soft-AP. */
uint8_t ssid_len; /**< Optional length of SSID field. */
uint8_t channel; /**< 2G Channel of soft-AP */
uint8_t channel; /**< Channel of soft-AP */
wifi_auth_mode_t authmode; /**< Auth mode of soft-AP. Do not support AUTH_WEP, AUTH_WAPI_PSK and AUTH_OWE in soft-AP mode. When the auth mode is set to WPA2_PSK, WPA2_WPA3_PSK or WPA3_PSK, the pairwise cipher will be overwritten with WIFI_CIPHER_TYPE_CCMP. */
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in */
@ -365,7 +371,6 @@ typedef struct {
bool ftm_responder; /**< Enable FTM Responder mode */
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Configuration for SAE PWE derivation method */
uint8_t channel_5g; /**< 5G Channel of soft-AP */
} wifi_ap_config_t;
#define SAE_H2E_IDENTIFIER_LEN 32
@ -376,7 +381,7 @@ typedef struct {
wifi_scan_method_t scan_method; /**< do all channel scan or fast scan */
bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/
uint8_t bssid[6]; /**< MAC address of target AP*/
uint8_t channel; /**< channel of target AP. For 2G AP, set to 1~13 to scan starting from the specified channel before connecting to AP. For 5G AP, set to 36~177 (36, 40, 44 ... 177) to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/
uint8_t channel; /**< channel of target AP. For 2.4G AP, set to 1~13 to scan starting from the specified channel before connecting to AP. For 5G AP, set to 36~177 (36, 40, 44 ... 177) to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/
uint16_t listen_interval; /**< Listen interval for ESP32 station to receive beacon when WIFI_PS_MAX_MODEM is set. Units: AP beacon intervals. Defaults to 3 if set to 0. */
wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */
wifi_scan_threshold_t threshold; /**< When scan_threshold is set, only APs which have an auth mode that is more secure than the selected auth mode and a signal stronger than the minimum RSSI will be used. */
@ -735,19 +740,19 @@ typedef enum {
WIFI_PHY_RATE_9M = 0x0F, /**< 9 Mbps */
/**< rate table and guard interval information for each MCS rate*/
/*
-----------------------------------------------------------------------------------------------------------
MCS RATE | HT20 | HT40 | HE20 |
WIFI_PHY_RATE_MCS0_LGI | 6.5 Mbps (800ns) | 13.5 Mbps (800ns) | 8.1 Mbps (1600ns) |
WIFI_PHY_RATE_MCS1_LGI | 13 Mbps (800ns) | 27 Mbps (800ns) | 16.3 Mbps (1600ns) |
WIFI_PHY_RATE_MCS2_LGI | 19.5 Mbps (800ns) | 40.5 Mbps (800ns) | 24.4 Mbps (1600ns) |
WIFI_PHY_RATE_MCS3_LGI | 26 Mbps (800ns) | 54 Mbps (800ns) | 32.5 Mbps (1600ns) |
WIFI_PHY_RATE_MCS4_LGI | 39 Mbps (800ns) | 81 Mbps (800ns) | 48.8 Mbps (1600ns) |
WIFI_PHY_RATE_MCS5_LGI | 52 Mbps (800ns) | 108 Mbps (800ns) | 65 Mbps (1600ns) |
WIFI_PHY_RATE_MCS6_LGI | 58.5 Mbps (800ns) | 121.5 Mbps (800ns) | 73.1 Mbps (1600ns) |
WIFI_PHY_RATE_MCS7_LGI | 65 Mbps (800ns) | 135 Mbps (800ns) | 81.3 Mbps (1600ns) |
WIFI_PHY_RATE_MCS8_LGI | ----- | ----- | 97.5 Mbps (1600ns) |
WIFI_PHY_RATE_MCS9_LGI | ----- | ----- | 108.3 Mbps (1600ns) |
-----------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------
MCS RATE | HT20 | HT40 | HE20 | VHT20 |
WIFI_PHY_RATE_MCS0_LGI | 6.5 Mbps (800ns) | 13.5 Mbps (800ns) | 8.1 Mbps (1600ns) | 6.5 Mbps (800ns) |
WIFI_PHY_RATE_MCS1_LGI | 13 Mbps (800ns) | 27 Mbps (800ns) | 16.3 Mbps (1600ns) | 13 Mbps (800ns) |
WIFI_PHY_RATE_MCS2_LGI | 19.5 Mbps (800ns) | 40.5 Mbps (800ns) | 24.4 Mbps (1600ns) | 19.5 Mbps (800ns) |
WIFI_PHY_RATE_MCS3_LGI | 26 Mbps (800ns) | 54 Mbps (800ns) | 32.5 Mbps (1600ns) | 26 Mbps (800ns) |
WIFI_PHY_RATE_MCS4_LGI | 39 Mbps (800ns) | 81 Mbps (800ns) | 48.8 Mbps (1600ns) | 39 Mbps (800ns) |
WIFI_PHY_RATE_MCS5_LGI | 52 Mbps (800ns) | 108 Mbps (800ns) | 65 Mbps (1600ns) | 52 Mbps (800ns) |
WIFI_PHY_RATE_MCS6_LGI | 58.5 Mbps (800ns) | 121.5 Mbps (800ns) | 73.1 Mbps (1600ns) | 58.5 Mbps (800ns) |
WIFI_PHY_RATE_MCS7_LGI | 65 Mbps (800ns) | 135 Mbps (800ns) | 81.3 Mbps (1600ns) | 65 Mbps (800ns) |
WIFI_PHY_RATE_MCS8_LGI | ----- | ----- | 97.5 Mbps (1600ns) | ----- |
WIFI_PHY_RATE_MCS9_LGI | ----- | ----- | 108.3 Mbps (1600ns) | ----- |
-------------------------------------------------------------------------------------------------------------------------------------
*/
WIFI_PHY_RATE_MCS0_LGI = 0x10, /**< MCS0 with long GI */
WIFI_PHY_RATE_MCS1_LGI = 0x11, /**< MCS1 with long GI */
@ -762,19 +767,19 @@ typedef enum {
WIFI_PHY_RATE_MCS9_LGI, /**< MCS9 with long GI */
#endif
/*
-----------------------------------------------------------------------------------------------------------
MCS RATE | HT20 | HT40 | HE20 |
WIFI_PHY_RATE_MCS0_SGI | 7.2 Mbps (400ns) | 15 Mbps (400ns) | 8.6 Mbps (800ns) |
WIFI_PHY_RATE_MCS1_SGI | 14.4 Mbps (400ns) | 30 Mbps (400ns) | 17.2 Mbps (800ns) |
WIFI_PHY_RATE_MCS2_SGI | 21.7 Mbps (400ns) | 45 Mbps (400ns) | 25.8 Mbps (800ns) |
WIFI_PHY_RATE_MCS3_SGI | 28.9 Mbps (400ns) | 60 Mbps (400ns) | 34.4 Mbps (800ns) |
WIFI_PHY_RATE_MCS4_SGI | 43.3 Mbps (400ns) | 90 Mbps (400ns) | 51.6 Mbps (800ns) |
WIFI_PHY_RATE_MCS5_SGI | 57.8 Mbps (400ns) | 120 Mbps (400ns) | 68.8 Mbps (800ns) |
WIFI_PHY_RATE_MCS6_SGI | 65 Mbps (400ns) | 135 Mbps (400ns) | 77.4 Mbps (800ns) |
WIFI_PHY_RATE_MCS7_SGI | 72.2 Mbps (400ns) | 150 Mbps (400ns) | 86 Mbps (800ns) |
WIFI_PHY_RATE_MCS8_SGI | ----- | ----- | 103.2 Mbps (800ns) |
WIFI_PHY_RATE_MCS9_SGI | ----- | ----- | 114.7 Mbps (800ns) |
-----------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------
MCS RATE | HT20 | HT40 | HE20 | VHT20 |
WIFI_PHY_RATE_MCS0_SGI | 7.2 Mbps (400ns) | 15 Mbps (400ns) | 8.6 Mbps (800ns) | 7.2 Mbps (400ns) |
WIFI_PHY_RATE_MCS1_SGI | 14.4 Mbps (400ns) | 30 Mbps (400ns) | 17.2 Mbps (800ns) | 14.4 Mbps (400ns) |
WIFI_PHY_RATE_MCS2_SGI | 21.7 Mbps (400ns) | 45 Mbps (400ns) | 25.8 Mbps (800ns) | 21.7 Mbps (400ns) |
WIFI_PHY_RATE_MCS3_SGI | 28.9 Mbps (400ns) | 60 Mbps (400ns) | 34.4 Mbps (800ns) | 28.9 Mbps (400ns) |
WIFI_PHY_RATE_MCS4_SGI | 43.3 Mbps (400ns) | 90 Mbps (400ns) | 51.6 Mbps (800ns) | 43.3 Mbps (400ns) |
WIFI_PHY_RATE_MCS5_SGI | 57.8 Mbps (400ns) | 120 Mbps (400ns) | 68.8 Mbps (800ns) | 57.8 Mbps (400ns) |
WIFI_PHY_RATE_MCS6_SGI | 65 Mbps (400ns) | 135 Mbps (400ns) | 77.4 Mbps (800ns) | 65 Mbps (400ns) |
WIFI_PHY_RATE_MCS7_SGI | 72.2 Mbps (400ns) | 150 Mbps (400ns) | 86 Mbps (800ns) | 72.2 Mbps (400ns) |
WIFI_PHY_RATE_MCS8_SGI | ----- | ----- | 103.2 Mbps (800ns) | ----- |
WIFI_PHY_RATE_MCS9_SGI | ----- | ----- | 114.7 Mbps (800ns) | ----- |
-------------------------------------------------------------------------------------------------------------------------------------
*/
WIFI_PHY_RATE_MCS0_SGI, /**< MCS0 with short GI */
WIFI_PHY_RATE_MCS1_SGI, /**< MCS1 with short GI */

@ -1 +1 @@
Subproject commit ce181b3e947d3d8495c17b9881930816bb94ed58
Subproject commit 600bbfac047047bb975a9bf8a8e1c78dfc3a72af

View File

@ -5,11 +5,8 @@ components/esp_wifi/test_apps/wifi_connect:
- if: SOC_WIFI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET not in ["esp32", "esp32c3", "esp32s3", "esp32c2"]
reason: leak of runner
reason: lack of runner
components/esp_wifi/test_apps/wifi_function:
disable:
- if: SOC_WIFI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32c5"]
reason: leak of runner

View File

@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest
from pytest_embedded_idf.unity_tester import CaseTester

View File

@ -9,6 +9,7 @@ from pytest_embedded import Dut
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.esp32c5
# @pytest.mark.esp32c2 # esp32c2 are using xtal_26mhz
@pytest.mark.generic
def test_wifi_unit_test(dut: Dut) -> None:

View File

@ -51,10 +51,6 @@ config SOC_USB_SERIAL_JTAG_SUPPORTED
bool
default y
config SOC_PHY_SUPPORTED
bool
default y
config SOC_WIFI_SUPPORTED
bool
default y

View File

@ -31,7 +31,6 @@
#define SOC_ASYNC_MEMCPY_SUPPORTED 1
#define SOC_USB_SERIAL_JTAG_SUPPORTED 1
// #define SOC_TEMP_SENSOR_SUPPORTED 1 // TODO: [ESP32C5] IDF-8727
#define SOC_PHY_SUPPORTED 1
#define SOC_WIFI_SUPPORTED 1
#define SOC_SUPPORTS_SECURE_DL_MODE 1
#define SOC_LP_CORE_SUPPORTED 1
@ -572,7 +571,7 @@
/*------------------------------------ WI-FI CAPS ------------------------------------*/
#define SOC_WIFI_HW_TSF (1) /*!< Support hardware TSF */
#define SOC_WIFI_FTM_SUPPORT (0) /*!< Support FTM */
#define SOC_WIFI_FTM_SUPPORT (0) /*!< Support FTM */ // TODO: [ESP32C5] WIFI-6426
#define SOC_WIFI_GCMP_SUPPORT (1) /*!< Support GCMP(GCMP128 and GCMP256) */
#define SOC_WIFI_WAPI_SUPPORT (1) /*!< Support WAPI */
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */

View File

@ -3,9 +3,6 @@
components/wpa_supplicant/test_apps:
disable:
- if: SOC_WIFI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32c5"]
reason: leak of runner
depends_components:
- esp_wifi
- wpa_supplicant

View File

@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.unity_tester import CaseTester
@ -13,6 +12,7 @@ from pytest_embedded_idf.unity_tester import CaseTester
@pytest.mark.esp32c3
@pytest.mark.esp32c2
@pytest.mark.esp32c6
@pytest.mark.esp32c5
def test_wpa_supplicant_ut(dut: Dut) -> None:
dut.run_all_single_board_cases()

View File

@ -1,9 +1,9 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
# ESP-IDF Blufi Example
This demo shows how to use the *Blufi* to configurate the Wi-Fi connection to AP.
This demo shows how to use the *Blufi* to configure the Wi-Fi connection to AP.
The BluFi for ESP32 is a Wi-Fi network configuration function via Bluetooth channel. It provides a secure protocol to pass Wi-Fi configuration and credentials to the ESP32.
@ -50,7 +50,7 @@ I (708) system_api: read default base MAC address from EFUSE
I (718) wifi:wifi firmware version: 44799ff
I (718) wifi:wifi certification version: v7.0
I (718) wifi:config NVS flash: enabled
I (718) wifi:config nano formating: disabled
I (718) wifi:config nano formatting: disabled
I (728) wifi:Init data frame dynamic rx buffer num: 32
I (728) wifi:Init management frame dynamic rx buffer num: 32
I (738) wifi:Init management short buffer num: 32

View File

@ -0,0 +1,18 @@
# This file was generated using idf.py save-defconfig. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y
CONFIG_BT_ENABLED=y
CONFIG_BT_NIMBLE_BLUFI_ENABLE=y
# CONFIG_BT_GATTC_ENABLE is not set
# CONFIG_BT_BLE_SMP_ENABLE is not set
# CONFIG_BT_BLE_50_FEATURES_SUPPORTED is not set
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
CONFIG_MBEDTLS_DHM_C=y
# The config items for NIMBLE HOST
CONFIG_BT_NIMBLE_ENABLED=y
CONFIG_BT_NIMBLE_ROLE_CENTRAL=n
CONFIG_BT_NIMBLE_ROLE_OBSERVER=n
CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n
CONFIG_BT_NIMBLE_SECURITY_ENABLE=n
CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=n

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
# BLE Peripheral with ICMP Echo-Reply

View File

@ -61,10 +61,6 @@ examples/wifi/power_save:
<<: *wifi_depends_default
disable:
- if: SOC_WIFI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET == "esp32c5"
temporary: true
reason: lack of runners
depends_components:
- esp_driver_uart

View File

@ -119,7 +119,7 @@ static void got_ip_handler(void *arg, esp_event_base_t event_base,
esp_wifi_sta_get_negotiated_phymode(&phymode);
if (phymode == WIFI_PHY_MODE_HE20) {
esp_err_t err = ESP_OK;
wifi_twt_setup_config_t setup_config = {
wifi_itwt_setup_config_t setup_config = {
.setup_cmd = TWT_REQUEST,
.flow_id = 0,
.twt_id = CONFIG_EXAMPLE_ITWT_ID,

View File

@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import pexpect
@ -47,6 +46,7 @@ def _run_test(dut: Dut) -> None:
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
@pytest.mark.esp32c5
@pytest.mark.wifi_ap
def test_wifi_power_save(dut: Dut) -> None:
_run_test(dut)

View File

@ -116,7 +116,7 @@ void app_main(void)
esp_wifi_ap_get_sta_list_with_ip(NULL, NULL);
esp_wifi_sta_itwt_setup_IgnoreAndReturn(ESP_OK);
esp_wifi_sta_itwt_setup((wifi_twt_setup_config_t*) NULL);
esp_wifi_sta_itwt_setup((wifi_itwt_setup_config_t*) NULL);
sc_send_ack_stop_Ignore();
sc_send_ack_stop();

View File

@ -3,6 +3,3 @@
tools/test_apps/peripherals/i2c_wifi:
disable:
- if: SOC_I2C_SUPPORTED != 1 or SOC_WIFI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32c5"]
reason: leak of runner

View File

@ -10,6 +10,7 @@ from pytest_embedded_idf.dut import IdfDut
@pytest.mark.esp32c6
@pytest.mark.esp32s2
@pytest.mark.esp32s3
@pytest.mark.esp32c5
@pytest.mark.generic
def test_i2c_wifi_startup(dut: IdfDut) -> None:
dut.expect_exact('I2C-WIFI test success')

View File

@ -5,7 +5,7 @@ tools/test_apps/phy/phy_multi_init_data_test:
- if: SOC_WIFI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET in ["esp32c5"]
reason: leak of runner
reason: lack of runner
tools/test_apps/phy/phy_tsens:
disable: