feat: 添加 PID 控制器及霍尔传感器转速获取功能

This commit is contained in:
2026-04-04 00:44:37 +08:00
parent e382b06b03
commit a8c97567c8
7 changed files with 230 additions and 11 deletions

View File

@@ -52,6 +52,17 @@ void hall_pulse_callback(uint16_t GPIO_Pin)
// return 0;
// }
/**
* @brief 获取当前实时转速 (RPM)
*/
float hall_get_speed(motor_id_t motor_id)
{
if (motor_id < MOTOR_COUNT) {
return sensors[motor_id].speed_rpm;
}
return 0.0f;
}
// /**
// * @brief 重置霍尔传感器计数值
// */