Read out 2 integer pressed coordinate data, the result already mapped to the position of pixel.
Each integer use 2 bytes, MSB format.
There are 3 touched status:
|
Direct: |
"RPNXYI" ----return the coordinate data immediately "RPNXYP" ----return till pressed "RPNXYC" ----return till clicked |
|
Arduino: |
void readTouchInst(void) void readTouchPres(void) void readClick(void) void readTouchScreen(int *x, int *y) //use this after run one of above function
|
|
C: |
void Digole_readTouchScreen(int *x, int *y) //read touch data immediately void Digole_readClick(int *x, int *y) |
x , y
The pointer to the integer value.
Note: The good practice is to use "read immediately" function. Other 2 functions will drive the display to wait the "Pressed" or "Clicked" event.
Also can use the interupt or check the pin when PENIRQ pin drove to low (panel pressed).
Please see the example bellow:
#define LCDW 240 //the pixels width and height of the display
#define LCDH 320
int x,y;
mydisp.readTouchInst();
mydisp.readTouchScreen(&x,&y);
if(x < LCDW && y < LCDH) //means pressed
{
//compare the value of x/y are on a button?
//do pressed task
}
else
{
//do un-pressed task
}
| Version | Description |
|---|---|