/* Function to configure the oversampling ratio and shift. It is basically a wrapper over LL_ADC_SetOverSamplingRatioShift() which in addition stops the ADC if needed.  */
static void adc_stm32_oversampling_ratioshift(ADC_TypeDef *adc, uint32_t ratio, uint32_t shift)
/* Function to configure the oversampling ratio and shift. It is basically a wrapper over LL_ADC_SetOverSamplingRatioShift() which in addition stops the ADC if needed.  */
static void adc_stm32_oversampling_ratioshift(ADC_TypeDef *adc, uint32_t ratio, uint32_t shift)
{
	if ((LL_ADC_GetOverSamplingRatio(adc) == ratio)
	    && (LL_ADC_GetOverSamplingShift(adc) == shift)) {
		return;
	}
	adc_stm32_disable(adc);
	LL_ADC_ConfigOverSamplingRatioShift(adc, ratio, shift);
}