stm32/adc: Use IS_CHANNEL_INTERNAL macro to check for internal channels.

This commit is contained in:
iabdalkader 2019-10-11 22:36:58 +02:00 committed by Damien George
parent d523a377d1
commit 4cee42d864

View File

@ -329,9 +329,7 @@ STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel)
#elif defined(STM32F4) || defined(STM32F7)
sConfig.SamplingTime = ADC_SAMPLETIME_15CYCLES;
#elif defined(STM32H7)
if (channel == ADC_CHANNEL_VREFINT
|| channel == ADC_CHANNEL_TEMPSENSOR
|| channel == ADC_CHANNEL_VBAT) {
if (__HAL_ADC_IS_CHANNEL_INTERNAL(channel)) {
sConfig.SamplingTime = ADC_SAMPLETIME_387CYCLES_5;
} else {
sConfig.SamplingTime = ADC_SAMPLETIME_8CYCLES_5;
@ -341,9 +339,7 @@ STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel)
sConfig.OffsetRightShift = DISABLE;
sConfig.OffsetSignedSaturation = DISABLE;
#elif defined(STM32L4)
if (channel == ADC_CHANNEL_VREFINT
|| channel == ADC_CHANNEL_TEMPSENSOR
|| channel == ADC_CHANNEL_VBAT) {
if (__HAL_ADC_IS_CHANNEL_INTERNAL(channel)) {
sConfig.SamplingTime = ADC_SAMPLETIME_247CYCLES_5;
} else {
sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5;