123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749 |
- /**
- * @file canAppl.h
- * @author Zhang, Kai(zhangkai71@midea.com)
- * @brief
- * @version 0.1
- * @date 2022-03-02
- *
- * @copyright Copyright (c) 2022
- *
- */
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives:
- ************************************************************************/
- #ifndef CANAPPL_H
- #define CANAPPL_H
- #include "typedefine.h"
- #ifdef __cplusplus
- extern "C" {
- #endif // __cplusplus
- /****************************************
- *
- * Definitions & Macros
- *
- ****************************************/
- #define CAN_MC_ALARMCODE_DEFAULT \
- { \
- 0x00000000 \
- }
- #define CAN_MC_ALARMCODE_CNT_RECORD_DEFAULT \
- { \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \
- }
- #define ALAM_DETECT_CNT_IN_1ms 120000
- #define ALAM_DISPLAY_CNT_0LEVEL 1
- #define ALAM_DISPLAY_CNT_1LEVEL 3
- #define ALAM_DISPLAY_CNT_2LEVEL 10
- #define ALAM_DISPLAY_CNT_3LEVEL 30
- /***************************************
- *
- * Type Definations
- *
- ***************************************/
- typedef enum
- {
- MC_Cadence_Forward = 0x00,
- MC_Cadence_Backward = 0x01,
- MC_Cadence_Stop = 0x02
- } MC_CadenceDir_Struct_t;
- typedef enum
- {
- MC_LightSwitch_OFF = 0xF0,
- MC_LightSwitch_ON = 0xF1
- } MC_LightSwitch_Struct_t;
- /**
- * @brief 电机运行信息,占用空间32bytes
- *
- */
- typedef struct
- {
- UWORD BikeSpeed; ///>车速 0.1km/h,地址偏移0
- SWORD MotorSpeed; ///>输出转速 1rpm,地址偏移2
- UWORD Power; ///>电功率 1W,地址偏移4
- UWORD BusVoltage; ///>母线电压 1mV,地址偏移6
- UWORD BusCurrent; ///>母线电流 1mA,地址偏移8
- UBYTE Cadence; ///>踏频 1rpm,地址偏移10
- UBYTE Torque; ///>踩踏力矩 1Nm,地址偏移11
- MC_CadenceDir_Struct_t CadenceDir; ///>踩踏方向 0-正,1-反,2-停止,地址偏移12
- UBYTE GearSt; ///>助力档位,地址偏移13
- MC_LightSwitch_Struct_t LightSwitch; ///>灯开关 0xF0-关,0xF1-开,地址偏移14
- UBYTE SOC; ///>剩余电量 1%,地址偏移15
- UWORD RemainDistance; ///>续航里程 1km,地址偏移16
- // UBYTE RS1[2];
- UWORD ODO_Km; ///>总里程 1km,地址偏移18
- UBYTE PowerPerKm; ///>平均功耗 0.01Ah/km ,地址偏移20
- UBYTE T_PCB; ///>PCB温度 +40℃,地址偏移21
- UBYTE T_Coil; ///>绕组温度 +40℃,地址偏移22
- UBYTE T_MCU; ///>MCU温度 +40℃,地址偏移23
- UWORD Ride_Km; ///>开机后骑行里程 0.1km, 地址偏移24
- UWORD Ride_Time; ///>开机后骑行时间 1s,地址偏移26
- UBYTE RS2[4]; ///>预留 4bytes
- } MC_RunInfo_Struct_t;
- /**
- * @brief 电机故障码
- *
- */
- typedef union MC_ERRORCODE
- {
- struct
- {
- ULONG Protect_OverCurrent : 1; ///>过流保护
- ULONG Protect_UnderVoltage : 1; ///>低压保护
- ULONG Protect_OverVoltage : 1; ///>过压保护
- ULONG Protect_LockRotor : 1; ///>堵转保护
- ULONG Protect_OverTemp : 1; ///>过热保护
- ULONG Fault_BikeSpdSensor : 1; ///>车速传感器故障
- ULONG Fault_TorqueSensor : 1; ///>力矩传感器故障
- ULONG Fault_HallSensor : 1; ///>霍尔传感器故障
- ULONG Fault_PhaseLine : 1; ///>相线故障
- ULONG Fault_PCBNTC : 1; ///>PCB温度传感器故障
- ULONG Fault_BMS_Check : 1; ///>BMS校验失败
- ULONG reserve1 : 1; /// s
- // ULONG Fault_HMI_Check :1;///>HMI校验失败
- ULONG Fault_PBU_Check : 1; ///>PBU校验失败
- ULONG Fault_MCU : 1; ///>MCU故障
- ULONG Fault_CadenceSensor : 1; ///>踏频传感器故障
- ULONG Fault_GasSensor : 1; ///>指拨故障
- ULONG Fault_MOS : 1; ///>MOS短路
- ULONG Protect_VoltageChange : 1; ///>电压波动异常
- ULONG Fault_Circuit : 1; ///>电路故障
- ULONG Fault_TE_MCU : 1; ///>TE MCU故障
- ULONG Fault_TE_Circuit : 1; ///>TE 电路故障
- ULONG Fault_MC_Check : 1; ///>MC校验失败
- ULONG Fault_SpiPosSensor : 1; ///>SPI位置故障
- ULONG Fault_Throttle : 1; ///>转把故障
- ULONG RS1 : 1;
- ULONG RS2 : 1;
- ULONG RS3 : 1;
- ULONG RS4 : 1;
- ULONG RS5 : 1;
- ULONG RS6 : 1;
- ULONG RS7 : 1;
- ULONG RS8 : 1;
- } ERROR_Bit;
- ULONG Code;
- } MC_ErrorCode_Struct_t;
- /**
- * @brief 电机故障码
- *
- */
- typedef struct MC_ERROR_CNT_RECORD
- {
- ULONG ulAlamCntTimeCnt_1ms;
- UWORD Protect_OverCurrentCnt; ///>过流保护
- UWORD Protect_UnderVoltageCnt; ///>低压保护
- UWORD Protect_OverVoltageCnt; ///>过压保护
- UWORD Protect_LockRotorCnt; ///>堵转保护
- UWORD Protect_OverTempCnt; ///>过热保护
- UWORD Fault_SpeedSensorCnt; ///>速度传感器故障
- UWORD Fault_TorqueSensorCnt; ///>力矩传感器故障
- UWORD Fault_HallSensorCnt; ///>霍尔传感器故障
- UWORD Fault_PhaseLineCnt; ///>相线故障
- UWORD Fault_NtcSensorCnt; ///>温度传感器故障
- UWORD Fault_BMS_CheckCnt; ///>BMS校验失败
- // UWORD Fault_HMI_Check :1;///>HMI校验失败
- UWORD Fault_PBU_CheckCnt; ///>PBU校验失败
- UWORD Fault_MCUCnt; ///>MCU故障
- UWORD Fault_CadenceSensorCnt; ///>踏频传感器故障
- UWORD Fault_GasSensorCnt; ///>指拨故障
- UWORD Fault_MOSCnt; ///>MOS短路
- UWORD Protect_VoltageChangeCnt; ///>电压波动异常
- UWORD Fault_CircuitCnt; ///>电路故障
- UWORD Fault_TE_MCUCnt; ///>TE MCU故障
- UWORD Fault_TE_CircuitCnt; ///>TE 电路故障
- UWORD Fault_MC_CheckCnt; ///>MC校验失败
- } MC_ErrorCode_CNT_RECORD_Struct_t;
- /**
- * @brief 在线检测结果,占用空间1byte
- *
- */
- typedef union ONLINE_STATUS
- {
- struct
- {
- UBYTE BMS_OffLine : 1; // BMS离线
- UBYTE PBU_OffLine : 1; // PBU离线
- UBYTE HMI_OffLine : 1; // HMI离线
- UBYTE RS1 : 1;
- UBYTE RS2 : 1;
- UBYTE RS3 : 1;
- UBYTE RS4 : 1;
- UBYTE RS5 : 1;
- } Status_Bit;
- UBYTE Status;
- } OnLine_Status_Struct_t;
- /**
- * @brief MC版本信息,占用空间64bytes
- *
- */
- typedef struct
- {
- char Mode[16]; ///>型号 ASCII,0x2E结束,无效填充0x20
- char SN_Num[16]; ///>序列号 ASCII,0x2E结束,无效填充0x20
- char HW_Version[16]; ///>硬件版本 ASCII,0x2E结束,无效填充0x20
- char FW_Version[16]; ///>软件版本 ASCII,0x2E结束,无效填充0x20
- } MC_VerInfo_Struct_t;
- /**
- * @brief MC生产信息,占用空间32bytes
- *
- */
- typedef struct
- {
- char Manufacturer[8]; ///>生产厂商 ASCII,0x2E结束,无效填充0x20
- char MacAddr[8]; ///>生产地 ASCII,0x2E结束,无效填充0x20
- char MacDate[8]; ///>生产日期 ASCII,0x2E结束,无效填充0x20
- char MacBrand[8];
- } MC_MacInfo_Struct_t;
- /**
- * @brief MC生产信息,占用空间32bytes
- *
- */
- typedef struct
- {
- char CustomASCII1[16]; ///>生产厂商 ASCII,0x2E结束,无效填充0x20
- char CustomASCII2[16]; ///>生产地 ASCII,0x2E结束,无效填充0x20
- char CustomASCII3[16]; ///>生产日期 ASCII,0x2E结束,无效填充0x20
- } MC_RS_ASCII_Struct_t;
- /**
- * @brief MC骑行历史信息,占用空间16bytes
- *
- */
- typedef struct
- {
- ULONG ODO_Km; ///>ODO里程,地址偏移0
- ULONG ODO_Time; ///>ODO时间,地址偏移4
- ULONG TRIP_Km; ///>TRIP里程,地址偏移8
- ULONG TRIP_Time; ///>TRIP时间,地址偏移12
- } MC_RideLog_Struct_t;
- /**
- * @brief BMS状态信息,占用空间1byte
- *
- */
- typedef union BMS_STATUS
- {
- struct
- {
- UBYTE Charge : 1; ///>充电
- UBYTE Discharge : 1; ///>放电
- UBYTE RS1 : 1;
- UBYTE RS2 : 1;
- UBYTE RS3 : 1;
- UBYTE RS4 : 1;
- UBYTE RS5 : 1;
- UBYTE RS6 : 1;
- } Status_Bit;
- UBYTE Status;
- } BMS_STATUS_Struct_t;
- /**
- * @brief 电池运行信息,占用空间16bytes
- *
- */
- typedef struct
- {
- UWORD Voltage; ///>电压 1mV,地址偏移0
- UWORD Current; ///>电流 1mA,地址偏移2
- UWORD RC; ///>剩余容量 1mAh,地址偏移4
- UWORD FCC; ///>满充容量 1mAh,地址偏移6
- UBYTE Cell_NTC; ///>电芯温度 +40℃,地址偏移8
- UBYTE SOC; ///>剩余电量 1%,地址偏移9
- BMS_STATUS_Struct_t Status; ///>运行状态,地址偏移10
- UBYTE RS[5];
- } BMS_RunInfo_Struct_t;
- /**
- * @brief 助力档位信息
- *
- */
- typedef enum
- {
- MC_GearSt_OFF = 0x00,
- MC_GearSt_Torque_ECO = 0x01,
- MC_GearSt_Torque_NORM = 0x02,
- MC_GearSt_Torque_SPORT = 0x03,
- MC_GearSt_Torque_TURBO = 0x04,
- MC_GearSt_SMART = 0x33,
- MC_GearSt_WALK = 0x22
- } MC_GearSt_Struct_t;
- /**
- * @brief 电机控制指令,占用空间2bytes
- *
- */
- typedef struct
- {
- MC_GearSt_Struct_t GearSt; ///>助力档位
- MC_LightSwitch_Struct_t LightSwitch; ///>灯开关 0xF0-关,0xF1-开
- } MC_ControlCode_Struct_t;
- /**
- * @brief 电机运行信息,占用空间32bytes
- *
- */
- typedef struct
- {
- UBYTE Torque; ///>踩踏力矩 1Nm,地址偏移0
- MC_CadenceDir_Struct_t CadenceDir; ///>踩踏方向 0-正,1-反,2-停止,地址偏移1
- UBYTE Cadence; ///>踏频 1rpm,地址偏移2
- UBYTE GearSt; ///>助力档位,地址偏移3
- UBYTE T_PCB; ///>PCB温度 +40℃,地址偏移4
- UBYTE T_Coil; ///>绕组温度 +40℃,地址偏移5
- UWORD BusVoltage; ///>母线电压 1mV,地址偏移6
- UWORD BusCurrent; ///>母线电流 1mA,地址偏移8
- SWORD MotorSpeed; ///>输出转速 1rpm,地址偏移10
- UWORD BikeSpeed; ///>车速 0.1km/h,地址偏移12
- SWORD IqCurrent; ///> Iq电流反馈 1mA 地址偏移14
- UBYTE AlarmCode; ///> 故障码最多8个故障 地址偏移16
- UBYTE RS2; ///> 预留 地址偏移17
- } MC_RunInfoToCDL_Struct_t;
- /***************************************
- *
- * Host computer Type Definations
- *
- ***************************************/
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD uwPolePairs;
- UWORD uwRsmOhm;
- UWORD uwLduH;
- UWORD uwLquH;
- UWORD uwFluxmWb;
- UWORD uwIdMaxA;
- UWORD uwIdMinA;
- UWORD uwRSpdRpm;
- UWORD uwRPwrWt;
- UWORD uwRCurA;
- UWORD uwRVolV;
- UWORD uwJD;
- UWORD uwTorMaxNm;
- UWORD reserve1;
- UWORD reserve2;
- UWORD reserve3;
- UWORD reserve4;
- UWORD reserve5;
- UWORD reserve6;
- UWORD reserve7;
- UWORD reserve8;
- } UPC_MotorInfo_Struct_t;
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD uwWheelPerimeter; //轮胎周长 cm
- UWORD uwMechRationMotor; //传动比 0.1
- UWORD uwAssistMaxSpdKmH; //限速 1km/h
- UWORD uwThrottleMaxSpdKmH; //推行模式限速 1km/h
- UWORD uwNmFrontChainring; //前牙盘 T
- UWORD uwNmBackChainring; //后牙盘 T
- UWORD uwAssistSelect1; //助力方案1
- UWORD uwAssistSelect2; //助力方案2
- UWORD uwLightVoltage; //灯压配置 6/12V
- SWORD swWheelSizeAdjust; //周长微调 ±10cm
- UWORD uwStartMode; //启动模式 1-柔和,2-正常,3-强劲
- UWORD uwAutoPowerOffTime; //自动关机时间 1min,0-不自动关机
- UWORD reserve1;
- } UPC_BikeInfo_Struct_t;
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD uwSPIPosOffsetOrigin;
- UWORD uwSPIPosOffsetNow;
- UWORD uwIPeakMaxA;
- UWORD uwAlamOCurA;
- UWORD uwAlamOVolV;
- UWORD uwAlamUVolV;
- UWORD uwAlamOverSpdRpm;
- UWORD uwAlamOverHeatCe;
- UWORD uwAlamRecHeatCe;
- UWORD uwPwrLimitStartCe;
- UWORD reserve1;
- UWORD reserve2;
- UWORD reserve3;
- UWORD reserve4;
- UWORD reserve5;
- UWORD reserve6;
- UWORD reserve7;
- UWORD reserve8;
- } UPC_MControlInfo_Struct_t;
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD uwTorSensorOffsetOrigin;
- UWORD uwTorSensorOffsetNow1;
- UWORD uwTorSensorOffsetNow2;
- UWORD uwTorSensorOffsetNow3;
- UWORD uwTorSensorOffsetNow4;
- UWORD uwBikeTorMaxNm;
- UWORD uwBikeTor1StepRealNm;
- UWORD uwBikeTor1StepADC;
- UWORD uwBikeTor2StepRealNm;
- UWORD uwBikeTor2StepADC;
- UWORD uwBikeTor3StepRealNm;
- UWORD uwBikeTor3StepADC;
- UWORD uwBikeTor4StepRealNm;
- UWORD uwBikeTor4StepADC;
- UWORD uwCadSensorPulseNm;
- UWORD uwBikeSpdSensorPulseNm;
- UWORD reserve1;
- UWORD reserve2;
- UWORD reserve3;
- UWORD reserve4;
- } UPC_SensorInfo_Struct_t;
- typedef struct
- {
- SWORD swTorqueCurveNum;
- SWORD swCadenceCurveNum;
- } UPC_CurveOrderInfo_Struct_t;
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD reserve0;
- UWORD swStartupGain;
- UWORD swStartcruiseGain;
- UPC_CurveOrderInfo_Struct_t stCurveOrderInfo;
- SLONG slTorquePolyA;
- SLONG slTorquePolyB;
- SLONG slTorquePolyC;
- SLONG slTorquePolyD;
- SLONG slCadencePolyA;
- SLONG slCadencePolyB;
- SLONG slCadencePolyC;
- SLONG slCadencePolyD;
- UWORD uwAssistStartNm;
- UWORD uwAssistStopNm;
- UWORD uwStartUpGainStep;
- UWORD uwStartUpCadNm;
- UWORD uwTorLPFCadNm;
- UWORD uwSpeedAssistSpdRpm;
- UWORD uwSpeedAssistIMaxA;
- UWORD uwAssistLimitBikeSpdStart;
- UWORD uwAssistLimitBikeSpdStop;
- UWORD uwCadenceAssistWeight;
- UWORD reserve1;
- UWORD reserve2;
- UWORD reserve3;
- UWORD reserve4;
- UWORD reserve5;
- UWORD reserve6;
- UWORD reserve7;
- UWORD reserve8;
- } UPC_AssistInfo_Struct_t;
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD uwOpenTimes;
- UWORD uwUsedTimeH;
- UWORD uwUsedTimeL;
- UWORD uwNTCTempMaxCe;
- UWORD uwNTCTempMinCe;
- UWORD uwAlamHOcurTimes;
- UWORD uwAlamSOcurTimes;
- UWORD uwAlamOHeatTimes;
- UWORD uwAlamRotorLockTimes;
- UWORD uwAlamPhsLossTimes;
- UWORD uwAlamOVolTimes;
- UWORD uwAlamUVolTimes;
- UWORD uwAlamComOTimeTimes;
- UWORD uwG1AvgPwrConsumption;
- UWORD uwG2AvgPwrConsumption;
- UWORD uwG3AvgPwrConsumption;
- UWORD uwG4AvgPwrConsumption;
- UWORD uwG5AvgPwrConsumption;
- UWORD uwODOTripH;
- UWORD uwODOTripL;
- UWORD uwODOTimeH;
- UWORD uwODOTimeL;
- UWORD uwTripSumH;
- UWORD uwTripSumL;
- UWORD uwTripSumTimeH;
- UWORD uwTripSumTimeL;
- UWORD uwTorSensorAlamTimes;
- UWORD uwCadSensorAlamTimes;
- UWORD uwBikeSpdSensorAlamTimes;
- UWORD uwPosSensorAlamTimes;
- UWORD reserve1;
- UWORD reserve2;
- UWORD reserve3;
- UWORD reserve4;
- UWORD reserve5;
- UWORD reserve6;
- UWORD reserve7;
- UWORD reserve8;
- } UPC_HistoryInfo_Struct_t;
- typedef struct
- {
- UWORD uwSaveFlg;
- UWORD uwEEFirstDefaultSetFlg;
- UWORD uwSPIOffsetFirstSetFlg;
- UWORD uwTestParaSaveFlg;
- UWORD RunModelSelect;
- UWORD ThetaGetModelSelect;
- UWORD CurrentSampleModelSelect;
- UWORD RotateDirectionSelect;
- UWORD uwInitPosCurAmp;
- UWORD uwVFControlVolAmp;
- UWORD uwIFControlCurAmp;
- UWORD uwVFIFTargetFreHz;
- UWORD uwSpeedLoopAccRate;
- UWORD uwSpeedLoopDecRate;
- UWORD uwSpeedLoopBandWidthHz;
- UWORD uwSpeedLoopCoefM;
- UWORD uwCuerrentLoopBandWidthHz;
- UWORD uwCurrentLoopCoefM;
- UWORD uwFluxObsBandWidthHz;
- UWORD uwFluxObsCoefM;
- UWORD uwThetaObsPLLBandWidthHz;
- UWORD uwThetaObsPLLCoefM;
- UWORD uwJm;
- UWORD uwPWMMaxDuty;
- UWORD uwPWM7to5Duty;
- UWORD uwPwrLimit;
- UWORD uwPwrLimitError;
- UWORD uwPwrLimitKp;
- UWORD uwPwrLimitKi;
- UWORD reserve1;
- UWORD reserve2;
- UWORD reserve3;
- UWORD reserve4;
- UWORD reserve5;
- UWORD reserve6;
- UWORD reserve7;
- UWORD reserve8;
- } UPC_TestParaInfo_Struct_t;
- typedef struct
- {
- UPC_MotorInfo_Struct_t stMotorInfo;
- UPC_BikeInfo_Struct_t stBikeInfo;
- UPC_MControlInfo_Struct_t stMContorlInfo;
- UPC_SensorInfo_Struct_t stSensorInfo;
- UPC_CurveOrderInfo_Struct_t stCurveOrderInfo;
- UPC_AssistInfo_Struct_t stAssistInfo;
- UPC_HistoryInfo_Struct_t stHistoryInfo;
- UPC_TestParaInfo_Struct_t stTestParaInfo;
- } MC_UpperPCInfo_Struct_t;
- typedef struct
- {
- UBYTE uwWheelPerimeter; ///>车轮默认长度 1cm
- UBYTE StartUpMod; ///>1-柔和,2-正常,3-强劲,地址偏移1
- UBYTE BikeSpeedLimit; /// km/h
- SBYTE DeltDiameter; ///>有符型,单位1cm,±10.0cm 1Nm,地址偏移0
- UBYTE AssistMod; ///>助力模式1-2,地址偏移2
- UBYTE AutoPowerOffTime;
- UBYTE reserve1;
- UBYTE reserve2;
- } OBC_SetCustomPara_Struct_t;
- //仪表按键状态
- typedef union OBC_BUTTON_STATU
- {
- struct
- {
- UBYTE Set : 1;
- UBYTE Light : 1;
- UBYTE Walk : 1;
- UBYTE Dec : 1;
- UBYTE Acc : 1;
- UBYTE Power : 1;
- UBYTE RS1 : 1;
- UBYTE RS2 : 1;
- } Status_Bit;
- UBYTE KeyStatus;
- } OBC_ButtonStatu_Struct_t;
- typedef struct
- {
- UBYTE Reserver;
- OBC_ButtonStatu_Struct_t ButtonStatu;
- ULONG ulButtonSetTimeCnt;
- } OBC_ButtonStatus_Struct_t;
- typedef struct
- {
- SWORD swIdcPu;
- UWORD uwInterResistpu;
- UWORD uwVdcCompPu;
- } BMS_VoltEstimat_Struct_t;
- /****************************************
- *
- * Exported variable
- *
- ****************************************/
- extern MC_RunInfo_Struct_t MC_RunInfo;
- extern MC_ErrorCode_Struct_t MC_ErrorCode;
- extern MC_ErrorCode_CNT_RECORD_Struct_t MC_ErrorCntRecord;
- extern MC_VerInfo_Struct_t MC_VerInfo;
- extern char Firmware_Special[32];//软件版本标识,包含客户定制化信息
- extern MC_MacInfo_Struct_t MC_MacInfo;
- extern MC_RideLog_Struct_t MC_RideLog;
- extern BMS_RunInfo_Struct_t BMS_RunInfo;
- extern MC_ControlCode_Struct_t MC_ControlCode;
- extern MC_RunInfoToCDL_Struct_t MC_RunInfoToCDL;
- extern MC_RS_ASCII_Struct_t MC_RsASSCII;
- extern MC_UpperPCInfo_Struct_t MC_UpcInfo;
- extern BMS_VoltEstimat_Struct_t BMS_VoltEstimat;
- extern OBC_SetCustomPara_Struct_t OBC_SetCustomPara;
- extern OBC_ButtonStatus_Struct_t OBC_ButtonStatus;
- extern ULONG ulOBC_ComTimeOutCount;
- extern UBYTE MC_MotorSPD_rpm_Percent;
- extern UBYTE MC_WorkMode;
- extern UBYTE MC_BC_COM;
- extern UWORD LightSwitch;
- extern ULONG ODO_T, TRIP_T;
- extern BOOL blFlashSaveflg;
- /************************************************************************
- Ram Allocation
- *************************************************************************/
- /***************************************
- *
- * Function Definations
- *
- ***************************************/
- /**
- * @brief MC_UpcInfo上电初始化
- *
- */
- void Can_voUpdateMC_UpcInfo(void);
- /**
- * @brief MC运行状态初始化
- *
- */
- void Can_voInitMC_Run(void);
- /**
- * @brief 1ms中的MC运行状态更新
- *
- */
- void Can_voMC_Run_1ms(void);
- /**
- * @brief 5ms中的MC运行状态更新
- *
- */
- void Can_voMC_Run_5ms(void);
- /**
- * @brief 200ms中的MCMC运行状态更新
- *
- */
- void Can_voMC_Run_200ms(void);
- /**
- * @brief 接收挡位指令
- *
- */
- void Can_GearSt_switch(void);
- /**
- * @brief 接收开关灯指令
- *
- */
- void Can_Light_switch(void);
- /**
- * @brief 里程计算
- *
- */
- void Can_Trip_Cal(void);
- /**
- * @brief 根据电池反馈计算续航里程
- *
- */
- void Can_RemainTrip_Cal(void);
- /**
- * @brief 根据电压估算电量
- *
- */
- UWORD Can_SOC_Cal(void);
- /**
- * @brief 根据协议显示助力曲线
- *
- */
- void Can_AssistCoef_Read(const UPC_CurveOrderInfo_Struct_t *order);
- /**
- * @brief 根据协议写入助力曲线
- *
- */
- void Can_AssistCoef_Write(const UPC_CurveOrderInfo_Struct_t *order);
- /************************************************************************
- Flag Define (N/A)
- *************************************************************************/
- #ifdef __cplusplus
- }
- #endif // __cplusplus
- #endif
- /************************************************************************
- End of this File (EOF)!
- Do not put anything after this part!
- ************************************************************************/
|