初级会员
- 积分
- 115
- 金钱
- 115
- 注册时间
- 2013-11-22
- 在线时间
- 0 小时
|
楼主 |
发表于 2013-12-27 14:41:09
|
显示全部楼层
void _ExecCalibration(void) {
int ax_Phys[2],ay_Phys[2];
/* calculate log. ositions */
int ax[2] = { 15, LCD_XSIZE -1-15};
int ay[2] = { LCD_YSIZE-1-15, 15};
CalibrationComplete = 0;
GUI_TOUCH_SetDefaultCalibration();
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_SetColor(GUI_WHITE); GUI_FillCircle(ax[0], ay[0], 10);
GUI_SetColor(GUI_RED); GUI_FillCircle(ax[0], ay[0], 5);
GUI_SetColor(GUI_WHITE);
GUI_DispStringAt("Press here", ax[0]+20, ay[0]);
do {
GUI_PID_STATE State;
GUI_TOUCH_GetState(&State);
if (State.Pressed) {
ax_Phys[0] = GUI_TOUCH_GetxPhys();
ay_Phys[0] = GUI_TOUCH_GetyPhys();
break;
}
GUI_Delay (100);
} while (1);
/* Tell user to release */
GUI_Clear();
GUI_DispStringAt("OK", ax[0]+20, ay[0]);//告诉别人可以放开
do {
GUI_PID_STATE State;
GUI_TOUCH_GetState(&State);
if (State.Pressed == 0) {
break;
}
GUI_Delay (100);
} while (1);//放开才继续往下执行
/* _Calibrate lower right */
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
GUI_SetColor(GUI_WHITE); GUI_FillCircle(ax[1], ay[1], 10);
GUI_SetColor(GUI_RED); GUI_FillCircle(ax[1], ay[1], 5);
GUI_SetColor(GUI_WHITE);
GUI_SetTextAlign(GUI_TA_RIGHT);
GUI_DispStringAt("Press here", ax[1]-20, ay[1]);
do {
GUI_PID_STATE State;
GUI_TOUCH_GetState(&State);
if (State.Pressed) {
ax_Phys[1] = GUI_TOUCH_GetxPhys();
ay_Phys[1] = GUI_TOUCH_GetyPhys();
break;
}
GUI_Delay (100);
} while (1);
GUI_TOUCH_Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1]);
GUI_TOUCH_Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1]);
{ /* calculate and display values for configuration file */
int x0, x1;
int y0, y1;
GUI_Clear();
_Calibrate(GUI_COORD_X, ax[0], ax[1], ax_Phys[0], ax_Phys[1], &x0, &x1);
_Calibrate(GUI_COORD_Y, ay[0], ay[1], ay_Phys[0], ay_Phys[1], &y0, &y1);
GUI_DispStringAt("x0: ", 0, 0); GUI_DispDec(x0, 4); GUI_DispNextLine();
GUI_DispString ("x1: "); GUI_DispDec(x1, 4); GUI_DispNextLine();
GUI_DispString ("y0: "); GUI_DispDec(y0, 4); GUI_DispNextLine();
GUI_DispString ("y1: "); GUI_DispDec(y1, 4); GUI_DispNextLine();
GUI_DispString ("Please touch display to continue...");
GUI_Delay(1000);
do {
GUI_PID_STATE State;
GUI_TOUCH_GetState(&State);
if (State.Pressed)
break;
GUI_Delay (10);
} while (1);
GUI_Clear();
} |
|