mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
Merge branch 'bugfix/fix_ulp_adc_regression_v5.0' into 'release/v5.0'
adc_oneshot: move power acquire back to adc_oneshot_new_unit (v5.0) See merge request espressif/esp-idf!24625
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include "esp_private/adc_private.h"
|
#include "esp_private/adc_private.h"
|
||||||
#include "esp_private/adc_share_hw_ctrl.h"
|
#include "esp_private/adc_share_hw_ctrl.h"
|
||||||
#include "esp_private/sar_periph_ctrl.h"
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#include "esp_private/esp_sleep_internal.h"
|
||||||
#include "hal/adc_types.h"
|
#include "hal/adc_types.h"
|
||||||
#include "hal/adc_oneshot_hal.h"
|
#include "hal/adc_oneshot_hal.h"
|
||||||
#include "hal/adc_ll.h"
|
#include "hal/adc_ll.h"
|
||||||
@@ -113,7 +114,11 @@ esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, a
|
|||||||
_lock_release(&s_ctx.mutex);
|
_lock_release(&s_ctx.mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sar_periph_ctrl_adc_oneshot_power_acquire();
|
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);
|
ESP_LOGD(TAG, "new adc unit%"PRId32" is created", unit->unit_id);
|
||||||
*ret_unit = unit;
|
*ret_unit = unit;
|
||||||
@@ -200,6 +205,7 @@ esp_err_t adc_oneshot_read_isr(adc_oneshot_unit_handle_t handle, adc_channel_t c
|
|||||||
esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
|
esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
|
||||||
|
adc_ulp_mode_t ulp_mode = handle->ulp_mode;
|
||||||
bool success_free = s_adc_unit_free(handle->unit_id);
|
bool success_free = s_adc_unit_free(handle->unit_id);
|
||||||
ESP_RETURN_ON_FALSE(success_free, ESP_ERR_NOT_FOUND, TAG, "adc%"PRId32" isn't in use", handle->unit_id + 1);
|
ESP_RETURN_ON_FALSE(success_free, ESP_ERR_NOT_FOUND, TAG, "adc%"PRId32" isn't in use", handle->unit_id + 1);
|
||||||
|
|
||||||
@@ -210,7 +216,11 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
|
|||||||
ESP_LOGD(TAG, "adc unit%"PRId32" is deleted", handle->unit_id);
|
ESP_LOGD(TAG, "adc unit%"PRId32" is deleted", handle->unit_id);
|
||||||
free(handle);
|
free(handle);
|
||||||
|
|
||||||
sar_periph_ctrl_adc_oneshot_power_release();
|
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
|
#if SOC_ADC_DIG_CTRL_SUPPORTED && !SOC_ADC_RTC_CTRL_SUPPORTED
|
||||||
//To free the APB_SARADC periph if needed
|
//To free the APB_SARADC periph if needed
|
||||||
|
Reference in New Issue
Block a user