From 8a7b9da76d1f0ce6f39ef2899e2f335d2a0b29a3 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 9 May 2022 12:19:21 -0400 Subject: [stm32 nucleo][f072][f401] support TIM7/TIM11 hardware timer --- bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h | 11 +++++++++++ bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'bsp/stm32/libraries') diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h index ca37509e02..82255b76db 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h @@ -27,6 +27,17 @@ extern "C" { } #endif /* TIM_DEV_INFO_CONFIG */ +#ifdef BSP_USING_TIM7 +#ifndef TIM7_CONFIG +#define TIM7_CONFIG \ + { \ + .tim_handle.Instance = TIM7, \ + .tim_irqn = TIM7_IRQn, \ + .name = "timer7", \ + } +#endif /* TIM7_CONFIG */ +#endif /* BSP_USING_TIM7 */ + #ifdef BSP_USING_TIM14 #ifndef TIM14_CONFIG #define TIM14_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c index 7153540505..c8167995fb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c @@ -599,7 +599,8 @@ static int stm32_hwtimer_init(void) { stm32_hwtimer_obj[i].time_device.info = &_info; stm32_hwtimer_obj[i].time_device.ops = &_ops; - if (rt_device_hwtimer_register(&stm32_hwtimer_obj[i].time_device, stm32_hwtimer_obj[i].name, &stm32_hwtimer_obj[i].tim_handle) == RT_EOK) + if (rt_device_hwtimer_register(&stm32_hwtimer_obj[i].time_device, + stm32_hwtimer_obj[i].name, &stm32_hwtimer_obj[i].tim_handle) == RT_EOK) { LOG_D("%s register success", stm32_hwtimer_obj[i].name); } -- cgit v1.3.1