forked from espressif/esp-idf
fix(adc): only call esp_pm APIs when CONFIG_PM_ENABLE is enabled
This commit is contained in:
@@ -264,9 +264,11 @@ esp_err_t adc_continuous_start(adc_continuous_handle_t handle)
|
|||||||
adc_ll_reset_register();
|
adc_ll_reset_register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_PM_ENABLE
|
||||||
if (handle->pm_lock) {
|
if (handle->pm_lock) {
|
||||||
ESP_RETURN_ON_ERROR(esp_pm_lock_acquire(handle->pm_lock), ADC_TAG, "acquire pm_lock failed");
|
ESP_RETURN_ON_ERROR(esp_pm_lock_acquire(handle->pm_lock), ADC_TAG, "acquire pm_lock failed");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
handle->fsm = ADC_FSM_STARTED;
|
handle->fsm = ADC_FSM_STARTED;
|
||||||
sar_periph_ctrl_adc_continuous_power_acquire();
|
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();
|
sar_periph_ctrl_adc_continuous_power_release();
|
||||||
|
|
||||||
|
#if CONFIG_PM_ENABLE
|
||||||
//release power manager lock
|
//release power manager lock
|
||||||
if (handle->pm_lock) {
|
if (handle->pm_lock) {
|
||||||
ESP_RETURN_ON_ERROR(esp_pm_lock_release(handle->pm_lock), ADC_TAG, "release pm_lock failed");
|
ESP_RETURN_ON_ERROR(esp_pm_lock_release(handle->pm_lock), ADC_TAG, "release pm_lock failed");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ANALOG_CLOCK_DISABLE();
|
ANALOG_CLOCK_DISABLE();
|
||||||
|
|
||||||
@@ -422,9 +426,11 @@ esp_err_t adc_continuous_deinit(adc_continuous_handle_t handle)
|
|||||||
free(handle->ringbuf_struct);
|
free(handle->ringbuf_struct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_PM_ENABLE
|
||||||
if (handle->pm_lock) {
|
if (handle->pm_lock) {
|
||||||
esp_pm_lock_delete(handle->pm_lock);
|
esp_pm_lock_delete(handle->pm_lock);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
free(handle->rx_dma_buf);
|
free(handle->rx_dma_buf);
|
||||||
free(handle->hal.rx_desc);
|
free(handle->hal.rx_desc);
|
||||||
|
@@ -89,7 +89,9 @@ struct adc_continuous_ctx_t {
|
|||||||
adc_hal_digi_ctrlr_cfg_t hal_digi_ctrlr_cfg; //Hal digital controller configuration
|
adc_hal_digi_ctrlr_cfg_t hal_digi_ctrlr_cfg; //Hal digital controller configuration
|
||||||
adc_continuous_evt_cbs_t cbs; //Callbacks
|
adc_continuous_evt_cbs_t cbs; //Callbacks
|
||||||
void *user_data; //User context
|
void *user_data; //User context
|
||||||
|
#if CONFIG_PM_ENABLE
|
||||||
esp_pm_lock_handle_t pm_lock; //For power management
|
esp_pm_lock_handle_t pm_lock; //For power management
|
||||||
|
#endif
|
||||||
struct {
|
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.
|
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;
|
} flags;
|
||||||
|
Reference in New Issue
Block a user