/******************************************************************************* * Function Name : LCD_TouchRead( ) * Author : Anilandro * Description : Lectura de puntero sobre pantalla con versión Portrait y Landscape * Input : None * Output : None * Return : * Attention : None *******************************************************************************/ uint8_t LCD_TouchRead(Coordinate * displayLCD){ uint16_t px,py,x,y; int p,f; //char cadena[20]; GetFormat(); /*obtiene valor de formato de pantalla activo*/ p=0; f=0; while(f<30){ getDisplayPoint(&display, Read_Ads7846(), &matrix ) ; /*lee la posición del puntero sobre la pantalla*/ px=display.x; py=display.y; if((PMode2==0)&&(py<400)){x=px,y=py;p=1;break;} if((PMode2==1)&&(px<400)){x=px,y=py;p=1;break;} f++; } if(f>=30){p=0;x=400;y=400;} displayLCD->x = x; displayLCD->y = y; return(p); }
void TSDriver_HandleTouchInterrupt(void) { uint16_t x, y; if (Read_Ads7846(&x, &y)) { // It was a good event, store the values s_touchEventX = x; s_touchEventY = y; s_isTouchEventTriggered = 1; } }
void GUI_TOUCH_Measure(void) { Coordinate * Ptr; xPhys = -1; yPhys = -1; Ptr = Read_Ads7846(); if( Ptr != (void*)0 ) { xPhys = Ptr->x; yPhys = Ptr->y; } }
void Task_Touch(void *Tags) { Coordinate *C; TP_Init(); while(1) { GUI_TOUCH_Exec(); C=Read_Ads7846(); if(C) { _TouchX=C->x; _TouchY=C->y; } Tos_TaskDelay(10); } }
/******************************************************************************* * Function Name : TouchPanel_Calibrate * Description : * Input : None * Output : None * Return : None * Attention : None *******************************************************************************/ void TouchPanel_Calibrate(void) { uint8_t i; Coordinate * Ptr; for(i=0;i<3;i++) { LCD_Clear(Black); GUI_Text(44,10,"Touch crosshair to calibrate",0xffff,Black); delay_ms(300); DrawCross(DisplaySample[i].x,DisplaySample[i].y); do { Ptr=Read_Ads7846(); } while( Ptr == (void*)0 ); ScreenSample[i].x= Ptr->x; ScreenSample[i].y= Ptr->y; } setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix ); LCD_Clear(Black); }
/******************************************************************************* * Function Name : TouchPanel_Calibrate * Description : 校准触摸屏 * Input : None * Output : None * Return : None * Attention : None *******************************************************************************/ void TouchPanel_Calibrate(void) { uint8_t i; Coordinate * Ptr; for(i=0;i<3;i++) { LCD_Clear(White); GUI_Text(10,10,"Touch crosshair to calibrate",Black,White); DelayUS(1000 * 500); DrawCross(DisplaySample[i].x,DisplaySample[i].y); do { Ptr = Read_Ads7846(); } while( Ptr == (void*)0 ); ScreenSample[i].x = Ptr->x; ScreenSample[i].y = Ptr->y; } setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix ) ; /* 送入值得到参数 */ LCD_Clear(White); }
/******************************************************************************* * Function Name : TouchPanel_Calibrate * Description : У׼´¥ÃþÆÁ * Input : None * Output : None * Return : None * Attention : None *******************************************************************************/ void TouchPanel_Calibrate(void) { uint8_t i; Coordinate * Ptr; for(i=0;i<3;i++) { LCD_Clear(BLACK); //LCD_SetTextColor(BLUE); //LCD_SetBackColor(BLACK); //LCD_StringLine(10,10,"Touch crosshair to calibrate"); GUI_Text(10, 10, "Touch crosshair to calibrate",BLUE,BLACK); Delay(0xFFFFFF); DrawCross(DisplaySample[i].x,DisplaySample[i].y); do { Ptr=Read_Ads7846(); } while( Ptr == (void*)0 ); ScreenSample[i].x= Ptr->x; ScreenSample[i].y= Ptr->y; } setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix ) ; /* ËÍÈëÖµµÃµ½²ÎÊý */ LCD_Clear(BLACK); }