/*
 * 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_StopMode 41
#define DF_MSP_Ti5Motor_Fault_Reset 11



typedef struct
 {
  int32_t MotorID;
  int32_t RxIndex;
  int32_t Run_Mode; //DF_MSP_Ti5Motor_PositionMode//DF_MSP_Ti5Motor_SpeedMode//DF_MSP_Ti5Motor_CurrentMode // JERK(EMERGENCY STOP)
  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;

  //void GF_MSP_Wate_Cannon_Contronl_1(uint32_t Motor_ID_1 ,int32_t Clean_Swi, int32_t Scan_Hor1_Ver2,int32_t Rise_down_XX, int32_t Turn_Left_Right_YY, int32_t Hz_Adjust)
  int32_t WC_MotorID;
  int32_t WC_Clean_Swi;
  int32_t WC_Scan_Hor1_Ver2;

  int32_t WC_Rise_down_XX;
  int32_t WC_Turn_Left_Right_YY;
  int32_t WC_Hz_Adjust;
 }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_ */
