mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 20:54:24 +00: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:

committed by
Cao Sen Miao

parent
a4f81d0bd3
commit
80e7252c13
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user