405 Documentation  9.0
touchDriver.TouchPanel Class Reference

Tells where it is being touched. More...

Public Member Functions

def __init__ (self, xp, xm, yp, ym, p_len, p_width, center, res=0xfff, delay=3)
 Initialization Function. More...
 
def xScan (self)
 xScan method More...
 
def yScan (self)
 yScan method More...
 
def zScan (self)
 zScan method More...
 
def scan (self)
 scan coordinates More...
 
def filter (self)
 signal filtering for later implementation
 

Public Attributes

 xp
 
 xm
 
 yp
 
 ym
 
 p_len
 
 p_width
 
 ox
 
 oy
 
 res
 
 delay
 
 hiPin
 
 loPin
 
 vPin
 
 fPin
 

Detailed Description

Tells where it is being touched.

Input 4 pin values, the length of the touchscreen, the width of the touchscreen, the distance from x = 0 edge to the center, and the distance form the y = 0 edge to the center. Once given, the class will return results from whichever method activated. Also tells wether or not it is even being touched

Author
Hunter Morse
Date
Mar. 1, 2021

Constructor & Destructor Documentation

◆ __init__()

def touchDriver.TouchPanel.__init__ (   self,
  xp,
  xm,
  yp,
  ym,
  p_len,
  p_width,
  center,
  res = 0xfff,
  delay = 3 
)

Initialization Function.

Stores the parameters input by the user when creating the class object so that they may be used later by other functions.

Parameters
xppin registered to xp
xmpin registered to xm
yppin registered to yp
ympin registered to ym
p_lenpanel length
p_widthpanel width
centerox and oy coordinate tuple of panel origin (center)
resresolution of adc (default 0xfff – 12 bit ADC)
delayread delay to ensure signal settled (delay 3us)

Member Function Documentation

◆ scan()

def touchDriver.TouchPanel.scan (   self)

scan coordinates

Runs the x coordinate, y coordinate, and z boolean methods. It then returns those values in a tuple.

Parameters
None

◆ xScan()

def touchDriver.TouchPanel.xScan (   self)

xScan method

Reads the value of the Ym pin to determine the voltage being sent to it by contact with the Xp Xm line. This voltage is proportional to the distance along the x axis where the screen is being touched. That is converted from an analog ot a digital value between 0 and 4095. The value is then divided by 4095 and multiplied by the length of the screen to get the actual x placement of where the screen is being touched. X0 is then subtracted from that value to put the origin at the center of the screen lengthwise, with the negative being on the left and the positive being on the right.

Parameters
None

◆ yScan()

def touchDriver.TouchPanel.yScan (   self)

yScan method

Reads the value of the Xm pin to determine the voltage being sent to it by contact with the Yp Ym line. This voltage is proportional to the distance along the y axis where the screen is being touched. That is converted from an analog ot a digital value between 0 and 4095. The value is then divided by 4095 and multiplied by the width of the screen to get the actual x placement of where the screen is being touched. Y0 is then subtracted from that value to put the origin at the center of the screen widthwise, with the negative being on the bottom and the positive being on the top.

Parameters
None

◆ zScan()

def touchDriver.TouchPanel.zScan (   self)

zScan method

Reads the value of the Ym pin to determine the voltage being sent to it by contact with the Yp Xm line. When the screen is being touched, Ym will receive a lower amount of voltage as some of the voltage will go to Xm which is set to low. When the value being read by Ym decreases, Z boolean pin will be set to say that contact has been made.

Parameters
None

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