123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- #ifndef __CONFIGMACROS_H
- #define __CONFIGMACROS_H
- #include "oled.h"
- #include "mba32a.h"
- #include "ml307a.h"
- #include <stdlib.h>
- #include "interface.h"
- #define BUFFER_SIZE 256
- #define open4G 1
- #define openBT 1
- #define updateMenu 1
- #define debugkeyinfo 0
- #define open16 11 //开字
- #define open16 11 //开字
- #define close16 12 //关字
- #define PDA_MODE 0x0000
- #define DTU_MODE 0x0001
-
- #define PRINT_MENU_STATUS(key) printf("--->%s pressed\t%d %d %x %d\n", key, menu.current, menu.up, (menu.next&0xf), menu.enter)
- #define PRINT_UUID(message) printf("#%s符合设置项\n",message)
- #define PRINT_NUUID(message) printf("%s不符合\n",message)
- #define Sn1InfoAddr ((uint32_t)0x8050000)
- #define Sn2InfoAddr ((uint32_t)0x8050100)
- #define Sn3InfoAddr ((uint32_t)0x8050200)
- #define Sn4InfoAddr ((uint32_t)0x8050300)
- #define serialNum1Addr ((uint32_t)0x8050400)
- #define serialNum2Addr ((uint32_t)0x8050500)
- #define serialNum3Addr ((uint32_t)0x8050600)
- #define serialNum4Addr ((uint32_t)0x8050700)
- #define resetDevAddr ((uint32_t)0x8050800)
- #define SysModeAddr ((uint32_t)0x8050900)
- #define LocDbHeadStart ((uint32_t)0x8060000)
- #define LocDbBodyStart ((uint32_t)0x8060800)
- #define EveDbHeadStart ((uint32_t)0x8070000)
- #define EveDbBodyStart ((uint32_t)0x8070800)
- //*tt808
- #define JLPTIP "121.199.29.128"
- #define JLPTPORT 7342
- #define XXID_zdjq 0x0102 //鉴权
- #define XXID_zdxt 0x0002 //心跳
- #define XXID_zddz 0x0200 //地址
- #define TCPJMFSRSA 0x001
- #define TCPJMFSNULL 0x000
- #define TT808FLAG 0x7E
- #define TCPHeadBYTE 0x2A
- #define TCPTAILBYTE 0x23
- #define XXID_pttyyd 0x8001 //通用应答
- #define XXID_ptxxtc 0x8900 //下行透传
- #define XXID_zdtyyd 0x0001 //终端通用应答
- #define YES 0x00
- #define NO 0x01
- /* WDI */
- #define TOGGLE_WDI_PIN(htim_instance) \
- do { \
- if ((htim_instance)->Instance == TIM2) { \
- HAL_GPIO_TogglePin(WDI_GPIO_Port, WDI_Pin); \
- } \
- } while(0)
- /* OLED显示 */
- #define OLED_DISPLAY(color, display) do { \
- OLED_Init(); \
- OLED_ColorTurn(color); \
- OLED_DisplayTurn(display); \
- } while(0)
- /* U1-U4 DMA */
- #define IDLE_DMA_UART(huart) \
- do {\
- __HAL_UART_ENABLE_IT(huart, UART_IT_IDLE); \
- } while(0)
- /* SYETEM init */
- #define START_PROCESS() \
- do { \
- printf("go\r\n"); \
- menu.current = 0xBB; \
- tipsflag = Starting; \
- Jump_interface(); \
- OLED_Refresh(); \
- } while(0)
- #define SET_MENU_STATUS(current_value, up_value, next_value, enter_value) \
- do { \
- menu.current = current_value; \
- menu.up = up_value; \
- menu.next = next_value; \
- menu.enter = enter_value; \
- refresh = true;\
- } while(0)
- typedef struct
- {
- uint8_t current; //当前状态索引号
- uint8_t up; //向下一个
- uint8_t next; //向下一个
- uint8_t enter; //确定
- uint32_t home;
- uint8_t PreNext;
-
- } Menu_table;
- #define RESET_4G_MODULE() \
- do { \
- if(reset4Gmodule) { \
- reset4Gmodule = false; \
- HAL_Delay(2000); \
- ML307A_Init(); \
- } \
- } while(0)
- typedef struct
- {
- //四位数字(施解封显示)
- char SN1name[5];
- char SN2name[5];
- char SN3name[5];
- char SN4name[5];
- //AT连接字符串
- char* SN1CONN;
- char* SN1ED;
- char* SN1DIS;
- char* SN2CONN;
- char* SN2ED;
- char* SN2DIS;
- char* SN3CONN;
- char* SN3ED;
- char* SN3DIS;
- char* SN4CONN;
- char* SN4ED;
- char* SN4DIS;
- //MAC
- uint16_t mac1[3];
- uint16_t mac2[3];
- uint16_t mac3[3];
- uint16_t mac4[3];
- //Status
- uint8_t L1status;
- uint8_t L2status;
- uint8_t L3status;
- uint8_t L4status;
- } LockInfo;
- typedef enum {
- Starting = 0,
- Btconn = 1,
- ConnOK = 2,
- ConnFail=3,
- Nosn =4,
- Timeout = 5,
- Working =6,
- FinshOK =7,
- Fail4G =8,
- Nosignal =9
- } TipsFlag;
- struct keys
- {
- unsigned char judge_sta; //判断按键按键按下的动作到了第几步
- bool key_sta; //如果按键被按下,为0
- bool key_flag; //如果确认被按下,为1
- bool long_flag; //如果确认被按下,为1
- uint8_t key_time;
- };
- // 定义结构体来存储对应信息
- struct BtMenuItem {
- int key;
- char *name;
- char *command;
- char *feedback;
- };
- // 定义一个结构体存储对应关系
- typedef struct {
- char *command;
- char *connected_msg;
- char *disconnected_msg;
- uint64_t mac;
- } MenuInfo;
- typedef struct
- {
- uint32_t serialNum1; //4字节流水号
- uint32_t serialNum2; //4字节流水号
- uint32_t serialNum3; //4字节流水号
- uint32_t serialNum4; //4字节流水号
- uint32_t userId; //4字节userid
- uint8_t Autoseal; //1字节自动施封
-
- } BtFrame;
- typedef enum {
- BtStepDefault = 0,
- UUIDS = 1,
- UUIDN = 2,
- UUIDW = 3,
- TxPower = 4
- } BtStep;
- typedef struct {
- uint8_t LSH;
-
- uint8_t Rtime[6];
-
- uint32_t C_Seconds;
- uint8_t L1Lockstatus;
- uint8_t L2Lockstatus;
- uint8_t L3Lockstatus;
- uint8_t L4Lockstatus;
-
- uint16_t Speed;
- uint32_t WD_u32;
- uint32_t JD_u32;
- } TT808;
- typedef struct {
-
- uint16_t LOC_InitInfo[4]; //0xFA0 //4000 * 14B
- uint16_t EVE_InitInfo[4]; //0x7D0 //2000 * 28B
-
- uint16_t timeStamp[2]; //时间戳(世纪秒)
-
- uint16_t WD_u16[2];
- uint16_t JD_u16[2];
-
- //*位置db使用
- uint16_t speed[1]; //速度
-
- //*状态db使用
- uint16_t LockSn[3]; //锁编号
- uint16_t OperationType[1]; //操作类型
- uint16_t OperationResults[1]; //操作结果
- uint16_t perators[2]; //操作人
- uint16_t ElectricityLevel[1]; //电量
-
- } Database;
- #endif /*__CONFIGMACROS_H*/
|