mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
wifi: add set_xpd_sar override
Wi-Fi enables and disables ADC when exiting and entering sleep mode. Coordinate ADC power state with other modules, using adc_power_acquire and adc_power_release.
This commit is contained in:
parent
a4f81d0bd3
commit
80e7252c13
@ -34,6 +34,7 @@ idf_component_register(SRCS "src/coexist.c"
|
||||
"src/wifi_netif.c"
|
||||
"${idf_target}/esp_adapter.c"
|
||||
INCLUDE_DIRS "include" "${idf_target}/include"
|
||||
PRIV_REQUIRES wpa_supplicant nvs_flash esp_netif driver ${extra_priv_requires}
|
||||
REQUIRES esp_event
|
||||
PRIV_REQUIRES esp_timer esp_pm wpa_supplicant nvs_flash esp_netif ${extra_priv_requires}
|
||||
LDFRAGMENTS "${ldfragments}")
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "esp_wpa.h"
|
||||
#include "esp_netif.h"
|
||||
#include "tcpip_adapter_compatible/tcpip_adapter_compat.h"
|
||||
#include "driver/adc.h"
|
||||
#include "driver/adc2_wifi_private.h"
|
||||
#include "esp_coexist_internal.h"
|
||||
|
||||
@ -56,6 +57,8 @@ uint64_t g_wifi_feature_caps =
|
||||
#endif
|
||||
0;
|
||||
|
||||
static bool s_wifi_adc_xpd_flag;
|
||||
|
||||
static const char* TAG = "wifi_init";
|
||||
|
||||
static void __attribute__((constructor)) s_set_default_wifi_log_level(void)
|
||||
@ -251,3 +254,19 @@ void wifi_apb80m_release(void)
|
||||
esp_pm_lock_release(s_wifi_modem_sleep_lock);
|
||||
}
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
|
||||
/* Coordinate ADC power with other modules. This overrides the function from PHY lib. */
|
||||
void set_xpd_sar(bool en)
|
||||
{
|
||||
if (s_wifi_adc_xpd_flag == en) {
|
||||
/* ignore repeated calls to set_xpd_sar when the state is already correct */
|
||||
return;
|
||||
}
|
||||
|
||||
s_wifi_adc_xpd_flag = en;
|
||||
if (en) {
|
||||
adc_power_acquire();
|
||||
} else {
|
||||
adc_power_release();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user