From 6572616a6b4bded686a22377d839cef7506de24d Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Tue, 19 Mar 2019 12:56:52 +0100 Subject: Added STM32F042 support. --- rcc/rcc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rcc/rcc.cpp') diff --git a/rcc/rcc.cpp b/rcc/rcc.cpp index aa9147a..65faf33 100644 --- a/rcc/rcc.cpp +++ b/rcc/rcc.cpp @@ -48,6 +48,16 @@ void rcc_init() { // Set APB2 prescaler to /2. RCC.CFGR |= 4 << 13; + #elif defined(STM32F0) + + // Enable HSI48. + RCC.CR2 |= 1 << 16; // HSI48ON + while(!(RCC.CR2 & (1 << 17))); // HSI48RDY + + // Switch to HSI48. + RCC.CFGR |= 3 << 0; // SW = HSI48 + while((RCC.CFGR & (3 << 2)) != (3 << 2)); // SWS = HSI48 + #elif defined(STM32L0) // Enable HSI16. -- cgit v1.2.3