/*
 * msp_TI5MOTOR.h
 *
 *  Created on: Oct 26, 2023
 *      Author: shiya
 *
 */

#ifndef INC_MSP_MSP_TI5MOTOR_H_
#define INC_MSP_MSP_TI5MOTOR_H_

#include "BSP/bsp_include.h"

#define DF_MSP_Ti5Motor_PositionMode 44
#define DF_MSP_Ti5Motor_SpeedMode 43
#define DF_MSP_Ti5Motor_CurrentMode 42
#define DF_MSP_Ti5Motor_State_Read 41

typedef struct
 {
  int32_t MotorID;
  int32_t RxIndex;
  int32_t Run_Mode; //DF_MSP_Ti5Motor_PositionMode//DF_MSP_Ti5Motor_SpeedMode//DF_MSP_Ti5Motor_CurrentMode
  int32_t Current;
  int32_t Target_Current;
  int32_t Velcity;
  int32_t Target_Velcity;
  int32_t Position;
  int32_t Target_Position;
  int32_t ERROR_Flag;
  int32_t Temperature_Motor;
  int32_t Temperature_PCB;
 }MotorParameters;


//The ID of the motor is continuous, 1\2\3\4\5
//The starting ID of the motor is DF_MSP_Ti5Motor_StartID
//电机的ID必须是连续的，第一个电机ID需要在此定义
#define DF_MSP_Ti5Motor_StartID 1

uint8_t GF_MSP_Ti5Motor_Init(uint8_t FDCAN_CH, MotorParameters* MotorP,uint8_t Num_Motor_p);

//需要将此函数放置到对应的CAN接收中断函数中
void GF_MSP_Ti5Motor_CANRx_Callback();

//需要每间隔2ms执行一次
void GF_MSP_Ti5Motor_Control_Timer();

//void GF_Tis_Control_Single();
void GF_MSP_Ti5Motor_Error_Clean();



#endif /* INC_MSP_MSP_TI5MOTOR_H_ */
