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>
This commit is contained in:
Kevin O'Connor 2019-11-27 11:25:17 -05:00
parent fc476f22b6
commit ef2c7cb363
1 changed files with 2 additions and 1 deletions

View File

@ -69,7 +69,8 @@ gpio_adc_setup(uint32_t pin)
uint32_t aticks = 3; // 2.5-3.2us (depending on stm32 chip) uint32_t aticks = 3; // 2.5-3.2us (depending on stm32 chip)
adc->SMPR1 = (aticks | (aticks << 3) | (aticks << 6) | (aticks << 9) adc->SMPR1 = (aticks | (aticks << 3) | (aticks << 6) | (aticks << 9)
| (aticks << 12) | (aticks << 15) | (aticks << 18) | (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) adc->SMPR2 = (aticks | (aticks << 3) | (aticks << 6) | (aticks << 9)
| (aticks << 12) | (aticks << 15) | (aticks << 18) | (aticks << 12) | (aticks << 15) | (aticks << 18)
| (aticks << 21) | (aticks << 24) | (aticks << 27)); | (aticks << 21) | (aticks << 24) | (aticks << 27));