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 11f469564f
commit 3aad7271a1
6 changed files with 141 additions and 150 deletions

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?