drivers: adc: stm32h7 adc driver has a range for oversampling ratio

On the stm32H7 family, there are ADC which have Oversampling ratio
of 10 bits OSVR[9:0] in the CFGR2 register. It means that oversampling
512x or 1024x are possible.
Other values are not allowed as the oversampling field of the struct
adc_sequence (adc.h) is 2^oversampling.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
Francois Ramu 2021-09-17 11:45:30 +02:00 committed by Christopher Friedt
commit 3ee3a46b6a

View file

@ -527,6 +527,15 @@ static int start_read(const struct device *dev,
case 8:
adc_stm32_oversampling(adc, 8, LL_ADC_OVS_SHIFT_RIGHT_8);
break;
#if defined(CONFIG_SOC_SERIES_STM32H7X)
/* stm32 H7 ADC1 & 2 have oversampling ratio from 1..1024 */
case 9:
adc_stm32_oversampling(adc, 9, LL_ADC_OVS_SHIFT_RIGHT_9);
break;
case 10:
adc_stm32_oversampling(adc, 10, LL_ADC_OVS_SHIFT_RIGHT_10);
break;
#endif /* CONFIG_SOC_SERIES_STM32H7X */
default:
LOG_ERR("Invalid oversampling");
LL_ADC_Enable(adc);