完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我网上下的一个程序,先触摸校准,就是在屏的左下角和右上角分别画两个圆环,点击校准。一楼是程序。先是左下角出一个圆环,点击能退出第一个do WHILE的循环,继续往下执行,显出“OK”,进入第二个do WHILE的循环,只有释放触摸屏才能跳出第二个do WHILE的循环,从而画第二个右上角的圆环。但是,我在板子上实验,发现就算一直按着触摸屏,依然能够跳出第二个do WHILE的循环。不知道到底为什么。求大神分析。
|
|
相关推荐
3个回答
|
|
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(); } |
|
|
|
跟踪进去这个函数GUI_TOUCH_GetState看看究竟。
|
|
|
|
学习学习
|
|
|
|
只有小组成员才能发言,加入小组>>
692 浏览 0 评论
1106 浏览 1 评论
2473 浏览 5 评论
2808 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2646 浏览 6 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
653浏览 9评论
649浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
781浏览 6评论
628浏览 5评论
668浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 09:17 , Processed in 1.222518 second(s), Total 85, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号