summaryrefslogtreecommitdiff
path: root/rcc/rcc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rcc/rcc.cpp')
-rw-r--r--rcc/rcc.cpp10
1 files changed, 10 insertions, 0 deletions
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.