add get and set wifi maximum transmit power API

This commit is contained in:
XiaXiaotian 2017-07-25 15:22:18 +08:00
parent a31736990c
commit 1c4f7f2081
2 changed files with 65 additions and 1 deletions

View file

@ -773,6 +773,70 @@ typedef void (*esp_vendor_ie_cb_t) (void *ctx, wifi_vendor_ie_type_t type, const
*/
esp_err_t esp_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx);
/**
* @brief Set maximum WiFi transmiting power
*
* @attention WiFi transmiting power is divided to six levels in phy init data.
* Level0 represents highest transmiting power and level5 represents lowest
* transmiting power. Packets of different rates are transmitted in
* different powers according to the configuration in phy init data.
* This API only sets maximum WiFi transmiting power. If this API is called,
* the transmiting power of every packet will be less than or equal to the
* value set by this API. If this API is not called, the value of maximum
* transmitting power set in phy_init_data.bin or menuconfig (depend on
* whether to use phy init data in partition or not) will be used. Default
* value is level0. Values passed in power are mapped to transmit power
* levels as follows:
* - [78, 127]: level0
* - [76, 77]: level1
* - [74, 75]: level2
* - [68, 73]: level3
* - [60, 67]: level4
* - [52, 59]: level5
* - [44, 51]: level5 - 2dBm
* - [34, 43]: level5 - 4.5dBm
* - [28, 33]: level5 - 6dBm
* - [20, 27]: level5 - 8dBm
* - [8, 19]: level5 - 11dBm
* - [-128, 7]: level5 - 14dBm
*
* @param power Maximum WiFi transmiting power.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
*/
esp_err_t esp_wifi_set_max_tx_power(int8_t power);
/**
* @brief Get maximum WiFi transmiting power
*
* @attention This API gets maximum WiFi transmiting power. Values got
* from power are mapped to transmit power levels as follows:
* - 78: 19.5dBm
* - 76: 19dBm
* - 74: 18.5dBm
* - 68: 17dBm
* - 60: 15dBm
* - 52: 13dBm
* - 44: 11dBm
* - 34: 8.5dBm
* - 28: 7dBm
* - 20: 5dBm
* - 8: 2dBm
* - -4: -1dBm
*
* @param power Maximum WiFi transmiting power.
*
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_START: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_ARG: invalid argument
*/
esp_err_t esp_wifi_get_max_tx_power(int8_t *power);
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit 7084133a855f9f818904f6eae885f33af52710e2
Subproject commit 57b3072bd3fd2f7759225d8407443e9e983520ae