Module_EvComm.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef MODULE_EVCOMM_H_
  2. #define MODULE_EVCOMM_H_
  3. #include <stdbool.h>
  4. int CanFd;
  5. typedef unsigned char byte;
  6. extern struct Ev_Board_Cmd {
  7. int none; // 0
  8. int address_assignment; // 0x00000200
  9. int get_firmware_ver; // 0x00000400
  10. int get_hardware_ver; // 0x00000500
  11. int charging_permission; // 0x00000600
  12. int present_output_power; // 0x00000700
  13. int present_output_cap; // 0x00000800
  14. int get_output_req; // 0x00000900
  15. int get_battery_info; // 0x00000A00
  16. int evse_stop_charging; // 0x00000C00
  17. int get_miscellaneous_info; // 0x00000D00
  18. int download_req; // 0x00000E00
  19. int start_block_transfer; // 0x00000F00
  20. int data_transfer; // 0x00001000
  21. int download_finish; // 0x00001100
  22. int isolation_status; // 0x00001200
  23. int sync_rtc_info; // 0x00001400
  24. int evse_precharge_info; // 0x00001500
  25. } Ev_Cmd;
  26. extern struct Ev_Cmd_Dir {
  27. unsigned short master_to_slave;
  28. unsigned short slave_to_master;
  29. } Ev_Dir;
  30. struct timeval _id_assign_time;
  31. // Send msg to can-bus
  32. void SetTargetAddr(byte *target_number, byte index);
  33. void GetFirmwareVersion(byte gun_index, byte toId);
  34. void SyncRtcInfo(byte gun_index, byte toId, int epoch);
  35. void GetHardwareVersion(byte gun_index, byte toId);
  36. void SetChargingPermission(byte gun_index, byte permissionStatus, short aOutputPw, short aOutputVol, short aOutputCur, byte toId);
  37. void SetPresentOutputPower(short outputVol_b1, short outputCur_b1, short outputVol_b2, short outputCur_b2);
  38. void SetPresentOutputCapacity(short aOutputPw_b1, short aOutputCur_b1, short aOutputPw_b2, short aOutputCur_b2);
  39. void GetOutputReq(byte gun_index, byte toId);
  40. void GetEvBatteryInfo(byte gun_index, byte toId);
  41. void GetMiscellaneousInfo(byte gun_index, byte relayStatus, float power, float voltage, byte toId);
  42. void SetIsolationStatus(byte gun_index, byte result, byte toId);
  43. void SetEvsePrechargeInfo(byte gun_index, byte result, byte toId);
  44. // 發送電樁主動停止充電結果及原因
  45. void EvseStopChargingEvent(byte stopResult, byte *stopReason, byte toId);
  46. // Receive msg From can-bus.
  47. enum Receieve_PSU_msgf {
  48. // 車端主動
  49. ADDRESS_REQ = 0x080001FF,
  50. NOTIFICATION_EV_STATUS = 0x08000300,
  51. NOTIFICATION_EV_STOP = 0x08000B00,
  52. // 車端回應
  53. ACK_EV_FW_VERSION = 0x08000400,
  54. ACK_EV_HW_VERSION = 0x08000500,
  55. ACK_GET_OUTPUT_REQ = 0x08000900,
  56. ACK_GET_EV_BATTERY_INFO = 0x08000A00,
  57. ACK_GET_MISCELLANEOUS_INFO = 0x08000D00,
  58. ACK_EVSE_ISOLATION_STATUS = 0x08001200,
  59. ACK_EVSE_PRECHAGE_INFO = 0x08001500,
  60. };
  61. //DS60-120 add
  62. enum EV_LOG_INDEX {
  63. EV_LOG_OUTPUT_CAP_POW = 0,
  64. EV_LOG_OUTPUT_CAP_CUR = 1,
  65. EV_LOG_NOW_OUTPUT_VOL = 2,
  66. EV_LOG_NOW_OUTPUT_CUR = 3,
  67. EV_LOG_EVSE_MAX_VOL = 4,
  68. EV_LOG_EVSE_MAX_CUR = 5,
  69. EV_LOG_MAX_BATT_VOL = 6,
  70. EV_LOG_REAL_CAP_POW = 7,
  71. EV_LOG_SOC = 8
  72. };
  73. #endif /* MODULE_EVCOMM_H_ */