1
完善资料让更多小伙伴认识你,还能领取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看看究竟。
|
|
|
|
学习学习
|
|
|
|
只有小组成员才能发言,加入小组>>
788 浏览 0 评论
1151 浏览 1 评论
2527 浏览 5 评论
2860 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2709 浏览 6 评论
keil5中manage run-time environment怎么是灰色,不可以操作吗?
1068浏览 3评论
193浏览 2评论
455浏览 2评论
368浏览 2评论
M0518 PWM的电压输出只有2V左右,没有3.3V是怎么回事?
453浏览 1评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 21:23 , Processed in 1.134326 second(s), Total 82, Slave 63 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号