diff --git a/components/esp_adc/adc_continuous.c b/components/esp_adc/adc_continuous.c index 4f220bd6a5..8e609d73b6 100644 --- a/components/esp_adc/adc_continuous.c +++ b/components/esp_adc/adc_continuous.c @@ -264,9 +264,11 @@ esp_err_t adc_continuous_start(adc_continuous_handle_t handle) adc_ll_reset_register(); } +#if CONFIG_PM_ENABLE if (handle->pm_lock) { ESP_RETURN_ON_ERROR(esp_pm_lock_acquire(handle->pm_lock), ADC_TAG, "acquire pm_lock failed"); } +#endif handle->fsm = ADC_FSM_STARTED; sar_periph_ctrl_adc_continuous_power_acquire(); @@ -369,10 +371,12 @@ esp_err_t adc_continuous_stop(adc_continuous_handle_t handle) } sar_periph_ctrl_adc_continuous_power_release(); +#if CONFIG_PM_ENABLE //release power manager lock if (handle->pm_lock) { ESP_RETURN_ON_ERROR(esp_pm_lock_release(handle->pm_lock), ADC_TAG, "release pm_lock failed"); } +#endif ANALOG_CLOCK_DISABLE(); @@ -422,9 +426,11 @@ esp_err_t adc_continuous_deinit(adc_continuous_handle_t handle) free(handle->ringbuf_struct); } +#if CONFIG_PM_ENABLE if (handle->pm_lock) { esp_pm_lock_delete(handle->pm_lock); } +#endif free(handle->rx_dma_buf); free(handle->hal.rx_desc); diff --git a/components/esp_adc/adc_continuous_internal.h b/components/esp_adc/adc_continuous_internal.h index a2fb28dfac..55f0cdc4df 100644 --- a/components/esp_adc/adc_continuous_internal.h +++ b/components/esp_adc/adc_continuous_internal.h @@ -89,7 +89,9 @@ struct adc_continuous_ctx_t { adc_hal_digi_ctrlr_cfg_t hal_digi_ctrlr_cfg; //Hal digital controller configuration adc_continuous_evt_cbs_t cbs; //Callbacks void *user_data; //User context +#if CONFIG_PM_ENABLE esp_pm_lock_handle_t pm_lock; //For power management +#endif struct { uint32_t flush_pool: 1; //Flush the internal pool when the pool is full. With this flag, the `on_pool_ovf` event will not happen. } flags;