#ifndef _data_h
#define _data_h
#include "type.h"


#if R_TOUCH_FLAG
#include "rtp.h"
#endif

#if FT_TOUCH_FLAG
//#include "ft5216.h"
#endif

#if (UART_485_CAN_FLAG==2)
#define 		RX_SIZE (2048+2+6)											//用来控制USART接收数据的宏
#else
#define 		RX_SIZE (2048+2)												//用来控制USART接收数据的宏
#endif

#define 		WAV_ADDR 0x00001700

//#if   MODULE_B8_B9
#define 		H_PWM_VAL 256													//用来控制wav数据量的宏
extern u16 bufPos;
extern u8  wbuf_select,wbuf0_Stat,wbuf1_Stat;
extern u8  wavBuf0[2048];
extern u8  wavBuf1[2048]; 													//用来控制喇叭的全局变量

extern u32 gWavFlashAddr;
extern u32 gTempWavFlashAddr ;
extern u32 gWavLen;
extern u8  gWavFlag;
extern u8  gWavState;
extern u8  gWavType;
extern u8  gWavOpen;
extern u16  gWavLast;

extern UINT8 gWavOpenDelay_Count;

extern UINT8 gWavAddrFull_Flag;
extern UINT8 gWavFinish_Flag;

extern UINT16 gWavDMA_Len_buf0;
extern UINT16 gWavDMA_Len_buf1;
//#endif

extern u8  gRxFlag;
extern u8  busyflag;
typedef struct
{
	u8  Flag;																				//数据接收完成标志
	u8  Buf[RX_SIZE];
	u16 Count;
}USART_RX_INFO;

extern USART_RX_INFO gUsartRx;										//用于串口接收


#define 		TP_PRES_DOWN 0x80  										//触屏被按下	  
#define 		TP_CATH_PRES 0x40  										//有按键按下了 
#define 		CT_MAX_TOUCH  5    										//电容屏支持的点数,固定为5点
typedef struct
{
	u8 (*scan)(void);				  											//扫描触摸屏.0,屏幕扫描;1,物理坐标;	 
	u8   sta;  																			//状态标志  0：未按下    1：被按下   2：按下后，未被释放
	u16  x[CT_MAX_TOUCH];    												//屏坐标
	u16  y[CT_MAX_TOUCH];    												//屏坐标
	u16  px;   																			//物理坐标
	u16  py;   																			//物理坐标
	
	u32  flag; 																			//从flash中读取得到，当值为0x5a，则表示flash里存有4个参数
	float     xfac;
	float     yfac;
	float     xoff;
	float     yoff;
}TP_INFO;

typedef union {

	 float x;
       char s[4];
}TP_TEST;

typedef union {

	 float xfac;
       char s[4];
}TP_xfac;

typedef union {

	 float xoff;
       char s[4];
}TP_xoff;

typedef union {

	 float yfac;
       char s[4];
}TP_yfac;

typedef union {

	 float yoff;
       char s[4];
}TP_yoff;
extern TP_xfac gTpxfac;
extern TP_xoff gTpxoff;
extern TP_yfac gTpyfac;
extern TP_yoff gTpyoff;

extern TP_TEST gTptest;

extern TP_INFO gTpInfo;														//电容屏所需相关参数

extern u16 gControlDuty;													//控制背光亮度

extern u8 Update_Flag;

extern UINT8 First_press;
extern UINT16 First_pressX,First_pressY;
#endif
