提交 560a2120 编写于 作者: B bzrobotics 提交者: mysterywolf

FIX: [bsp][stm32] pulse_encoder driver did not handle TIM overflow

上级 c17d5d50
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册