Kyle Chuang | ME405 Mechatronics Portfolio
tch_driver.touchscreen Class Reference

Public Member Functions

def __init__ (self, xp, xm, yp, ym, w, l, xc, yc)
 Constructor for the touchscreen driver. More...
 
def Xscan (self)
 Returns the x coordinate of the touch input.
 
def Zscan (self)
 Returns a boolean output which measures if there is any input to the touchscreen.
 
def Yscan (self)
 Returns the y coordinate of the touch input.
 
def coord (self)
 Returns the coordinates of the touch input and the time it takes to calculate. More...
 

Public Attributes

 xp
 An object copy of the X+ pin.
 
 xm
 An object copy of the X- pin.
 
 yp
 An object copy of the Y+ pin.
 
 ym
 An object copy of the Y- pin.
 
 w
 An object copy of the width of the touchscreen.
 
 l
 An object copy of the length of the touchscreen.
 
 xc
 An object copy of the X coordinate of the center of the touchscreen.
 
 yc
 An object copy of the Y coordinate of the center of the touchscreen.
 
 Xi
 Initializes the first X reading for the filter.
 
 Yi
 Initializes the first Y reading for the filter. More...
 
 ADC_ym
 

Constructor & Destructor Documentation

◆ __init__()

def tch_driver.touchscreen.__init__ (   self,
  xp,
  xm,
  yp,
  ym,
  w,
  l,
  xc,
  yc 
)

Constructor for the touchscreen driver.

Parameters
xpInput for the X+ pin on the FPC breakout board.
xmInput for the X- pin on the FPC breakout board.
ypInput for the Y+ pin on the FPC breakout board.
ymInput for the Y- pin on the FPC breakout board.
wInput for the width of the board in centimeters.
lInput for the length of the board in centimeters.
xcInput for the X coordinate of the center of the touchscreen.
ycInput for the Y coordinate of the center of the touchscreen.

Member Function Documentation

◆ coord()

def tch_driver.touchscreen.coord (   self)

Returns the coordinates of the touch input and the time it takes to calculate.

The coordinate system is returned in the format of (X, Y, Z). X and Y will be in the units specified by the given length and width and Z will be a boolean output which determines whether the touchscreen is being pressed. Z=1 means no input and Z=0 means an input is read. Additionally, this method returns total_time which is the total time it takes to run through the method returned in microseconds.

Member Data Documentation

◆ Yi

tch_driver.touchscreen.Yi

Initializes the first Y reading for the filter.

Push Pull Output Pins initialized in Zscan() self.pin_yp = Pin(self.yp) self.pin_yp.init(mode=Pin.OUT_PP, value=1)

Floating Pins initialized in Zscan() self.pin_xp = Pin(self.xp, mode=Pin.IN) self.pin_xp.init(mode=Pin.ANALOG)


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