stm32/adc: Use IS_CHANNEL_INTERNAL macro to check for internal channels.
@@ -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;
