Merge pull request #2989 from yexinfu/master

[bsp][stm32][HAL_Drivers]modified stm32 timer_start cant set  HWTIMER_MODE_PERIOD mode
This commit is contained in:
Bernard Xiong 2019-09-04 08:03:28 +08:00 committed by GitHub
commit 03f8762e28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}