mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-20 05:07:53 -06:00
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>
This commit is contained in:
parent
cf6e8a2eee
commit
009d14fc3e
4 changed files with 144 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue