adc: no longer support adc2 oneshot mode on esp32c3

Due to HW limitation, we don't support this anymore. On c3, ADC2 under oneshot mode is not stable.

However, you can enable CONFIG_ADC_ONESHOT_FORCE_USE_ADC2_ON_C3 to force use
ADC2.

Refer to errata to know more details:
https://www.espressif.com/sites/default/files/documentation/esp32-c3_errata_en.pdf
This commit is contained in:
Armando
2022-12-16 12:53:04 +08:00
committed by BOT
parent 9b4986dd2c
commit 984ee9dd38
4 changed files with 19 additions and 9 deletions

View File

@@ -536,6 +536,12 @@ esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten)
esp_err_t adc2_get_raw(adc2_channel_t channel, adc_bits_width_t width_bit, int *raw_out)
{
#if !CONFIG_ADC_ONESHOT_FORCE_USE_ADC2_ON_C3
ESP_LOGE(ADC_TAG, "ADC2 is no longer supported, please use ADC1. Search for errata on espressif website for more details. You can enable ADC_ONESHOT_FORCE_USE_ADC2_ON_C3 to force use ADC2");
ESP_LOGE(ADC_TAG, "adc unit not supported");
return ESP_ERR_INVALID_ARG;
#endif
//On ESP32C3, the data width is always 12-bits.
if (width_bit != ADC_WIDTH_BIT_12) {
return ESP_ERR_INVALID_ARG;