|
@ -10,16 +10,20 @@ static encoder_t m_uarts[] = { |
|
|
{&driven_encoder_gear, TIM_CHANNEL_1 | TIM_CHANNEL_2} // 从动编码器 |
|
|
{&driven_encoder_gear, TIM_CHANNEL_1 | TIM_CHANNEL_2} // 从动编码器 |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
void encoder_start(void) |
|
|
|
|
|
|
|
|
void encoder_all_start(void) |
|
|
{ |
|
|
{ |
|
|
/* 不开启会导致程序无法启动,原因未知 */ |
|
|
/* 不开启会导致程序无法启动,原因未知 */ |
|
|
HAL_TIM_Encoder_Start(&camera_encoder, TIM_CHANNEL_1 | TIM_CHANNEL_2); |
|
|
|
|
|
HAL_TIM_Encoder_Start(&driven_encoder_gear, TIM_CHANNEL_1 | TIM_CHANNEL_2); |
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < (sizeof(m_uarts) / sizeof(encoder_t)); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
HAL_TIM_Encoder_Start(m_uarts[i].tim_handler, m_uarts[i].tim_channel); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
void encoder_stop(void) |
|
|
|
|
|
|
|
|
void encoder_all_stop(void) |
|
|
{ |
|
|
{ |
|
|
HAL_TIM_Encoder_Stop(&camera_encoder, TIM_CHANNEL_1 | TIM_CHANNEL_2); |
|
|
|
|
|
HAL_TIM_Encoder_Stop(&driven_encoder_gear, TIM_CHANNEL_1 | TIM_CHANNEL_2); |
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < (sizeof(m_uarts) / sizeof(encoder_t)); i++) |
|
|
|
|
|
{ |
|
|
|
|
|
HAL_TIM_Encoder_Stop(m_uarts[i].tim_handler, m_uarts[i].tim_channel); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void encoder_read_printf(void) |
|
|
void encoder_read_printf(void) |
|
|