[bug] fix tim bug

This commit is contained in:
liYony 2022-12-10 12:02:31 +08:00 committed by Man, Jianting (Meco)
parent 4bbfc5fcb8
commit 190eda6ab0
1 changed files with 1 additions and 1 deletions

View File

@ -212,7 +212,7 @@ static void timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state)
#if defined(APBPERIPH_BASE) #if defined(APBPERIPH_BASE)
prescaler_value = (uint32_t)(HAL_RCC_GetPCLK1Freq() * pclk1_doubler / 10000) - 1; prescaler_value = (uint32_t)(HAL_RCC_GetPCLK1Freq() * pclk1_doubler / 10000) - 1;
#elif defined(APB1PERIPH_BASE) || defined(APB2PERIPH_BASE) #elif defined(APB1PERIPH_BASE) || defined(APB2PERIPH_BASE)
if ((rt_uint32_t)htim->Instance >= APB2PERIPH_BASE) if ((rt_uint32_t)tim->Instance >= APB2PERIPH_BASE)
{ {
prescaler_value = (uint32_t)(HAL_RCC_GetPCLK2Freq() * pclk2_doubler / 10000) - 1; prescaler_value = (uint32_t)(HAL_RCC_GetPCLK2Freq() * pclk2_doubler / 10000) - 1;
} }