
#ifndef _RTP_FUNC_H_
#define _RTP_FUNC_H_

#include "type.h"

typedef struct
{
	bool (*scan)(u16 *,u16 *);				  											//扫描触摸屏.0,屏幕扫描;1,物理坐标;
	UINT8   sta;  																			//状态标志  0：未按下    1：被按下   2：按下后，未被释放
	UINT16  x[5];    																		//屏坐标
	UINT16  y[5];    																		//屏坐标
	UINT16  px;   																			//物理坐标
	UINT16  py;   																			//物理坐标
	UINT8   readspace;   																			//2次坐标读取间隔

	UINT32  flag; 																			//从flash中读取得到，当值为0x5a，则表示flash里存有4个参数
	float   xfac;
	float   yfac;
	float   xoff;
	float   yoff;
}TP_INFO;


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_INFO gTpInfo;

extern TP_xfac gTpxfac;
extern TP_xoff gTpxoff;
extern TP_yfac gTpyfac;
extern TP_yoff gTpyoff;

extern bool RTP_Calibrate(void);
extern bool RTP_ReadXY(UINT16 *x,UINT16 *y);
extern void RTP_Init(void);

void LT_TpSaveAdjdata(void);
UINT8 LT_TpGetAdjdata(void);

#endif