Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otXPT2046 Class Reference
[XPT2046 - Library for touch screen controllerXPT2046 - Library for touch screen controller]

Class that allows to use XPT2046 touch screen controller.

#include <otXPT2046.h>


Public Types

enum  rotation_t { ROT0, ROT90, ROT180, ROT270 }

Public Member Functions

 otXPT2046 ()
 Create the object.
bool rawData (U16 &_x, U16 &_y, U16 &_z)
bool position (U16 &x, U16 &y)
void init (U16 w, U16 h)
void setThreshold (int t)
void setCalibration (U16 vy1, U16 vx1, U16 vy2, U16 vx2)
void getCalibration (U16 &x1, U16 &y1, U16 &x2, U16 &y2)
void setRotation (rotation_t rot)


Member Enumeration Documentation

enum otXPT2046::rotation_t
 

Enumeration values:
ROT0  Don't apply any coordinate rotation.
ROT90  Coordinate are rotated by 90 degree.
ROT180  Coordinate are rotated by 180 degree.
ROT270  Coordinate are rotated by 270 degree.


Constructor & Destructor Documentation

otXPT2046.otXPT2046  ) 
 


Member Function Documentation

void otXPT2046.getCalibration U16 x1,
U16 y1,
U16 x2,
U16 y2
 

Procedure to read calibration points

Parameters:
x1 Return the vertical start position
y1 Return the horizontal start position
x2 Return the vertical end position
y2 Return the horizontal end position

void otXPT2046.init U16  w,
U16  h
 

Initialize the object

Parameters:
w Touch screen width as pixel
h Touch screen height as pixel

bool otXPT2046.position U16 x,
U16 y
 

Read coordinate position where touch screen is pressed

Parameters:
x Return horizontal value
y Return vertical value
Returns:
True if touch screen is pressed

bool otXPT2046.rawData U16 _x,
U16 _y,
U16 _z
 

Read ADC raw data

Parameters:
_x Return horizontal value
_y Return vertical value
_z Return pressure value
Returns:
True if touch screen is pressed

void otXPT2046.setCalibration U16  vy1,
U16  vx1,
U16  vy2,
U16  vx2
 

Procedure to calibrate the touch screen

Parameters:
vy1 Vertical start position
vx1 Horizontal start position
vy2 Vertical end position
vx2 Horizontal end position

void otXPT2046.setRotation rotation_t  rot  ) 
 

Set the coordinate rotation

Parameters:
rot Rotation value see rotation_t

void otXPT2046.setThreshold int  t  ) 
 

Set the threshold value to detect a touch screen pressure

Parameters:
t Threshold value in the range 0:4095


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0