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 | |
| High X pin. More... | |
| xm | |
| Low X pin. More... | |
| yp | |
| High Y pin. More... | |
| ym | |
| Low Y pin. More... | |
| p_len | |
| Length value. More... | |
| p_width | |
| Width value. More... | |
| ox | |
| Center X value. More... | |
| oy | |
| Center Y value. More... | |
| res | |
| Resolution. More... | |
| delay | |
| Delay time. More... | |
| hiPin | |
| High Voltage side. More... | |
| loPin | |
| Low Voltage side. More... | |
| vPin | |
| Reading Pin. More... | |
| fPin | |
| Floating Pin. More... | |
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 |
| delay | read delay to ensure signal settled |
| 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 |
| touchDriver.TouchPanel.delay |
Delay time.
delay to ensure system has settled
| touchDriver.TouchPanel.fPin |
Floating Pin.
Create object that does nothing intentionally
| touchDriver.TouchPanel.hiPin |
High Voltage side.
Create object that will later be used to label the high voltage side of the resistance touchpad juncture
| touchDriver.TouchPanel.loPin |
Low Voltage side.
Create object that will later be used to label the low voltage side of the resistance touchpad juncture
| touchDriver.TouchPanel.ox |
Center X value.
Stores the value of the X center of the screen that the user input
| touchDriver.TouchPanel.oy |
Center Y value.
Stores the value of the Y center of the screen that the user input
| touchDriver.TouchPanel.p_len |
Length value.
Stores the value of the length of the screen that the user input
| touchDriver.TouchPanel.p_width |
Width value.
Stores the value of the width of the screen that the user input
| touchDriver.TouchPanel.res |
Resolution.
resolution of our adc
| touchDriver.TouchPanel.vPin |
Reading Pin.
Create object to read voltage coming from juncture
| touchDriver.TouchPanel.xm |
Low X pin.
This pin is kept floating in order to read values from the high X
| touchDriver.TouchPanel.xp |
High X pin.
This pin is high to output a voltage that will go through the touchscreen
| touchDriver.TouchPanel.ym |
Low Y pin.
This pin is kept floating in order to read values from the high Y
| touchDriver.TouchPanel.yp |
High Y pin.
This pin is high to output a voltage that will go through the touchscreen