unsigned char Read_TP_Twice(unsigned int *x,unsigned int *y) { unsigned int x1,y1 ; unsigned int x2,y2 ; unsigned char flag ; flag = Read_TP(&x1,&y1) ; if(flag==0) return 0 ; flag = Read_TP(&x2,&y2) ; if(flag==0) return 0 ; if( ((x2<=x1&&x1<x2+ERR_RANGE)||(x1<=x2&&x2<x1+ERR_RANGE))//前后两次采样在+-50内 &&((y2<=y1&&y1<y2+ERR_RANGE)||(y1<=y2&&y2<y1+ERR_RANGE))) { *x = (x1+x2)/2 ; *y = (y1+y2)/2 ; return 1 ; } return 0 ; }
/******************************************************************************* Ctp_ISP: Capacitor Touch Pad 中断处理程序 *******************************************************************************/ void Ctp_ISP(void) { Read_TP(); }
void Wait_Pen_Up(void) { unsigned int x1,y1 ; while(Read_TP(&x1,&y1)){} ; }