How to pause ADC Continuous Mode reads ?
Posted: Tue Apr 23, 2024 9:59 pm
Hi - I would like to pause ADC reads into DMA for 100 microseconds or so during an I2C peripheral read due I2C clock noise that's showing up on the ADC signal .. and then re-enable the reads after the I2C transfer is complete.
So I'm essentially looking to create adc_continuous_pause/resume() functions .. something like:
And then:
Any thoughts/ideas suggestions on this approach??
thanks!
So I'm essentially looking to create adc_continuous_pause/resume() functions .. something like:
Code: Untitled.c Select all
esp_err_t adc_continuous_pause(adc_continuous_handle_t handle) {
// Stop ADC hardware without deinitializing
adc_hal_digi_stop(&handle->hal);
// Disable ADC end of conversion interrupt
adc_hal_digi_dis_intr(&handle->hal, ADC_HAL_DMA_INTR_MASK);
return ESP_OK;
}And then:
Code: Untitled.c Select all
esp_err_t adc_continuous_resume(adc_continuous_handle_t handle) {
if (handle == NULL || handle->fsm != ADC_FSM_PAUSED) { // Assuming FSM_PAUSED state is added
return ESP_ERR_INVALID_STATE;
}
// Re-enable ADC end of conversion interrupt
adc_hal_digi_en_intr(&handle->hal, ADC_HAL_DMA_INTR_MASK);
// Start ADC hardware without reinitializing
adc_hal_digi_start(&handle->hal);
return ESP_OK;
}thanks!