FIX: [bsp][stm32] pulse_encoder driver did not handle TIM overflow
This commit is contained in:
parent
c17d5d509f
commit
560a21207e
|
@ -157,10 +157,12 @@ rt_err_t pulse_encoder_control(struct rt_pulse_encoder_device *pulse_encoder, rt
|
|||
switch (cmd)
|
||||
{
|
||||
case PULSE_ENCODER_CMD_ENABLE:
|
||||
__HAL_TIM_ENABLE_IT(&stm32_device->tim_handler, TIM_IT_UPDATE);
|
||||
HAL_TIM_Encoder_Start(&stm32_device->tim_handler, TIM_CHANNEL_ALL);
|
||||
HAL_TIM_Encoder_Start_IT(&stm32_device->tim_handler, TIM_CHANNEL_ALL);
|
||||
break;
|
||||
case PULSE_ENCODER_CMD_DISABLE:
|
||||
__HAL_TIM_DISABLE_IT(&stm32_device->tim_handler, TIM_IT_UPDATE);
|
||||
HAL_TIM_Encoder_Stop(&stm32_device->tim_handler, TIM_CHANNEL_ALL);
|
||||
HAL_TIM_Encoder_Stop_IT(&stm32_device->tim_handler, TIM_CHANNEL_ALL);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue