aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-11-27 11:25:17 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-11-27 11:26:17 -0500
commitef2c7cb3632f38041099e26752e9207b18fb950f (patch)
treee0d69caf8c73c5fd32d690261e4199ae2a503663
parentfc476f22b66c81cb57c161ae843cc434bdeabe26 (diff)
downloadkutter-ef2c7cb3632f38041099e26752e9207b18fb950f.tar.gz
kutter-ef2c7cb3632f38041099e26752e9207b18fb950f.tar.xz
kutter-ef2c7cb3632f38041099e26752e9207b18fb950f.zip
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 <kevin@koconnor.net>
-rw-r--r--src/stm32/adc.c3
1 files changed, 2 insertions, 1 deletions
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));