Read the pressed coordinate on the touch screen

Description

  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:

  1. Return the coordinate data immediately. If no press on the panel, then return data out of the pxiels range.
  2. Return data till the touch pressed down.
  3. Return data till the touch click (pressed down then released). 

Usage:

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)

Parameters:

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:

Example (Arduino):

#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
}

Changelog

Version Description
   

See Also