app.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 (1) //BMS制造商表示1-超力源,2-美顺
  17. #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
  18. #define BMS_INFO (2) //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
  19. #if BMS_MANUFACTURE==1
  20. #if BMS_INFO==1
  21. #define BATT_CELL_VOL_NUM (14)
  22. #define BATT_TEMP_NUM (3)
  23. #define BATT_OTHER_TEMP_NUM (2)
  24. #elif BMS_INFO==2
  25. #define BATT_CELL_VOL_NUM (17)
  26. #define BATT_TEMP_NUM (5)
  27. #define BATT_OTHER_TEMP_NUM (2)
  28. #endif
  29. #elif BMS_MANUFACTURE==2
  30. #if BMS_INFO==1
  31. #define BATT_CELL_VOL_NUM (20)
  32. #define BATT_TEMP_NUM (3)
  33. #define BATT_OTHER_TEMP_NUM (2)
  34. #elif BMS_INFO==2
  35. #define BATT_CELL_VOL_NUM (17)
  36. #define BATT_TEMP_NUM (4)
  37. #define BATT_OTHER_TEMP_NUM (2)
  38. #endif
  39. #endif
  40. #define BATT_CELL_VOL_NUM_2 (BATT_CELL_VOL_NUM*2)
  41. #define HWVERSION 0x0102 //硬件主版本,现为V1.2板
  42. #define BLSWVERSION 0x01020000 //BootLoader版本号V1.2.0.0
  43. #define DRVSWVERSION 0x01040000 //驱动层版本号V1.4.0.0
  44. #define APPSWVERSION 0x01030000
  45. //#define APPSWVERSION 0x02000007
  46. //--------------------------------------------------------------------------------
  47. #define APP_CONFIG_FILE_LATEST_VERSION 0
  48. #define APP_CONFIG_FILE_NAME "qxappconfig.nvm"
  49. #define APP_DATAINFO_FILE_NAME "qxappDataInfo.nvm"
  50. #define BATT_SN_LEN 17
  51. typedef struct AppNVMDataType
  52. {
  53. BOOL appDataModify; //数据更改标志位
  54. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  55. BOOL isBattLocked; //0:not locked; 1:locked
  56. UINT8 chargEndWorkTime; //the unit is min
  57. UINT8 wakeupWorkTime; //the unit is min
  58. UINT8 sleepTime;
  59. UINT16 HwVersion;
  60. UINT32 BLSwVersion;
  61. UINT32 DrvSwVersion;
  62. UINT32 AppSwVersion;
  63. UINT8 EOLState;
  64. }AppNVMDataType;
  65. typedef struct AppConfigHeader
  66. {
  67. UINT16 fileBodySize; //file body size, not include size of header;
  68. UINT8 version;
  69. UINT8 checkSum;
  70. }AppConfigHeader;
  71. typedef struct _UartAnswerMsg
  72. {
  73. bool UartFlag;
  74. UINT8 dataPtr[8];
  75. UINT16 len;
  76. }UartAnswerMsgType;
  77. typedef enum
  78. {
  79. APP_INIT_STATE,
  80. APP_DEACTIVE_STATE,
  81. APP_IPREADY_STATE,
  82. APP_REPORT_STATE,
  83. APP_IDLE_STATE,
  84. APP_WAIT_STATE
  85. } appRunningState_t;
  86. //uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece_buffer,uint8_t Data_Len);
  87. //累计数据结构体
  88. typedef struct AppDataType
  89. {
  90. BOOL appDataModify; //数据更改标志位
  91. UINT8 BmsChrgInfoSendFreq;
  92. UINT8 BmsDisChrgInfoSendFreq;
  93. UINT8 GpsChrgInfoSendFreq;
  94. UINT8 GpsDisChrgInfoSendFreq;
  95. UINT32 CumulativeCapacity;
  96. }AppDataBody;
  97. typedef struct _AppDataHeader
  98. {
  99. UINT16 fileBodySize; //file body size, not include size of header;
  100. UINT8 checkSum;
  101. }AppDataHeader;
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105. #endif /* APP_H */