Advertisement
xerpi

tpCalibrate

Dec 2nd, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. extern void writePoint3x3 (byte x, byte y, byte color);
  2. extern void writeString(byte x, byte y, char string[]);
  3.  
  4. void tpCalibrate(byte *cal_x_min,  byte *cal_y_min, byte *cal_x_max,  byte *cal_y_max)
  5. {
  6.     static const char inf_esq[] = "Extrem inferior esquerra";
  7.     static const char sup_dre[] = "Extrem superior dret";
  8.  
  9.     while (!tpPressDetect()) {
  10.         clearGLCD(7, 7, 0, 127);
  11.         writeString(3, 0, (char *)inf_esq);
  12.         writePoint3x3(64, 0, 1);
  13.         __delay_ms(10);
  14.     }
  15.  
  16.     *cal_x_min = tpGetX();
  17.     __delay_ms(1);
  18.     *cal_y_min = tpGetY();
  19.    
  20.     while (tpPressDetect()) {
  21.         __delay_ms(10);
  22.     }
  23.  
  24.  
  25.     while (!tpPressDetect()) {
  26.         clearGLCD(7, 7, 0, 127);
  27.         writeString(3, 0, (char *)sup_dre);
  28.         writePoint3x3(0, 125, 1);
  29.         __delay_ms(10);
  30.     }
  31.  
  32.     *cal_x_max = tpGetX();
  33.     __delay_ms(1);
  34.     *cal_y_max = tpGetY();
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement