aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-12-24 19:27:04 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-12-24 19:27:04 -0500
commit247cd753e283e70a9949e76d0ba669d99c0eb144 (patch)
treee60fbfea1ef847f10816ee2512b7500090dfcd53 /src
parent9f31a35e7530223d56701fd311655de34fa21dd2 (diff)
downloadkutter-247cd753e283e70a9949e76d0ba669d99c0eb144.tar.gz
kutter-247cd753e283e70a9949e76d0ba669d99c0eb144.tar.xz
kutter-247cd753e283e70a9949e76d0ba669d99c0eb144.zip
stm32: Fix ADC on stm32f042
It seems the stm32f042 chip needs a small delay during ADC enable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r--src/stm32/stm32f0_adc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stm32/stm32f0_adc.c b/src/stm32/stm32f0_adc.c
index 951d5bb1..8f27dce7 100644
--- a/src/stm32/stm32f0_adc.c
+++ b/src/stm32/stm32f0_adc.c
@@ -91,6 +91,7 @@ gpio_adc_setup(uint32_t pin)
;
// Enable ADC
adc->ISR = ADC_ISR_ADRDY;
+ adc->ISR; // Dummy read to make sure write is flushed
adc->CR = CR_FLAGS | ADC_CR_ADEN;
while (!(adc->ISR & ADC_ISR_ADRDY))
;