![]() |
ME 305 Group 6 Documentation
|
A driver class for a 4-wire resistive touch panel. More...
Public Member Functions | |
| def | __init__ (self, pyb.Pin YmPin, pyb.Pin YpPin, pyb.Pin XmPin, pyb.Pin XpPin, PrintQueue print_queue=None) |
| Initializes a touchpad object. More... | |
| def | calibrate (self, touch_calib_status=None) |
| Calibrates the touchpad. More... | |
| def | scan (self) |
| Scans the touch panel and returns the position of contact. More... | |
Public Attributes | |
| YmPin | |
| -Y Pin More... | |
| YpPin | |
| +Y Pin More... | |
| XmPin | |
| -X Pin More... | |
| XpPin | |
| +X Pin More... | |
| tim | |
| Timer for the ADC. More... | |
| buf | |
| Buffer for readings. More... | |
| calibCoeffs | |
| Calibration Coefficients. More... | |
| print_queue | |
| Print queue object. More... | |
| xADC | |
| ADC object for the X scans. More... | |
| yzADC | |
| ADC object for the Y and Z scans. More... | |
A driver class for a 4-wire resistive touch panel.
Contains methods for initializing, calibrating, and scanning a touch panel.
| def touchPanel.TouchPanel.__init__ | ( | self, | |
| pyb.Pin | YmPin, | ||
| pyb.Pin | YpPin, | ||
| pyb.Pin | XmPin, | ||
| pyb.Pin | XpPin, | ||
| PrintQueue | print_queue = None |
||
| ) |
Initializes a touchpad object.
Touchpad pin modes are preconfigured for the first X scan. A timer is also created for use by the ADC.read_timed() method. A buffer is also preallocated to hold the values from ADC.read_timed()
| YmPin | Negative pin of the Y-dimension circuit. |
| YpPin | Positive pin of the Y-dimension circuit. |
| XmPin | Negative pin of the X-dimension circuit. |
| XpPin | Positive pin of the X_dimension circuit. |
| print_queue | A shared variable used for passing print statements out to the print function in taskUser.py |
| def touchPanel.TouchPanel.calibrate | ( | self, | |
touch_calib_status = None |
|||
| ) |
Calibrates the touchpad.
Requests 5 known points be pressed by the user: (-80, -40), (-80, 40), (0, 0), (80, -40), (80, 40) These values are processed to determine calibration coefficients.
| touch_calib_status | A shared variable used to indicate when the calibration process is finished. |
| def touchPanel.TouchPanel.scan | ( | self | ) |
Scans the touch panel and returns the position of contact.
The panel is scanned in X, Z, and Y, in that order. X and Y return the position in mm, and Z returns True if contact is made, otherwise, False is returned.
| touchPanel.TouchPanel.buf |
Buffer for readings.
ADC readings are read into this buffer before being averaged. Changing it's size changes how many readings are made.
| touchPanel.TouchPanel.calibCoeffs |
Calibration Coefficients.
An array holding the correlations used to convert ADC readings to useful positions.
| touchPanel.TouchPanel.print_queue |
Print queue object.
Items to be printed are added to the queue using this object.
| touchPanel.TouchPanel.tim |
Timer for the ADC.
Used to trigger readings from ADC.read_timed()
| touchPanel.TouchPanel.xADC |
ADC object for the X scans.
Attached to the +Y pin
| touchPanel.TouchPanel.XmPin |
-X Pin
Negative pin of the X-dimension circuit.
| touchPanel.TouchPanel.XpPin |
+X Pin
Positive pin of the X_dimension circuit.
| touchPanel.TouchPanel.YmPin |
-Y Pin
Negative pin of the Y-dimension circuit.
| touchPanel.TouchPanel.YpPin |
+Y Pin
Positive pin of the Y-dimension circuit.
| touchPanel.TouchPanel.yzADC |
ADC object for the Y and Z scans.
Attached to the +X pin