First test code for SK6812 LEDs
This commit is contained in:
@@ -61,10 +61,34 @@ static void __init_default_clocks(void)
|
||||
RCC->CIR = 0x00000000;
|
||||
}
|
||||
|
||||
void __setup_clocks(void)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
/* TODO: Switch HSE on for better accuracy */
|
||||
|
||||
/* Switch PLL source to HSI OSC */
|
||||
RCC->CFGR &= ~RCC_CFGR_PLLSRC;
|
||||
|
||||
/* Set PLL multiplication to 12 (4 MHz * 12 = 48 MHz SysClk) */
|
||||
RCC->CFGR |= RCC_CFGR_PLLMUL_3 | RCC_CFGR_PLLMUL_1;
|
||||
|
||||
/* HSI Already running. Switch on PLL */
|
||||
RCC->CR |= RCC_CR_PLLON;
|
||||
|
||||
/* Wait for PLL to be ready */
|
||||
while (!(RCC->CR & RCC_CR_PLLRDY));
|
||||
|
||||
/* Switch System Clock to PLL */
|
||||
tmp = RCC->CFGR;
|
||||
tmp &= ~0x3;
|
||||
tmp |= RCC_CFGR_SW_1;
|
||||
RCC->CFGR = tmp;
|
||||
}
|
||||
|
||||
void __system_init(void)
|
||||
{
|
||||
|
||||
__init_default_clocks();
|
||||
|
||||
__init_default_clocks();
|
||||
__setup_clocks();
|
||||
}
|
||||
|
Reference in New Issue
Block a user