Use RCC_CFGR_SW helper function to set software clock

This commit is contained in:
Alexander Heldt
2024-12-30 11:48:38 +01:00
parent f44ddf645b
commit c3f6a4e503

View File

@@ -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?