Adafruit TSC2046 Touchscreen Arduino Library
Public Member Functions | Public Attributes | List of all members
TSPoint Class Reference

The type returned by Adafruit_TSC2046::getPoint. More...

#include <Adafruit_TSC2046.h>

Public Member Functions

 TSPoint (int16_t x, int16_t y, float z)
 Create a new TSPoint with these exact values. You usually don't need to call this constructor in user code. Call Adafruit_TSC2046::getPoint instead. More...
 
float xPercent ()
 The X-coordinate as a percentage. Note that physical touchscreens vary, and the range of yours may not perfectly extend from 0% to 100%. Like TSPoint::x, this value is meaningless if the touchscreen is not being touched. More...
 
float yPercent ()
 The Y-coordinate as a percentage. Note that physical touchscreens vary, and the range of yours may not perfectly extend from 0% to 100%. Like TSPoint::y, this value is meaningless if the touchscreen is not being touched. More...
 

Public Attributes

int16_t x
 The full scale raw X coordinate from the touchscreen. For the X-coordinate as a percentage, see TSPoint::xPercent. If the touchscreen is not being touched, this value is meaningless.
 
int16_t y
 The full scale raw Y coordinate from the touchscreen. For the Y-coordinate as a percentage, see TSPoint::yPercent. If the touchscreen is not being touched, this value is meaningless.
 
float z
 The resistance measurement that corresponds to the pressure currently exerted on the touchscreen. The higher the pressure, the lower this resistance value will be. Unlike the X and Y coordinates, this value is not in an arbitrary unit of a full scale, but is a physical measurement, in Ohms (Ω).
 

Detailed Description

The type returned by Adafruit_TSC2046::getPoint.

See the individual fields and methods for more information.

Constructor & Destructor Documentation

◆ TSPoint()

TSPoint::TSPoint ( int16_t  x,
int16_t  y,
float  z 
)

Create a new TSPoint with these exact values. You usually don't need to call this constructor in user code. Call Adafruit_TSC2046::getPoint instead.

Parameters
xThe value to initialize the X coordinate to.
yThe value to initalize the Y coordinate to.
zThe value to initalize the Z coordinate/pressure to.

Member Function Documentation

◆ xPercent()

float TSPoint::xPercent ( )

The X-coordinate as a percentage. Note that physical touchscreens vary, and the range of yours may not perfectly extend from 0% to 100%. Like TSPoint::x, this value is meaningless if the touchscreen is not being touched.

Returns
The X-coordinate as a percentage of the maximum coordinate.

◆ yPercent()

float TSPoint::yPercent ( )

The Y-coordinate as a percentage. Note that physical touchscreens vary, and the range of yours may not perfectly extend from 0% to 100%. Like TSPoint::y, this value is meaningless if the touchscreen is not being touched.

Returns
the Y-coordinate as a percentage of the maximum coordinate.

The documentation for this class was generated from the following files: