From ef2c7cb3632f38041099e26752e9207b18fb950f Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 27 Nov 2019 11:25:17 -0500 Subject: [PATCH] stm32: Fix typo in setting of SMPR1 register on stm32f103 Only the stm32f4 has a SMP18 field; it's not present on the stm32f103. Signed-off-by: Kevin O'Connor --- src/stm32/adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/stm32/adc.c b/src/stm32/adc.c index 3998915f..ac769c4f 100644 --- a/src/stm32/adc.c +++ b/src/stm32/adc.c @@ -69,7 +69,8 @@ gpio_adc_setup(uint32_t pin) uint32_t aticks = 3; // 2.5-3.2us (depending on stm32 chip) adc->SMPR1 = (aticks | (aticks << 3) | (aticks << 6) | (aticks << 9) | (aticks << 12) | (aticks << 15) | (aticks << 18) - | (aticks << 21) | (aticks << 24)); + | (aticks << 21) + | (CONFIG_MACH_STM32F4 ? aticks << 24 : 0)); adc->SMPR2 = (aticks | (aticks << 3) | (aticks << 6) | (aticks << 9) | (aticks << 12) | (aticks << 15) | (aticks << 18) | (aticks << 21) | (aticks << 24) | (aticks << 27));