How to pause ADC Continuous Mode reads ?

nomaski
Posts: 1
Joined: Tue Apr 23, 2024 9:38 pm

How to pause ADC Continuous Mode reads ?

Postby nomaski » 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:
  1. esp_err_t adc_continuous_pause(adc_continuous_handle_t handle) {
  2.  
  3.     // Stop ADC hardware without deinitializing
  4.     adc_hal_digi_stop(&handle->hal);
  5.  
  6.     // Disable ADC end of conversion interrupt
  7.     adc_hal_digi_dis_intr(&handle->hal, ADC_HAL_DMA_INTR_MASK);
  8.  
  9.     return ESP_OK;
  10. }

And then:
  1. esp_err_t adc_continuous_resume(adc_continuous_handle_t handle) {
  2.     if (handle == NULL || handle->fsm != ADC_FSM_PAUSED) {  // Assuming FSM_PAUSED state is added
  3.         return ESP_ERR_INVALID_STATE;
  4.     }
  5.  
  6.     // Re-enable ADC end of conversion interrupt
  7.     adc_hal_digi_en_intr(&handle->hal, ADC_HAL_DMA_INTR_MASK);
  8.  
  9.     // Start ADC hardware without reinitializing
  10.     adc_hal_digi_start(&handle->hal);
  11.  
  12.     return ESP_OK;
  13. }
Any thoughts/ideas suggestions on this approach??

thanks!

Who is online

Users browsing this forum: No registered users and 25 guests