/*
 * msp_TTMotor_ZQ.h
 *
 *  Created on: 2024年5月20日
 *      Author: Administrator
 */

#ifndef INC_MSP_MSP_TTMOTOR_ZQ_H_
#define INC_MSP_MSP_TTMOTOR_ZQ_H_


#include "BSP/bsp_include.h"


#define DF_MSP_TT_Motor_PositionMode 	01
#define DF_MSP_TT_Motor_SpeedMode 		02
#define DF_MSP_TT_Motor_CurrentMode 	03
#define DF_MSP_TT_Motor_Posi_Now 	04


#define TT_One_Deg_Count 	11014///32768*121/360(减速比121)=11014

#define TT_Left_limt    84080      //-775000+75*11014
#define TT_Right_limt  -1568020  //-775000-75*11014
//#define Sw_Rust_Mid_Posi  -775000  //-775000-75*11014

//double Sw_Rust_Mid_Posi=-775000;//需检测修改
#define DF_MSP_TT_Motor_StartID 2


typedef struct
 {
  int32_t MotorID;
  int32_t RxIndex;
  int32_t Run_Mode; //DF_MSP_FH_Motor_PositionMode//DF_MSP_FH_Motor_SpeedMode//DF_MSP_FH_Motor_CurrentMode
  int32_t Real_Current;
  int32_t Target_Current;
  int32_t Real_Velcity;
  int32_t Target_Velcity;

  int32_t Target_Position;
  int32_t ERROR_Flag;
  int32_t Temperature_Motor;
  int32_t Temperature_PCB;

  int32_t CRC_Error;
  int32_t Dri_Inter_Error;
  int32_t Short_circuit_error;
  int32_t Drive_overheating;
  int32_t Motor_overheating;

  int32_t Overvoltage;
  int32_t Undervoltage;
  int32_t Feedback_error;
  int32_t Phase_error;
  int32_t Follow_error;
  int32_t Overcurrent;
  int32_t FPGA_error;
  int32_t Input_command_error;

  int32_t Act_Suc;
  int32_t Cont_Posi_Suc;
  int32_t Acc_Suc;
  int32_t Dec_Suc;
  int32_t Target_Posi_Suc;
  int32_t Run_Speed_Suc;
  int32_t Clear_Suc;
  int32_t Real_Position;

  int32_t Acc_Suc_Speed;
  int32_t Dec_Suc_Speed;
  int32_t Suc_Speed_S;
  int32_t TT_Motor_Fault;
 }TT_MotorParameters;



 uint8_t GF_MSP_TT_Motor_Init(uint8_t FDCAN_CH, TT_MotorParameters* MotorP,uint8_t ID_Start,uint8_t Num_Motor_p);
 void GF_MSP_FH_Motor_Control_Timer();

#endif /* INC_MSP_MSP_TTMOTOR_ZQ_H_ */
