123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- /*
- * Config.h
- *
- * Created on: 2019年4月23日
- * Author: foluswen
- */
- #ifndef CONFIG_H_
- #define CONFIG_H_
- #include <stdbool.h>
- typedef unsigned char byte;
- #define TOTAL_QUANTITY_GUN 4 //Max Count
- #define MODE_BOOT 0
- #define MODE_IDLE 1
- #define MODE_AUTHORIZING 2
- #define MODE_REASSIGN_CHECK 3
- #define MODE_REASSIGN 4
- #define MODE_PRECHARGE 5
- #define MODE_PREPARE_FOR_EV 6
- #define MODE_PREPARE_FOR_EVSE 7
- #define MODE_CHARGING 8
- #define MODE_TERMINATING 9
- #define MODE_COMPLETE 10
- #define MODE_ALARM 11
- #define MODE_FAULT 12
- #define MODE_RESERVATION 13
- #define MODE_BOOKING 14
- #define MODE_MAINTAIN 15
- #define MODE_DEBUG 16
- #define MODE_CCS_PRECHARGE_STEP0 17 // ready for ccs precharge processing, For D+ relay to precharge relay
- #define MODE_CCS_PRECHARGE_STEP1 18 // waitting for ev board inform to enter to charging, For precharge relay to D+ relay
- #define MODE_UPDATE 19
- #define GFD_WAIT 0
- #define GFD_PASS 1
- #define GFD_FAIL 2
- #define GFD_WARNING 3
- #define PRECHARGE_WAIT 0
- #define PRECHARGE_READY 1
- #define PRECHARGE_PRERELAY_PASS 2
- #define PRECHARGE_CHARELAY_PASS 3
- #define BOOTTING 0
- #define BOOT_COMPLETE 1
- #define uSEC_VAL 1000000
- #define mSEC_VAL 1000
- #define MAX_GROUP_QUANTITY 4
- #define MAX_PSU_MODULE_QUANTITY 62
- #define MAX_MODULE_PER_GROUP 12
- #define SM_ChargerInfoKey 3000
- // ********** Audi ********** //
- // Model Name: DOYC182000D2AD
- // ********** e4you ********** //
- // Model Name: DKYE182000D1E4
- // ********** xpeng ********** //
- // Model Name: DOYE362000D2XP
- enum _SYSTEM_STATUS
- {
- S_BOOTING = 0,
- S_IDLE,
- S_AUTHORIZING,
- S_REASSIGN_CHECK,
- S_REASSIGN,
- S_PREPARNING,
- S_PREPARING_FOR_EV,
- S_PREPARING_FOR_EVSE,
- S_CHARGING,
- S_TERMINATING,
- S_COMPLETE,
- S_ALARM,
- S_FAULT,
- S_RESERVATION,
- S_BOOKING,
- S_MAINTAIN,
- S_DEBUG,
- S_CCS_PRECHARGE_ST0,
- S_CCS_PRECHARGE_ST1,
- S_UPDATE,
- S_NONE,
- };
- enum _AC_SYSTEM_STATUS
- {
- AC_SYS_NONE = 0,
- AC_SYS_A,
- AC_SYS_B,
- AC_SYS_C,
- AC_SYS_D,
- AC_SYS_E
- };
- #define STR_GUN_TYPE_CHADEMO "CHAdeMO"
- #define STR_GUN_TYPE_CCS "CCS"
- #define STR_GUN_TYPE_GBT "GBT"
- #define STR_GUN_TYPE_AC "AC"
- #define STR_GUN_TYPE_UNKNOWN "Unknown Type"
- enum _GUN_TYPE
- {
- _Type_Chademo = 0,
- _Type_CCS_2,
- _Type_GB,
- _Type_AC,
- _Type_Unknown = 0xFF
- };
- enum _LCM_INDEX
- {
- _LCM_INIT = 0x00,
- _LCM_IDLE = 0x01,
- _LCM_AUTHORIZING = 0x02,
- _LCM_AUTHORIZ_COMP = 0x03,
- _LCM_AUTHORIZ_FAIL = 0x04,
- _LCM_WAIT_FOR_PLUG = 0x05,
- _LCM_PRE_CHARGE = 0x06,
- _LCM_CHARGING = 0x07,
- _LCM_COMPLETE = 0x08,
- _LCM_FIX = 0x09,
- _LCM_NONE = 0xFF,
- };
- enum _DispenserAuthorizeStatus
- {
- _AuthorizeStatus_Idle = 0x00,
- _AuthorizeStatus_Wait = 0x01,
- _AuthorizeStatus_Busy = 0x02,
- _AuthorizeStatus_Done = 0x03,
- _AuthorizeStatus_End = 0x04,
- };
- enum _ConnectorAuthorizeResult
- {
- _AuthResult_None = 0x00,
- _AuthResult_Valid = 0x01,
- _AuthResult_Invalid = 0x02,
- };
- enum _AuthorizedType
- {
- _AuthType_None = 0x00,
- _AuthType_RFID = 0x01,
- _AuthType_RemoteStart = 0x02,
- };
- enum _SELF_TEST_SEQ
- {
- _STEST_VERSION = 0x00,
- _STEST_AC_CONTACTOR = 0x01,
- _STEST_PSU_DETECT = 0x02,
- _STEST_PSU_CAP = 0x03,
- _STEST_FAIL = 0x04,
- _STEST_COMPLETE = 0xEE,
- };
- enum _MODULE_PSU_WORK_STEP
- {
- INITIAL_START = 0,
- GET_PSU_COUNT = 1,
- GET_SYS_CAP = 2,
- BOOTING_COMPLETE = 3,
- _WORK_CHARGING = 10,
- _TEST_MODE = 20,
- _NO_WORKING = 254,
- _INIT_PSU_STATUS = 255
- };
- enum _OFFLINE_POLICY
- {
- _OFFLINE_POLICY_LOCAL_LIST = 0x00,
- _OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
- _OFFLINE_POLICY_FREE_CHARGING = 0x02,
- _OFFLINE_POLICY_NO_CHARGING = 0x03,
- };
- enum _REASSIGNED_RESOURCE_STEP
- {
- _REASSIGNED_NONE = 0, //
- _REASSIGNED_PREPARE_M_TO_A = 1, // 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
- _REASSIGNED_GET_NEW_CAP = 2, // 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
- _REASSIGNED_ADJUST_M_TO_A = 3, // 模塊重新分配完成
- _REASSIGNED_RELAY_M_TO_A = 4, // 切斷橋接的 Relay
- _REASSIGNED_PREPARE_A_TO_M = 11,
- _REASSIGNED_ADJUST_A_TO_M = 12, // 模塊升壓
- _REASSIGNED_RELAY_A_TO_M = 13, // 搭接橋接的 Relay
- _REASSIGNED_WAITING = 14,
- _REASSIGNED_COMP = 15
- };
- enum _MAIN_CHARGING_MODE
- {
- _MAIN_CHARGING_MODE_MAX = 0,
- _MAIN_CHARGING_MODE_AVER = 1,
- };
- enum _EXTRA_ERR_PROCESS
- {
- _EXTRA_ERR_PROCESS_NONE = 0,
- _EXTRA_ERR_PROCESS_INUVP = 1,
- _EXTRA_ERR_PROCESS_INOVP = 2,
- _EXTRA_ERR_PROCESS_PRIMARY = 3,
- };
- enum _CHARGER_TYPE
- {
- _CHARGER_TYPE_IEC = 0,
- _CHARGER_TYPE_UL = 1,
- };
- enum _SYS_WIFI_MODE
- {
- _SYS_WIFI_MODE_DISABLE = 0,
- _SYS_WIFI_MODE_STATION = 1,
- _SYS_WIFI_MODE_AP = 2
- };
- enum _LED_INTENSITY_LV
- {
- _LED_INTENSITY_DARKEST = 0,
- _LED_INTENSITY_MEDIUM = 1,
- _LED_INTENSITY_BRIGHTEST = 2
- };
- enum _CCS_COMM_PROTOCOL
- {
- _CCS_COMM_V2GMessage_DIN70121 = 0x01,
- _CCS_COMM_V2GMessage_ISO15118_2014 = 0x02,
- _CCS_COMM_V2GMessage_ISO15118_2018 = 0x03
- };
- enum _ETHERNET_USAGE
- {
- _ETHERNET_USAGE_NONE = 0,
- _ETHERNET_USAGE_LAN,
- _ETHERNET_USAGE_WIFI,
- _ETHERNET_USAGE_3G_4g
- };
- enum _CONN_STATUS
- {
- _Connnection_Disable = 0,
- _Connnection_Connected = 1,
- _Connnection_Disconnected = 2,
- };
- enum _LED_INDICATION_STATUS
- {
- _LED_INDICATION_OFF = 0, // all led off
- _LED_INDICATION_RUN = 1, // green led on, red led off
- _LED_INDICATION_FAULT = 2, // green led off, red led on
- _LED_INDICATION_ON = 3, // all led on
- _LED_INDICATION_GREEN_TOGGLE = 4, // green led toggle
- _LED_INDICATION_RED_TOGGLE = 5, // red led toggle
- };
- enum _STANDARD_INDICATION_STATUS
- {
- _STANDARD_LED_None = 0,
- _STANDARD_LED_Disconnection = 1,
- _STANDARD_LED_Running = 2,
- _STANDARD_LED_Alarm = 3,
- };
- enum _E4YOU_INDICATION_STATUS
- {
- _E4YOU_LED_None = 0,
- _E4YOU_LED_Disconnection = 1,
- _E4YOU_LED_Idle = 2,
- _E4YOU_LED_Charging = 3,
- _E4YOU_LED_Alarm = 4,
- };
- enum _QR_MODE
- {
- _QR_MODE_Default = 0,
- _QR_MODE_Customized = 1,
- _QR_MODE_ChargeBoxId = 2, // for audi
- };
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int PrimaryDisable:1; // 0: primary enable, 1: primary disable
- unsigned int RelayBoardDisable:1; // 0: relay board enable, 1: relay board disable
- unsigned int FanBoardDisable:1; // 0: fan board enable, 1: fan board disable
- unsigned int LedBoardDisable:1; // 0: led board enable, 1: led board disable
- unsigned int SecondRelayBoardEnable:1; // 0: second relay disable, 1: second relay enable
- unsigned int StandardLedIndication:1; // 0: no led indication, 1: enable standard led indication
- unsigned int E4YOULedIndication:1; // 0: no led indication, 1: enable e4you led indication
- unsigned int res:24;
- }bits;
- }SystemControl;
- typedef union
- {
- unsigned int AuthFlag;
- struct
- {
- unsigned int AutoStartEnable:1; // 0: disable, 1: enable auto charging after plug in
- unsigned int APPEnable:1; // 0: disable, 1: app auth enable
- unsigned int QRCodeEnable:1; // 0: disable, 1: qr code auth enable
- unsigned int RFIDEnable:1; // 0: disable, 1: rfid auth enable
- unsigned int res:24;
- }bits;
- }AuthModeInfo;
- typedef struct
- {
- AuthModeInfo AuthMode;
- unsigned char QRCodeMode; // 0: default, 1: customized, 2: audi type
- unsigned char res[3];
- }SystemAuthInfoData;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int DisableDoorSensor:1; // 0: door sensor enable, 1: door sensor disable
- unsigned int DisableEmergencyButton:1; // 0: emergency button enable, 1: emergency button disable
- unsigned int DoorSensorReverse:1; // 0: the same as ds's, 1: status is different from ds's
- unsigned int AcContactorReverse:1; // 0: the same as ds's, 1: status is different from ds's
- unsigned int res:27;
- }bits;
- }PrimaryControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int AcContactor:1; // 0: ac contactor off, 1: ac contactor on
- unsigned int AcContactorOffByPsu:1; // 0: no effect, 1: ac contactor off
- unsigned int AcContactorOffByEmergency:1; // 0: no effect, 1: ac contactor off
- unsigned int StandbyCountdown:1; // 0: charger is using, 1: start countdown
- unsigned int res:27;
- }bits;
- }RelayControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int res:31;
- }bits;
- }FanControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int res:31;
- }bits;
- }LedFanControl;
- typedef union
- {
- unsigned int CtrlValue;
- struct
- {
- unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
- unsigned int FailureResume:1; // 0: no error, 1: psu failure, need resume
- unsigned int res:30;
- }bits;
- }PsuControl;
- typedef struct
- {
- SystemControl SysCtrl;
- PrimaryControl PrimaryCtrl;
- RelayControl RelayCtrl;
- FanControl FanCtrl;
- LedFanControl LedCtrl;
- PsuControl PsuCtrl;
- }SysControl;
- // ************************************************************************************************* //
- typedef struct
- {
- bool CheckIn;
- unsigned char Address;
- unsigned char GroupNo;
- unsigned char Index;
- }PsuAddressInfoData;
- typedef struct
- {
- unsigned char GroupPsuQuantity;
- unsigned char PsuSN[MAX_MODULE_PER_GROUP];
- }GroupInfoData;
- typedef struct
- {
- bool PsuLocationInit;
- bool ReInitPsuLocation;
- unsigned char TotalPsuQuantity;
- GroupInfoData GroupLocationInfo[MAX_GROUP_QUANTITY];
- PsuAddressInfoData PsuAddressInfo[MAX_PSU_MODULE_QUANTITY];
- }PsuPositionInfoData;
- // ************************************************************************************************* //
- typedef enum
- {
- _GROLE_IDLE = 0,
- _GROLE_MASTER = 1,
- _GROLE_SLAVE = 2,
- _GROLE_SWITCH_TO_IDLE = 10,
- _GROLE_SWITCH_IDLE_OK = 11,
- _GROLE_SWITCH_TO_MASTER = 20,
- _GROLE_SWITCH_MASTER_OK = 21,
- _GROLE_SWITCH_TO_SLAVE = 30,
- _GROLE_SWITCH_SLAVE_OK = 31,
- }_GROUP_ROLE;
- typedef struct
- {
- unsigned char Index;
- unsigned char Role;
- unsigned char Location;
- unsigned char GroupMemberQuantity;
- unsigned char GroupMember[MAX_GROUP_QUANTITY];
- unsigned char TargetGroup; // group index + 1
- }PsuGroupCollectionData;
- typedef struct
- {
- byte Location[MAX_GROUP_QUANTITY];
- byte Layout[MAX_GROUP_QUANTITY];
- PsuGroupCollectionData GroupCollection[MAX_GROUP_QUANTITY];
- }PsuGroupingInfoData;
- // ************************************************************************************************* //
- typedef struct
- {
- SystemAuthInfoData AuthInfo;
- SysControl Control;
- PsuPositionInfoData PsuPosition;
- PsuGroupingInfoData PsuGrouping;
- }ChargerInfoData;
- #endif /* CONFIG_H_ */
|