bug fix: the value of timer auto reload should be (val-1)

This commit is contained in:
ericQiang 2019-09-09 22:22:29 +08:00
parent 4ba5fe5ab5
commit ee668cce81
1 changed files with 1 additions and 1 deletions

View File

@ -228,7 +228,7 @@ static rt_err_t timer_start(rt_hwtimer_t *timer, rt_uint32_t t, rt_hwtimer_mode_
tim = (TIM_HandleTypeDef *)timer->parent.user_data; tim = (TIM_HandleTypeDef *)timer->parent.user_data;
/* set tim cnt */ /* set tim cnt */
__HAL_TIM_SET_AUTORELOAD(tim, t); __HAL_TIM_SET_AUTORELOAD(tim, t - 1);
if (opmode == HWTIMER_MODE_ONESHOT) if (opmode == HWTIMER_MODE_ONESHOT)
{ {