From c298348f285fbfddea5180435c867af1e2b429f6 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Fri, 13 Dec 2024 10:17:26 +0100 Subject: [PATCH] few minorities --- include/clocks.h | 1 - src/clocks.c | 2 +- src/main.c | 9 ++++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/clocks.h b/include/clocks.h index 441b044..9be1104 100644 --- a/include/clocks.h +++ b/include/clocks.h @@ -45,6 +45,5 @@ void clocks_pll_wait_ready(clock_pll_t pll, uint16_t timeout_us); void clocks_system_clock_source(sysclock_source_t source, uint8_t d1cpre, uint8_t d1ppre, uint8_t hpre, uint16_t timeout_us); -uint8_t clocks_system_clock_wait_ready(uint16_t timeout_us); #endif // CLOCKS_H diff --git a/src/clocks.c b/src/clocks.c index cede15c..dfe6e45 100644 --- a/src/clocks.c +++ b/src/clocks.c @@ -82,7 +82,7 @@ void clocks_system_clock_source(sysclock_source_t source, uint8_t d1cpre, uint8_ ((d1cpre & 0xF) << RCC_D1CFGR_D1CPRE_Pos) | ((d1ppre & 0x7) << RCC_D1CFGR_D1PPRE_Pos) | ((hpre & 0xF) << RCC_D1CFGR_HPRE_Pos), - RCC_D1CFGR_D1CPRE | RCC_D1CFGR_D1PPRE | RCC_D1CFGR_HPRE); + RCC_D1CFGR_D1CPRE_Msk | RCC_D1CFGR_D1PPRE_Msk | RCC_D1CFGR_HPRE_Msk); reg_write_bits(&RCC->CFGR, source, RCC_CFGR_SW); while (reg_read_bits_pos(&RCC->CFGR, RCC_CFGR_SWS_Pos, 0x7) != source); } diff --git a/src/main.c b/src/main.c index 6d08e51..8c71d1f 100644 --- a/src/main.c +++ b/src/main.c @@ -15,6 +15,7 @@ #define LED1_PIN 12 /* #define LED2_PIN 13 */ +pin_t wkup; pin_t led1; exti_t exti_wkup; @@ -263,6 +264,7 @@ void main() clocks_enable(CLOCK_HSI48); clocks_wait_ready(CLOCK_HSI48); + // Enable HSE for PLLs clocks_enable(CLOCK_HSE); clocks_wait_ready(CLOCK_HSE); @@ -273,6 +275,12 @@ void main() clocks_pll_enable(CLOCK_PLL2); clocks_pll_wait_ready(CLOCK_PLL2, 300); + /* clocks_pll_configure(CLOCK_PLL1, 1, 25, PLL_SOURCE_HSE, 200, 2, 2, 2); */ + /* clocks_pll_enable(CLOCK_PLL1); */ + /* clocks_pll_wait_ready(CLOCK_PLL1, 300); */ + + /* clocks_system_clock_source(CLOCK_SOURCE_PLL_1_P_CK, 1, 1, 1, 300); */ + fmc_t fmc; init_fmc(&fmc); @@ -289,7 +297,6 @@ void main() pin_toggle(&led1); // pc13 input - wakeup button - pin_t wkup; pin_init(&wkup, GPIOC, 13); pin_into_input(&wkup); -- 2.48.1