/*
 * msp_FH_Motor.h
 *
 *  Created on: 2023年12月12日
 *      Author: Administrator
 */

#ifndef INC_MSP_MSP_FH_MOTOR_H_
#define INC_MSP_MSP_FH_MOTOR_H_


#include "BSP/bsp_include.h"
void GF_MSP_FH_Motor_Control_Timer();

#define DF_MSP_FH_Motor_PositionMode 	01
#define DF_MSP_FH_Motor_SpeedMode 		03
#define DF_MSP_FH_Motor_CurrentMode 	04



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 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;

  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;


 }FH_MotorParameters;

#define DF_MSP_FH_Motor_StartID 1

extern FH_MotorParameters*  FH_Motor;

uint8_t GF_MSP_FH_Motor_Init(uint8_t FDCAN_CH, FH_MotorParameters* MotorP,uint8_t Num_Motor_p);


#endif /* INC_MSP_MSP_FH_MOTOR_H_ */
