|
winCE 触摸屏驱动 触摸屏原点和屏幕原点不在一个方向上
[复制链接]
进入winCE系统后,发现我的触摸屏原点和屏幕原点不在一个方向上。屏幕的原点在左上角,而触摸屏的原点在右下角。找到驱动程序源码,我把左上角和右下角的代码交换,左下角和右上角的交换。重新编译,再次进入系统后,发现貌似正常了,但是很不准,进入笔针去校正,怎么都校正不出来。我知道我这种办法是很笨的,也不是正确的。奈何刚接触嵌入式系统,对驱动程序一点都不了解。只想尽快弄一个能跑起来的系统,好好的从最基础的东西开时学习。请大家指点一下如何让它正常的跑起来,用什么方法才是正确的。先谢谢了。这里贴一下之前的代码。
extern "C" BOOL TouchDriverCalibrationPointGet(TPDC_CALIBRATION_POINT *pTCP)
{
INT32 cDisplayWidth = pTCP->cDisplayWidth;
INT32 cDisplayHeight = pTCP->cDisplayHeight;
int CalibrationRadiusX = cDisplayWidth/10;
int CalibrationRadiusY = cDisplayHeight/10;
switch (pTCP->PointNumber)
{
case 0: // Middle
pTCP->CalibrationX = cDisplayWidth/2;
pTCP->CalibrationY = cDisplayHeight/2;
break;
case 1: // Upper Left
pTCP->CalibrationX = CalibrationRadiusX*2;
pTCP->CalibrationY = CalibrationRadiusY*2;
break;
case 2: // Lower Left
pTCP->CalibrationX = CalibrationRadiusX*2;
pTCP->CalibrationY = cDisplayHeight - CalibrationRadiusY*2;
break;
case 3: // Lower Right
pTCP->CalibrationX = cDisplayWidth - CalibrationRadiusX*2;
pTCP->CalibrationY = cDisplayHeight - CalibrationRadiusY*2;
break;
case 4: // Upper Right
pTCP->CalibrationX = cDisplayWidth - CalibrationRadiusX*2;
pTCP->CalibrationY = CalibrationRadiusY*2;
break;
default:
pTCP->CalibrationX = cDisplayWidth/2;
pTCP->CalibrationY = cDisplayHeight/2;
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
return TRUE;
}
|
|