From 0c1a12afd8a70e98cc7b910bd8c7854167a3251c Mon Sep 17 00:00:00 2001 From: yexinfu Date: Fri, 23 Aug 2019 07:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dstm32=20timer=5Fstart?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=B8=8D=E8=83=BD=E8=AE=BE=E7=BD=AEHWTIMER?= =?UTF-8?q?=5FMODE=5FPERIOD=E6=A8=A1=E5=BC=8F=20=E4=BF=AE=E5=A4=8Dtimer=5F?= =?UTF-8?q?start=E5=87=BD=E6=95=B0=E6=B3=A8=E9=87=8A=EF=BC=9A=E5=B0=86TIM2?= =?UTF-8?q?=E6=94=B9=E4=B8=BATIM=E6=9B=B4=E5=90=88=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c index 085674d3c5..24e91cd690 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c @@ -235,11 +235,15 @@ static rt_err_t timer_start(rt_hwtimer_t *timer, rt_uint32_t t, rt_hwtimer_mode_ /* set timer to single mode */ tim->Instance->CR1 |= TIM_OPMODE_SINGLE; } - + else + { + tim->Instance->CR1 &= (~TIM_OPMODE_SINGLE); + } + /* start timer */ if (HAL_TIM_Base_Start_IT(tim) != HAL_OK) { - LOG_E("TIM2 start failed"); + LOG_E("TIM start failed"); result = -RT_ERROR; }