这是我自己定义的can.h头文件,把相关结构体变量都放在这里了并对他们进行了初始化,文件可以build成功,但是debug的时候就会出错,显示错误出现在下文红 {MOD}字体处,错误提示如下图所示,哪位大神能帮忙解决一下,不胜感激!!!
#ifndef CAN_H #define CAN_H
#ifdef _CAN_C_ #define _CAN_EXT #else #define _CAN_EXT extern#endif
/************************************************************************************************** Defini
tions & Macros**************************************************************************************************/#define CAN_DEFAULTS {
0,
0, {0, 0, 0, 0, 0, 0, 0, 0}, 1,
(void (*)(long))can_TXData,
(void (*)(long))can_RXData }
#define CAN_T_DEFAULTS { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (void (*)(long))can_TXData}
#define CAN_R_DEFAULTS { 0, 0, 0, 0, 0, 0,
0, (void (*)(long))can_RXData }
/************************************************************************************************** TypeDefs & Structure defines (N/A)**************************************************************************************************/typedef struct { _iq id;
/* Input: phase-a stator variable */
_iq length;
/* Input: phase-b stator variable */
_iq data[8]; /* Input: phase-c stator variable */
_iq sta;
void (*TXData)();
/* Pointer to calculation function */
void (*RXData)();
/* Pointer to calculation function */
} CAN;
typedef CAN *CAN_handle;
typedef struct
{ _iq M1Torque;
_iq M1Current;
_iq M1HeartBeat;
_iq M1State;
_iq M1Direction;
_iq M1Speed;
_iq M1InputVolt;
_iq M1Temp;
_iq M1IGBTTemp;
_iq M1DeltaAngle;
_iq M1TqLimit;
_iq M1FaultGrade;
_iq M1Fault;
_iq M2Torque;
_iq M2Current;
_iq M2HeartBeat;
_iq M2State;
_iq M2Direction;
_iq M2Speed;
_iq M2InputVolt;
_iq M2Temp;
_iq M2IGBTTemp;
_iq M2DeltaAngle;
_iq M2TqLimit;
_iq M2FaultGrade;
_iq M2Fault;
void (*TXData)();
/* Pointer to calculation function */
}CAN_T;
typedef CAN_T *CAN_tx;
typedef struct{
_iq M1Enable;
_iq M1Mode;
_iq M1Drive;
_iq M1TorqueSet;
_iq M1SpeedSet;
_iq M1SpeedLimit;
_iq M2Enable;
_iq M2Mode;
_iq M2Drive;
_iq M2TorqueSet;
_iq M2SpeedSet;
_iq M2SpeedLimit;
_iq MCU1HeartBeat;
void (*RXData)();
/* Pointer to calculation function */
}CAN_R;
typedef CAN_R *CAN_rx;
/************************************************************************************************** Exported Variables **************************************************************************************************/ #ifdef _CAN_C_
_CAN_EXT CAN can = CAN_DEFAULTS; _CAN_EXT CAN_T tbuf = CAN_T_DEFAULTS; _CAN_EXT CAN_R rbuf = CAN_R_DEFAULTS;error:#20 identifier "can_RXData" is undefined can.herror:#45 expression must have pointer type can.h _CAN_EXT Uint16 can_StartFlag = 0; _CAN_EXT Uint16 can_RunMode = 0; _CAN_EXT Uint16 can_RunDIR = 0; _CAN_EXT int16 can_IdCmd = 0; _CAN_EXT int16 can_IqCmd = 0; _CAN_EXT Uint16 can_TXFlag = 0;#else _CAN_EXT CAN can; _CAN_EXT CAN_T tbuf; _CAN_EXT CAN_R rbuf; _CAN_EXT Uint16 can_StartFlag; _CAN_EXT Uint16 can_RunMode; _CAN_EXT Uint16 can_RunDIR; _CAN_EXT int16 can_IdCmd; _CAN_EXT int16 can_IqCmd; _CAN_EXT Uint16 can_TXFlag;#endif/************************************************************************************************** RAM ALLOCATION (N/A)**************************************************************************************************/
/************************************************************************************************** Exported Function Call Prototypes**************************************************************************************************/
_CAN_EXT void can_TXData(CAN_tx); _CAN_EXT void can_RXData(CAN_rx); _CAN_EXT interrupt void CANA_Recv_ISR(void);
/************************************************************************************************** Local Function Call Prototypes (N/A)**************************************************************************************************/
/************************************************************************************************** Flag Define (N/A)**************************************************************************************************/#endif
一周热门 更多>