Module_EvComm.h 2.6 KB

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