Luisa Chiu Portfolio
touch_pan.Touch_Pan Class Reference

Hardware driver to interface resistive touch panels with the STM32 microcontroller. More...

Public Member Functions

def __init__ (self, x_p, x_m, y_p, y_m)
 Constructs a touch panel object. More...
 
def get_x (self)
 Reads x position. More...
 
def get_y (self)
 Reads y position. More...
 
def get_z (self)
 Reads z "position" and creates a boolean flag for when contact is detected.
 
def get_coords (self)
 Gets x, y, and z positions. More...
 
def calibrate (self)
 Calibrates touch panel.
 

Public Attributes

 x_p
 Variable for pin reading x-component of contact point. More...
 
 x_m
 Variable for pin reading x-component of contact point. More...
 
 y_p
 Variable for pin reading y-component of contact point. More...
 
 y_m
 Variable for pin reading y-component of contact point. More...
 
 x_width
 Variable for width of touch panel. More...
 
 y_length
 Variable for length of touch panel. More...
 
 z_ADC_flag
 A boolean flag used to detect contact with touch panel. More...
 
 calibrate_flag
 A flag used to signal whether the panel has been calibrated or not. More...
 
 beta
 Array to define beta values. More...
 
 z_ADC
 Uncalibrated z-position values read by touch panel. More...
 
 x_ADC
 Uncalibrated x-position values read by touch panel. More...
 
 y_ADC
 Uncalibrated y-position values read by touch panel. More...
 
 x_ADC_cal
 Calibrated x-position values read by touch panel. More...
 
 y_ADC_cal
 Calibrated y-position values read by touch panel. More...
 
 calibrated_pos
 Calibrated x and y positions read by panel. More...
 
 uncalibrated_pos
 Uncalibrated x and y positions read by panel. More...
 
 panel_coords
 Array of panel coordinates. More...
 
 panel_coords_instr
 Instructions for user during panel calibration. More...
 
 panel_meas
 Empty array for panel measurements. More...
 
 i
 A variable used for indexing. More...
 
 touch_coeffs
 Array of calculated panel coefficients. More...
 

Detailed Description

Hardware driver to interface resistive touch panels with the STM32 microcontroller.

Scans X, Y, and Z components of contact point on touch panel by configuring 4 pin objects

Constructor & Destructor Documentation

◆ __init__()

def touch_pan.Touch_Pan.__init__ (   self,
  x_p,
  x_m,
  y_p,
  y_m 
)

Constructs a touch panel object.

The touch panel object is created from four touch panel pins configured to read the touch panel.

Parameters
x_pUsed to scan x component from touch panel, configured as a push-pull output
x_mUsed to scan x component from touch panel, configured as a push-pull output
y_pUsed to scan y component from touch panel, configured as a push-pull output
y_mUsed to scan y component from touch panel, configured as a push-pull output

Member Function Documentation

◆ get_coords()

def touch_pan.Touch_Pan.get_coords (   self)

Gets x, y, and z positions.

Returns uncalibrated and calibrated values.

◆ get_x()

def touch_pan.Touch_Pan.get_x (   self)

Reads x position.

Returns uncalibrated values.

◆ get_y()

def touch_pan.Touch_Pan.get_y (   self)

Reads y position.

Returns uncalibrated values.

Member Data Documentation

◆ beta

touch_pan.Touch_Pan.beta

Array to define beta values.

Used to calibrate the touch panel and account for center offset

◆ calibrate_flag

touch_pan.Touch_Pan.calibrate_flag

A flag used to signal whether the panel has been calibrated or not.

Determines which coordinate values (calibrated or not-calibrated) to return

◆ calibrated_pos

touch_pan.Touch_Pan.calibrated_pos

Calibrated x and y positions read by panel.

Creates list of positions to be used for state vectors

◆ i

touch_pan.Touch_Pan.i

A variable used for indexing.

This value helps index state vector points for calibration

◆ panel_coords

touch_pan.Touch_Pan.panel_coords

Array of panel coordinates.

Coordinates to be used in panel calibration calculations

◆ panel_coords_instr

touch_pan.Touch_Pan.panel_coords_instr

Instructions for user during panel calibration.

User touches the listed coordinates for panel calibration

◆ panel_meas

touch_pan.Touch_Pan.panel_meas

Empty array for panel measurements.

Measured positional coordinates to be used in panel calibration calculations

◆ touch_coeffs

touch_pan.Touch_Pan.touch_coeffs

Array of calculated panel coefficients.

Beta values that will be applied to ADC position readings to calibrate touch panel coordinates

◆ uncalibrated_pos

touch_pan.Touch_Pan.uncalibrated_pos

Uncalibrated x and y positions read by panel.

Creates list of uncalibrated positions. Should not be used for ball balancing.

◆ x_ADC

touch_pan.Touch_Pan.x_ADC

Uncalibrated x-position values read by touch panel.

Measures x-position

◆ x_ADC_cal

touch_pan.Touch_Pan.x_ADC_cal

Calibrated x-position values read by touch panel.

Measures x-position accurately based on manual or automatic calibration constants

◆ x_m

touch_pan.Touch_Pan.x_m

Variable for pin reading x-component of contact point.

Used to locate touch in x-direction

◆ x_p

touch_pan.Touch_Pan.x_p

Variable for pin reading x-component of contact point.

Used to locate touch in x-direction

◆ x_width

touch_pan.Touch_Pan.x_width

Variable for width of touch panel.

Defines width of panel in the x-direction

◆ y_ADC

touch_pan.Touch_Pan.y_ADC

Uncalibrated y-position values read by touch panel.

Measures y-position

◆ y_ADC_cal

touch_pan.Touch_Pan.y_ADC_cal

Calibrated y-position values read by touch panel.

Measures y-position accurately based on manual or automatic calibration constants

◆ y_length

touch_pan.Touch_Pan.y_length

Variable for length of touch panel.

Defines length of panel in the y-direction

◆ y_m

touch_pan.Touch_Pan.y_m

Variable for pin reading y-component of contact point.

Used to locate touch in y-direction

◆ y_p

touch_pan.Touch_Pan.y_p

Variable for pin reading y-component of contact point.

Used to locate touch in y-direction

◆ z_ADC

touch_pan.Touch_Pan.z_ADC

Uncalibrated z-position values read by touch panel.

Measures z-position (contact with panel)

◆ z_ADC_flag

touch_pan.Touch_Pan.z_ADC_flag

A boolean flag used to detect contact with touch panel.

Signals to the panel to read values when contact is made


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