summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexinfu <[email protected]>2019-08-23 07:45:45 +0800
committeryexinfu <[email protected]>2019-08-23 07:45:45 +0800
commit0c1a12afd8a70e98cc7b910bd8c7854167a3251c (patch)
treec9e9f8adfd6606776020bda91b00949b40a785bb
parent200f3d4480a7de9165c6eb3ad36ffecb7d12d60a (diff)
修复stm32 timer_start函数不能设置HWTIMER_MODE_PERIOD模式
修复timer_start函数注释:将TIM2改为TIM更合理
-rw-r--r--bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c8
1 files 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;
}