mirror of
https://github.com/goldenfishs/MRobot.git
synced 2025-09-14 12:54:33 +08:00
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
/*
|
|
电机通用函数
|
|
*/
|
|
|
|
/* Includes ----------------------------------------------------------------- */
|
|
#include "motor.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
/* Private define ----------------------------------------------------------- */
|
|
/* Private macro ------------------------------------------------------------ */
|
|
/* Private typedef ---------------------------------------------------------- */
|
|
/* Private variables -------------------------------------------------------- */
|
|
|
|
/* Private function -------------------------------------------------------- */
|
|
|
|
/* Exported functions ------------------------------------------------------- */
|
|
float MOTOR_GetRotorAbsAngle(const MOTOR_t *motor) {
|
|
if (motor == NULL) return DEVICE_ERR_NULL;
|
|
motor->feedback.rotor_abs_angle;
|
|
}
|
|
|
|
float MOTOR_GetRotorSpeed(const MOTOR_t *motor) {
|
|
if (motor == NULL) return DEVICE_ERR_NULL;
|
|
return motor->feedback.rotor_speed;
|
|
}
|
|
|
|
float MOTOR_GetTorqueCurrent(const MOTOR_t *motor) {
|
|
if (motor == NULL) return DEVICE_ERR_NULL;
|
|
return motor->feedback.torque_current;
|
|
}
|
|
|
|
float MOTOR_GetTemp(const MOTOR_t *motor) {
|
|
if (motor == NULL) return DEVICE_ERR_NULL;
|
|
return motor->feedback.temp;
|
|
}
|