1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

Merge pull request #4934 from jflyper/_bfdev-adc-internal-followup-to-2926

Internal ADC Enable scan conversion on main ADC even for channelCount = 1 case
This commit is contained in:
Michael Keller 2018-01-11 18:31:01 +13:00 committed by GitHub
commit ba526e323f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,8 +114,14 @@ void adcInitDevice(ADC_TypeDef *adcdev, int channelCount)
ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_InitStructure.ADC_NbrOfConversion = channelCount;
ADC_InitStructure.ADC_ScanConvMode = channelCount > 1 ? ENABLE : DISABLE; // 1=scan more that one channel in group
// Multiple injected channel seems to require scan conversion mode to be
// enabled even if main (non-injected) channel count is 1.
#ifdef USE_ADC_INTERNAL
ADC_InitStructure.ADC_ScanConvMode = ENABLE;
#else
ADC_InitStructure.ADC_ScanConvMode = channelCount > 1 ? ENABLE : DISABLE; // 1=scan more that one channel in group
#endif
ADC_Init(adcdev, &ADC_InitStructure);
}