Module_PsuComm.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include <sys/time.h>
  2. #include <sys/timeb.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <sys/ioctl.h>
  7. #include <sys/socket.h>
  8. #include <sys/ipc.h>
  9. #include <sys/shm.h>
  10. #include <sys/shm.h>
  11. #include <sys/mman.h>
  12. #include <linux/wireless.h>
  13. #include <linux/can.h>
  14. #include <linux/can/raw.h>
  15. #include <arpa/inet.h>
  16. #include <netinet/in.h>
  17. #include <unistd.h>
  18. #include <stdarg.h>
  19. #include <stdio.h> /*標準輸入輸出定義*/
  20. #include <stdlib.h> /*標準函數庫定義*/
  21. #include <unistd.h> /*Unix 標準函數定義*/
  22. #include <fcntl.h> /*檔控制定義*/
  23. #include <termios.h> /*PPSIX 終端控制定義*/
  24. #include <errno.h> /*錯誤號定義*/
  25. #include <errno.h>
  26. #include <string.h>
  27. #include <time.h>
  28. #include <ctype.h>
  29. #include <ifaddrs.h>
  30. #include <math.h>
  31. #include "../../define.h"
  32. #include <stdbool.h>
  33. typedef unsigned char byte;
  34. typedef unsigned short word;
  35. typedef unsigned int unit;
  36. #define PREPARE_STEP_NONE 0
  37. #define PREPARE_STEP_CABLE_CHECK 1
  38. #define PREPARE_STEP_GFD_DONE 2
  39. #define PREPARE_STEP_PRECHARGE 3
  40. #define PREPARE_STEP_CHARGING 4
  41. struct ChargingInfoData *chargingInfo[CONNECTOR_QUANTITY];
  42. bool isStartOutputSwitch[CONNECTOR_QUANTITY];
  43. bool isCharging = false;
  44. bool isWaitingAver = false;
  45. bool isReadToCharging = false;
  46. bool CanAverageCharging = false;
  47. int preChargingTarget;
  48. int preChargingCur;
  49. float toAverVolPoint;
  50. byte toAverVolCount;
  51. int connector_1[12];
  52. int connector_2[12];
  53. byte conn_1_count = 0;
  54. byte conn_2_count = 0;
  55. enum _PSU_CMD_SEQ
  56. {
  57. _PSU_CMD_STATUS = 1,
  58. _PSU_CMD_VERSION = 2,
  59. _PSU_CMD_CAP = 10,
  60. _PSU_CMD_OUTPUT = 11,
  61. _PSU_CMD_IVAILIABLE = 12,
  62. _PSU_CMD_TEMP = 13
  63. };
  64. enum _CURRENT_CONFIG_MODE
  65. {
  66. _CURRENT_MODE_NONE = 0,
  67. _CURRENT_MODE_BALANCE = 1,
  68. _CURRENT_MODE_INCREASE = 2,
  69. _CURRENT_MODE_DECREASE = 3,
  70. _CURRENT_MODE_DERATING = 4,
  71. };