File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef *timer) {
164164 source = HAL_RCC_GetPCLK2Freq ();
165165 // 0b0xx means not divided; 0b100 is divide by 2; 0b101 by 4; 0b110 by 8; 0b111 by 16.
166166 #ifdef STM32H7
167- clk_div = (RCC -> CFGR & RCC_D2CFGR_D2PPRE2 );
167+ clk_div = (RCC -> D2CFGR & RCC_D2CFGR_D2PPRE2 ) >> RCC_D2CFGR_D2PPRE2_Pos ;
168168 #else
169169 clk_div = (RCC -> CFGR & RCC_CFGR_PPRE2 ) >> RCC_CFGR_PPRE2_Pos ;
170170 #endif
@@ -173,7 +173,7 @@ uint32_t stm_peripherals_timer_get_source_freq(TIM_TypeDef *timer) {
173173 source = HAL_RCC_GetPCLK1Freq ();
174174 // 0b0xx means not divided; 0b100 is divide by 2; 0b101 by 4; 0b110 by 8; 0b111 by 16.
175175 #ifdef STM32H7
176- clk_div = (RCC -> CFGR & RCC_D1CFGR_D1PPRE_Msk ) ;
176+ clk_div = (RCC -> D1CFGR & RCC_D1CFGR_D1PPRE ) >> RCC_D1CFGR_D1PPRE_Pos ;
177177 #else
178178 clk_div = (RCC -> CFGR & RCC_CFGR_PPRE1 ) >> RCC_CFGR_PPRE1_Pos ;
179179 #endif
You can’t perform that action at this time.
0 commit comments