|
#define TOUCH_MAX_X 1000 // 950
#define TOUCH_MIN_X 30 // 90
#define TOUCH_MAX_Y 980 // 960 // 910
#define TOUCH_MIN_Y 30 // 70 //50
#define TOUCH_X 800
#define TOUCH_Y 480
VOID Touch_CoordinateConversion(INT *px, INT *py)
{
INT TmpX, TmpY;
INT TmpX0, TmpY0;
TmpX0 = *px; TmpY0 = *py;
TmpX = (*px >= TOUCH_MAX_X) ? (TOUCH_MAX_X-1) : *px;
TmpY = (*py >= TOUCH_MAX_Y) ? (TOUCH_MAX_Y-1) : *py;
TmpX -= TOUCH_MIN_X;
TmpY -= TOUCH_MIN_Y;
//#ifdef YC_2440_SUPPORT
#ifndef YC_2440_SUPPORT
TmpX = (TmpX >= 0) ? TmpX : 0;
TmpY = (TmpY >= 0) ? TmpY : 0;
#else
TmpX = (TmpX) ? TmpX : 0;
TmpY = (TmpY) ? TmpY : 0;
#endif
*px = ((TmpX * TOUCH_X) / (TOUCH_MAX_X-TOUCH_MIN_X))*4;
*py = ((TmpY * TOUCH_Y) / (TOUCH_MAX_Y-TOUCH_MIN_Y))*4;
请教朋友们,这里面的TOUCH_MAX_X,等参数是怎么取得的啦,这个驱动与下面这个的转换区别在哪里呀!!!
TSP_TransXY(INT *px, INT *py)
{
*px = (*px - TSP_MINX) * TSP_LCDX / (TSP_MAXX - TSP_MINX);
*py = (*py - TSP_MINY) * TSP_LCDY / (TSP_MAXY - TSP_MINY);
if (*px < 0) *px = 0;
if (*px >= TSP_LCDX) *px = TSP_LCDX - 1;
if (*py < 0) *py = 0;
if (*py >= TSP_LCDY) *py = TSP_LCDY - 1;
}
其中#define TSP_MINX 60
#define TSP_MINY 60
#define TSP_MAXX 3000
#define TSP_MAXY 3000
#define TSP_LCDX (LCD_XSIZE_TFT * 4)
#define TSP_LCDY (LCD_YSIZE_TFT * 4)
|
|