Merge branch 'refactor/s_adc_tsen_enabled_logic' into 'master'

refactor(adc): maintain s_adc_tsen_enabled in adc driver

See merge request espressif/esp-idf!24627
This commit is contained in:
Armando (Dou Yiwen) 2023-07-11 18:15:49 +08:00
commit 9b17cce08c
2 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@
#include "esp_private/adc_private.h"
#include "esp_private/adc_share_hw_ctrl.h"
#include "esp_private/sar_periph_ctrl.h"
#include "esp_private/esp_sleep_internal.h"
#include "hal/adc_types.h"
#include "hal/adc_oneshot_hal.h"
#include "hal/adc_ll.h"
@ -124,6 +125,8 @@ esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, a
if (init_config->ulp_mode == ADC_ULP_MODE_DISABLE) {
sar_periph_ctrl_adc_oneshot_power_acquire();
} else {
esp_sleep_enable_adc_tsens_monitor(true);
}
ESP_LOGD(TAG, "new adc unit%"PRId32" is created", unit->unit_id);
@ -223,6 +226,8 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
if (ulp_mode == ADC_ULP_MODE_DISABLE) {
sar_periph_ctrl_adc_oneshot_power_release();
} else {
esp_sleep_enable_adc_tsens_monitor(false);
}
#if SOC_ADC_DIG_CTRL_SUPPORTED && !SOC_ADC_RTC_CTRL_SUPPORTED

View File

@ -52,8 +52,6 @@ esp_err_t ulp_adc_init(const ulp_adc_cfg_t *cfg)
adc_set_hw_calibration_code(cfg->adc_n, cfg->atten);
#endif
esp_sleep_enable_adc_tsens_monitor(true);
err:
return ret;
}