From c3f6a4e5031154782944de83a15a160af60e08a1 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Mon, 30 Dec 2024 11:48:38 +0100 Subject: [PATCH] Use `RCC_CFGR_SW` helper function to set software clock --- src/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 8129bf2..2479373 100644 --- a/src/main.c +++ b/src/main.c @@ -65,8 +65,7 @@ static void system_clock_init(void) { RCC->CFGR |= (FLASH_ACR_LATENCY_3_WAIT_STATES << FLASH_ACR_LATENCY_BIT); // Use PLL as system clock - RCC->CFGR &= ~(RCC_CFGR_SW_MASK << RCC_CFGR_SW_BIT); - RCC->CFGR |= (RCC_CFGR_SW_PLL << RCC_CFGR_SW_BIT); + RCC->CFGR |= RCC_CFGR_SW(RCC_CFGR_SW_PLL); // Wait indefinitely for PLL clock to be selected // TODO indicate error/timeout somehow?