mirror of https://github.com/Desuuuu/klipper.git
stm32: Add CCRDY check to stm32g0 adc
The stm32g0 specification states that it is required to wait for the CCRDY flag to be raised after changing the channel configuration. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
3387a9c23d
commit
3796a31959
|
@ -119,7 +119,16 @@ gpio_adc_sample(struct gpio_adc g)
|
||||||
return 0;
|
return 0;
|
||||||
goto need_delay;
|
goto need_delay;
|
||||||
}
|
}
|
||||||
|
#if CONFIG_MACH_STM32G0
|
||||||
|
if (adc->CHSELR != g.chan) {
|
||||||
|
adc->ISR = ADC_ISR_CCRDY;
|
||||||
|
adc->CHSELR = g.chan;
|
||||||
|
while (!(adc->ISR & ADC_ISR_CCRDY))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
#else
|
||||||
adc->CHSELR = g.chan;
|
adc->CHSELR = g.chan;
|
||||||
|
#endif
|
||||||
adc->CR = CR_FLAGS | ADC_CR_ADSTART;
|
adc->CR = CR_FLAGS | ADC_CR_ADSTART;
|
||||||
|
|
||||||
need_delay:
|
need_delay:
|
||||||
|
|
Loading…
Reference in New Issue