[bsp][at32]修复由于ADC转换完成标志未清除导致ADC多通道读取时概率性地通道错位

This commit is contained in:
tianshnegming 2024-03-24 02:43:09 +08:00 committed by GitHub
parent 22106bb8de
commit 2cb9d2bc94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -135,8 +135,10 @@ static rt_err_t at32_get_adc_value(struct rt_adc_device *device, rt_int8_t chann
/* adc_x regular channels configuration */ /* adc_x regular channels configuration */
#if defined (SOC_SERIES_AT32F435) || defined (SOC_SERIES_AT32F437) || \ #if defined (SOC_SERIES_AT32F435) || defined (SOC_SERIES_AT32F437) || \
defined (SOC_SERIES_AT32F423) defined (SOC_SERIES_AT32F423)
adc_flag_clear(adc_x, ADC_OCCE_FLAG);
adc_ordinary_channel_set(adc_x, (adc_channel_select_type)channel, 1, ADC_SAMPLETIME_247_5); adc_ordinary_channel_set(adc_x, (adc_channel_select_type)channel, 1, ADC_SAMPLETIME_247_5);
#else #else
adc_flag_clear(adc_x, ADC_CCE_FLAG);
adc_ordinary_channel_set(adc_x, (adc_channel_select_type)channel, 1, ADC_SAMPLETIME_239_5); adc_ordinary_channel_set(adc_x, (adc_channel_select_type)channel, 1, ADC_SAMPLETIME_239_5);
#endif #endif