#ifndef __DWIN_H
#define __DWIN_H
#include "stm32f7xx_hal.h"
//#include "cmd_queue.h"


#define STARTSIGN_H    0x5a     //帧头高字节
#define STARTSIGN_L    0xa5	    //帧头低字节
#define CMDBUF_SIZE    50
#define BLACK          0x0000	  //黑色
#define RED            0xF000	  //红色
//#define BLUE				 0x001F	  //深蓝色
#define BLUE				   0x041f	  //蓝色
#define GREEN				   0x07E0	  //青色
#define YELLOW         0xFFF0   //黄色
#define YELLOW1        0xbae0


typedef  struct	 
{
   uint8_t    Cmd_Flag;		//命令标志位
   uint16_t   Cmd_Addr;		//接收到的命令
   uint32_t   Cmd_Data;		//接收到的数据
}RxCmdArray;

typedef  struct	
{
	uint8_t key;//按键键值
	uint8_t Key_up_flag;//按键按下有数据输入
	uint8_t mode;//系统运行模式 0系统运行  1调试模式  2
	uint8_t current_page;//当前界面
	uint8_t Main_Page_id;//主界面ID
	uint8_t Full_oil_id;//装油界面
	uint8_t offLoading_oil_id;//卸油界面ID
	uint8_t Liquid_id;  //液位温度页面ID
}Run_mode_key;
extern Run_mode_key Run_mode_key_info;
extern uint8_t Lcd_sleep_flag;
 
extern uint8_t time_Set_Dwin[14];
extern uint8_t DateDwin[8];
void GetDateFromDwin(void);

void WrDwinCmd8(uint16_t addr16,uint8_t data8);
void WrDwinCmd16(uint16_t addr16,uint16_t data16);
void WrDwinCmd32(uint16_t addr16,uint32_t data32);
void WrDwinBuf16(uint16_t addr16,uint16_t *buf);
void WrDwinBuf32(uint16_t addr16,uint16_t *buf);
//void WrDwinBuf(uint16_t addr16,uint16_t *buf,uint8_t n);
void WrDwinBuf(uint16_t addr16,uint16_t *buf,uint16_t n,uint8_t LSB_Mode);
void RdDwinData16(uint16_t addr16,uint8_t len);
void RdDwinData32(uint16_t addr16,uint8_t len);
void Lcd_Cmd_Handle(void);
void Lcd_Init(void );//IO_Data_frame
void Dispaly_CarAndValveState(void);
void Jump_page_id(uint8_t id);
void FULL_oil_draw(uint8_t mode,uint8_t se_data);
void Off_loading_draw(uint8_t se_data);
void PopWinCmdFunc(uint8_t *buf);
void Read_REAL_Time(void);
void Wakeup_lcd(void);
void Display_input_time(uint8_t flag,uint8_t *time);
void Send_Time(uint8_t * time);
void Dispay_login(uint8_t flag,uint8_t pawd_num);
void Go_homepage(void);

void Restart_LCD(void);

void WrDwinBuf_u8(uint16_t addr16,uint8_t *buf,uint8_t n);
#endif


