Page 1 of 1

ESP32S3 ADC one-shot reading sequence

Posted: Thu Dec 08, 2022 2:07 pm
by rtborg
I have an analog input which should be able to measure signal in four ranges, which loosely fit into the attenuation ranges. The application should know what is the expected input signal range, and I want to set the attenuation accordingly.

The one-shot reading sequence is:
1. Install ADC instance with `adc_oneshot_new_unit`
2. Config ADC channel with `adc_oneshot_config_channel`; attenuation is specified here
3. Invoke calibration routine; attenuation is specified here
4. Get a reading with `adc_oneshot_read`
5. Free resources with `adc_oneshot_del_unit`
6. Free calibration data structure with `adc_cali_delete_scheme_curve_fitting`

Should I go through the complete sequence every time I need to change the attenuation setting?