diff options
author | clearchris <clearchris@hotmail.com> | 2019-11-05 09:08:32 -0600 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2019-11-05 10:08:32 -0500 |
commit | 009d14fc3e2f485a8f07d70afc66f17659d2068f (patch) | |
tree | d9caeaf4074b5b4ab2d2fd78819c74866185d13e /src/stm32/stm32f0.c | |
parent | cf6e8a2eee59ced9dcdfb02295bbaf9559e9975e (diff) | |
download | kutter-009d14fc3e2f485a8f07d70afc66f17659d2068f.tar.gz kutter-009d14fc3e2f485a8f07d70afc66f17659d2068f.tar.xz kutter-009d14fc3e2f485a8f07d70afc66f17659d2068f.zip |
stm32: adc for new stm32f0 common code (#2120)
Derived from stm32/adc.c and stm32f0/adc.c with additional changes.
Tested on Monoprice Mini Delta (malyan) stm32f070xb board.
Signed-off-by: Chris Lombardi <clearchris@hotmail.com>
Diffstat (limited to 'src/stm32/stm32f0.c')
-rw-r--r-- | src/stm32/stm32f0.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/stm32/stm32f0.c b/src/stm32/stm32f0.c index 26a3512c..f9eabeab 100644 --- a/src/stm32/stm32f0.c +++ b/src/stm32/stm32f0.c @@ -156,6 +156,16 @@ hsi48_setup(void) #endif } +// Enable high speed internal 14Mhz clock for ADC +static void +hsi14_setup(void) +{ + // Enable HSI14 for ADC + RCC->CR2 = RCC_CR2_HSI14ON; + while (!(RCC->CR2 & RCC_CR2_HSI14RDY)) + ; +} + // Main entry point - called from armcm_boot.c:ResetHandler() void armcm_main(void) @@ -179,6 +189,9 @@ armcm_main(void) else pll_setup(); + // Turn on hsi14 oscillator for ADC + hsi14_setup(); + // Support alternate USB pins on stm32f042 #ifdef SYSCFG_CFGR1_PA11_PA12_RMP if (CONFIG_STM32F042_USB_PIN_SWAP) { |