fix(adc): fix adc oneshot error after continuous

closes https://github.com/espressif/esp-idf/issues/14506
This commit is contained in:
gaoxu 2024-12-31 11:37:20 +08:00 committed by Gao Xu
parent 0974d66680
commit 84df38aab9
2 changed files with 8 additions and 0 deletions

View File

@ -243,6 +243,10 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
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);
#if ADC_LL_POWER_MANAGE_SUPPORTED
adc_ll_set_power_manage(handle->unit_id, ADC_LL_POWER_SW_OFF);
#endif
_lock_acquire(&s_ctx.mutex);
s_ctx.units[handle->unit_id] = NULL;
_lock_release(&s_ctx.mutex);

View File

@ -58,6 +58,10 @@ void adc_oneshot_hal_setup(adc_oneshot_hal_ctx_t *hal, adc_channel_t chan)
s_disable_dac(hal, chan);
#endif
#if ADC_LL_POWER_MANAGE_SUPPORTED
adc_ll_set_power_manage(unit, ADC_LL_POWER_SW_ON);
#endif
#if SOC_ADC_DIG_CTRL_SUPPORTED && !SOC_ADC_RTC_CTRL_SUPPORTED
adc_ll_digi_clk_sel(hal->clk_src);
adc_ll_digi_controller_clk_div(ADC_LL_CLKM_DIV_NUM_DEFAULT, ADC_LL_CLKM_DIV_A_DEFAULT, ADC_LL_CLKM_DIV_B_DEFAULT);