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 | |
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
| 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.
| xp | pin registered to xp |
| xm | pin registered to xm |
| yp | pin registered to yp |
| ym | pin registered to ym |
| p_len | panel length |
| p_width | panel width |
| center | ox and oy coordinate tuple of panel origin (center) |
| res | resolution of adc (default 0xfff – 12 bit ADC) |
| delay | read delay to ensure signal settled (delay 3us) |
| 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.
| None |
| 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.
| None |
| 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.
| None |
| 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.
| None |