/** * @file giant_can.h * @author Ye Jin * @brief giant can protocol * @version 0.1 * @date 2025-01-09 * * @copyright Copyright (c) 2025 * */ /************************************************************************ Beginning of File, do not put anything above here except notes Compiler Directives: *************************************************************************/ #ifndef GIANT_CAN_H #define GIANT_CAN_H #include "typedefine.h" /**************************************** * * Definitions & Macros * ****************************************/ //Data Frame- Function group #define FG_NETWORKMANAGER 0x0 #define FG_EVENT 0x1 #define FG_RESPONSEDATA 0x2 #define FG_NORMALDATA 0x3 //Node group #define NODE_ALL 0x0 #define NODE_SERVICETOOL 0x1 #define NODE_USERINTERFACE 0x2 #define NODE_DRIVECHAIN 0x6 #define NODE_MOTINOVA 0x7 #define NODE_ENERGYPACK 0xC #define NODE_GIANTAPP 0xF //Data Frame-Data behavior #define DB_ACTIVEDATA 0x0 #define DB_PASSIVEDATA 0x1 //Remote Frame- motion group #define MG_HEARTBEAT 0x0 #define MG_CONFIRMATION 0x1 #define MG_ACTIVEDATA1 0x2 #define MG_ACTIVEDATA2 0x3 #define MG_PASSIVEDATA1 0x4 #define MG_PASSIVEDATA2 0x5 #define MG_PASSIVEDATA3 0x6 #define MG_PASSIVEDATA4 0x7 /*************************************** * * Type Definations * ***************************************/ /** * @brief Rx Standard Data ID * */ typedef struct { UBYTE FunctionGroup;//2 bits UBYTE NodeGroup;//4 bits UBYTE DataBehaviors;//1 bit UBYTE DataAddress;//4 bits } GiantStandardDataFrameID_Struct_t; typedef struct { UBYTE MotionGroup;//3 bits UBYTE RequireNodeGroup;//4 bits UBYTE ResponseNodeGroup;//4 bits } GiantStandardRemoteFrameID_Struct_t; typedef struct { BOOL RefreshFlag; UBYTE Error; UBYTE ManualSleepEn; UBYTE AutomaticSleepEn;//1-ignore,0-keep UBYTE InactivateErrorDetection; UBYTE ThrottleEn; UBYTE BrakeleEn; UBYTE WalkEn; UBYTE ThrottlePowerPercentage; UBYTE RidingModeEn; UBYTE AdjustingMode; UWORD WheelCircumference; UBYTE MaximumTorque; UBYTE Acceleration; UBYTE AssistRatio; UBYTE MaximumPower; UWORD SpeedLimitation; } GiantControlParams_Struct_t; /***************************************** * * Exported variable * ****************************************/ extern GiantStandardDataFrameID_Struct_t stGiantStandardDataFrameID_rx; extern GiantStandardRemoteFrameID_Struct_t stGiantStandardRemoteFrameID_rx; extern GiantControlParams_Struct_t stGiantControlParams; /*************************************** * * Function Definations * ***************************************/ void giant_10msTask(void); void giant_DataProcess(void); void giant_SendDriveChainPassiveData(UBYTE remoteMG, UBYTE DataAddr); void giant_SendDriveChainActiveData(UBYTE functiongroup, UBYTE dataaddr); /************************************************************************/ #endif /************************************************************************ End of this File (EOF): Do not put anything after this part! *************************************************************************/