only power used peripherals

This commit is contained in:
King Kévin 2022-10-19 13:55:53 +02:00
parent ae2711366f
commit d66bdff1d5
1 changed files with 3 additions and 1 deletions

4
main.c
View File

@ -297,7 +297,9 @@ void main(void)
CLK->CKDIVR.fields.CPUDIV = CLK_CKDIVR_CPUDIV_DIV0; // don't divide CPU frequency to 16 MHz
while (!CLK->ICKR.fields.HSIRDY); // wait for internal oscillator to be ready
// TODO only enable clock for peripherals used (PCG)
// only power used peripherals
CLK_PCKENR1 = CLK_PCKENR1_UART1234 | CLK_PCKENR1_TIM1 | CLK_PCKENR1_TIM25 | CLK_PCKENR1_TIM46;
CLK_PCKENR2 = 0;
// configure option bytes
// disable DATA (e.g. option byte) write protection