void GUI_TOUCH_Exec(void) {
#ifndef WIN32
static U8 ReadState;
int x,y;
/* calculate Min / Max values */
if (xyMinMax[GUI_COORD_X].Min < xyMinMax[GUI_COORD_X].Max) {
xMin = xyMinMax[GUI_COORD_X].Min;
xMax = xyMinMax[GUI_COORD_X].Max;
} else {
xMax = xyMinMax[GUI_COORD_X].Min;
xMin = xyMinMax[GUI_COORD_X].Max;
}
if (xyMinMax[GUI_COORD_Y].Min < xyMinMax[GUI_COORD_Y].Max) {
yMin = xyMinMax[GUI_COORD_Y].Min;
yMax = xyMinMax[GUI_COORD_Y].Max;
} else {
yMax = xyMinMax[GUI_COORD_Y].Min;
yMin = xyMinMax[GUI_COORD_Y].Max;
}
/* Execute the state machine which reads the touch */
switch (ReadState) {
case 0:
yPhys = TOUCH_X_MeasureY();
TOUCH_X_ActivateY(); /* Prepare X- measurement */
ReadState++;
break;
default:
xPhys = TOUCH_X_MeasureX();
TOUCH_X_ActivateX(); /* Prepare Y- measurement */
/* Convert values into logical values */
#if !GUI_TOUCH_SWAP_XY /* Is X/Y swapped ? */
x = xPhys;
y = yPhys;
#else
x = yPhys;
y = xPhys;
#endif
if ((x < xMin) || (x > xMax) || (y < yMin) || (y > yMax)) {
_StoreUnstable(-1, -1);
} else {
x = _AD2X(x);
y = _AD2Y(y);
_StoreUnstable(x, y);
}
/* Reset state machine */
ReadState = 0;
break;
}
#endif /* WIN32 */
}
void GUI_TOUCH_X_ActivateX(void) {
}
void GUI_TOUCH_X_ActivateY(void) {
}
请哪位高手帮我把GUI_TOUCH_Exec(void)这个程序解释下,特别是ReadState变量的作用。例外GUI_TOUCH_X_ActivateX(void),GUI_TOUCH_X_ActivateY(void)两个函数在移植时是空的,我该如何编写其定义程序,谢谢。有这方面好的资料推荐下,我愿意花钱买。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>