app.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /****************************************************************************
  2. *
  3. * Copy right: 2017-, Copyrigths of EigenComm Ltd.
  4. * File name: app.h
  5. * Description: EC616 onenet demo entry header file
  6. * History: Rev1.0 2018-07-12
  7. *
  8. ****************************************************************************/
  9. #include "commontypedef.h"
  10. #ifndef APP_H
  11. #define APP_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. //全局定义声明区
  16. #define BMS_MANUFACTURE (2) //BMS制造商表示1-超力源,2-美顺
  17. #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
  18. #define BMS_INFO (1) //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
  19. #define EOLSTATE (1) //1标识下线检测跳过,使用默认值
  20. #if BMS_MANUFACTURE==1
  21. #if BMS_INFO==1
  22. #define BATT_CELL_VOL_NUM (14)
  23. #define BATT_TEMP_NUM (3)
  24. #define BATT_OTHER_TEMP_NUM (2)
  25. #elif BMS_INFO==2
  26. #define BATT_CELL_VOL_NUM (17)
  27. #define BATT_TEMP_NUM (4)
  28. #define BATT_OTHER_TEMP_NUM (2)
  29. #endif
  30. #elif BMS_MANUFACTURE==2
  31. #if BMS_INFO==1
  32. #define BATT_CELL_VOL_NUM (20)
  33. #define BATT_TEMP_NUM (3)
  34. #define BATT_OTHER_TEMP_NUM (2)
  35. #elif BMS_INFO==2
  36. #define BATT_CELL_VOL_NUM (17)
  37. #define BATT_TEMP_NUM (4)
  38. #define BATT_OTHER_TEMP_NUM (2)
  39. #elif BMS_INFO==3
  40. #define BATT_CELL_VOL_NUM (20)
  41. #define BATT_TEMP_NUM (4)
  42. #define BATT_OTHER_TEMP_NUM (2)
  43. #endif
  44. #endif
  45. #define NB_OTHER_TEMP_NUM (4) //NB采集的温度个数
  46. #define BATT_CELL_VOL_NUM_2 (BATT_CELL_VOL_NUM*2)
  47. #define HWVERSION 0x0102 //硬件主版本,现为V1.2板
  48. #define BLSWVERSION 0x01020000 //BootLoader版本号V1.2.0.0
  49. #define DRVSWVERSION 0x01050000 //驱动层版本号V1.4.0.0 驱动层1.5.0.0,增加了三轴
  50. //#define APPSWVERSION 0x01020209
  51. //#define APPSWVERSION 0x02000103
  52. #define APPSWVERSION 0x01010000
  53. //--------------------------------------------------------------------------------
  54. #define APP_CONFIG_FILE_LATEST_VERSION 0
  55. #define APP_CONFIG_FILE_NAME "qxappconfig.nvm"
  56. #define APP_DATAINFO_FILE_NAME "qxappDataInfo.nvm"
  57. #define BATT_SN_LEN 17
  58. typedef struct AppNVMDataType
  59. {
  60. BOOL appDataModify; //数据更改标志位
  61. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  62. BOOL isBattLocked; //0:not locked; 1:locked
  63. UINT8 chargEndWorkTime; //the unit is min
  64. UINT8 wakeupWorkTime; //the unit is min
  65. UINT8 sleepTime;
  66. UINT16 HwVersion;
  67. UINT32 BLSwVersion;
  68. UINT32 DrvSwVersion;
  69. UINT32 AppSwVersion;
  70. UINT8 EOLState;
  71. }AppNVMDataType;
  72. typedef struct AppConfigHeader
  73. {
  74. UINT16 fileBodySize; //file body size, not include size of header;
  75. UINT8 version;
  76. UINT8 checkSum;
  77. }AppConfigHeader;
  78. typedef struct _UartAnswerMsg
  79. {
  80. BOOL UartFlag;
  81. UINT8 dataPtr[8];
  82. UINT16 len;
  83. }UartAnswerMsgType;
  84. typedef enum
  85. {
  86. APP_INIT_STATE,
  87. APP_DEACTIVE_STATE,
  88. APP_IPREADY_STATE,
  89. APP_REPORT_STATE,
  90. APP_IDLE_STATE,
  91. APP_WAIT_STATE
  92. } appRunningState_t;
  93. //uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece_buffer,uint8_t Data_Len);
  94. //累计数据结构体
  95. typedef struct AppDataType
  96. {
  97. BOOL appDataModify; //数据更改标志位
  98. UINT8 BmsChrgInfoSendFreq;
  99. UINT8 BmsDisChrgInfoSendFreq;
  100. UINT8 GpsChrgInfoSendFreq;
  101. UINT8 GpsDisChrgInfoSendFreq;
  102. INT8 BattCurrentNegFlag;
  103. UINT32 CumulativeCapacity;
  104. UINT32 AccMileage;
  105. UINT16 SysReStart;
  106. }AppDataBody;
  107. typedef struct _AppDataHeader
  108. {
  109. UINT16 fileBodySize; //file body size, not include size of header;
  110. UINT8 checkSum;
  111. }AppDataHeader;
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif /* APP_H */