Use RCC_CFGR_SW helper function to set software clock
This commit is contained in:
@@ -65,8 +65,7 @@ static void system_clock_init(void) {
|
|||||||
RCC->CFGR |= (FLASH_ACR_LATENCY_3_WAIT_STATES << FLASH_ACR_LATENCY_BIT);
|
RCC->CFGR |= (FLASH_ACR_LATENCY_3_WAIT_STATES << FLASH_ACR_LATENCY_BIT);
|
||||||
|
|
||||||
// Use PLL as system clock
|
// Use PLL as system clock
|
||||||
RCC->CFGR &= ~(RCC_CFGR_SW_MASK << RCC_CFGR_SW_BIT);
|
RCC->CFGR |= RCC_CFGR_SW(RCC_CFGR_SW_PLL);
|
||||||
RCC->CFGR |= (RCC_CFGR_SW_PLL << RCC_CFGR_SW_BIT);
|
|
||||||
|
|
||||||
// Wait indefinitely for PLL clock to be selected
|
// Wait indefinitely for PLL clock to be selected
|
||||||
// TODO indicate error/timeout somehow?
|
// TODO indicate error/timeout somehow?
|
||||||
|
|||||||
Reference in New Issue
Block a user