Lucas Murray ME 305 Portfolio
Classes | Variables
touch.py File Reference

A driver that runs and controls a resistive touch panel. More...

Classes

class  touch.Touch
 

Variables

float touch.a = 0.85
 
float touch.b = 0.005
 
int touch.x0 = 0
 
int touch.y0 = 0
 
 touch.xP = Pin(Pin.cpu.A7, Pin.IN)
 
 touch.xM = Pin(Pin.cpu.A1, Pin.OUT_PP,value=0)
 
 touch.yP = Pin(Pin.cpu.A6, Pin.OUT_PP,value=1)
 
 touch.yM = Pin(Pin.cpu.A0, Pin.IN)
 
 touch.tch = Touch(xP, xM, yP, yM, a, b, x0, y0)
 
int touch.xTch = 0
 
int touch.yTch = 0
 
 touch.strTime = ticks_us()
 
int touch.numItem = 0
 

Detailed Description

A driver that runs and controls a resistive touch panel.

The driver class instantiates a driver that can instantiate and control an Analog to Digital Converter (ADC) device and calibrate it. The driver uses the pyb library functionality for an ADC to read the voltage running between two pins, each set to one of the four pins on the touch panel (-x,+x,-y,+y), and converts that voltage reading to an x and y position on the board. The velocity can then be found using the change in position. The Touch class can also check for contact with the board, being able to return a boolean value for it. Both the position and velocity use alpha-beta filtering, offsets, and scaling values to correct the theoretical position of the touch panel and line it up with the actual one. The driver can also read the calibration status and either set the scaling values and offsets from an already written file or write a new calibration file. The Touch class will update the xy positions and xy velocities read and converted to the values in mm and mm/s.


Source Code: https://bitbucket.org/lmurray03/me305_lucas_murray/src/master/Term%20Project/touch.py

Author
Lucas Murray
Max Cassady
Date
March 17, 2022