Matthew's Portfolio
touchPanelTask.touchPanelTask Class Reference

Position/velocity finder for the ball. More...

Public Member Functions

def __init__ (self, debugFlag=True)
 Create a touch panel task. More...
 
def tchPanelFcn (self)
 State machine for running the touch panel driver. More...
 
def transitionTo (self, state, newState)
 Method for transitioning states. More...
 

Public Attributes

 touchPanel
 Create an instance of the touch panel driver. More...
 
 debugFlag
 Debugging flag for detailed analysis while running.
 
 lastPosition
 The last position of the ball (X, Y, Z coordinates).
 

Static Public Attributes

 S0_INIT = const(0)
 The initial state to set up the task.
 
 S1_READ_PANEL = const(1)
 Main state to read from the panel.
 

Detailed Description

Position/velocity finder for the ball.

This class will allow for the position and velocity of the ball to be calculated using the resisive touch pad.

Constructor & Destructor Documentation

◆ __init__()

def touchPanelTask.touchPanelTask.__init__ (   self,
  debugFlag = True 
)

Create a touch panel task.

This task will be called from the priority scheduler to read from the resistive touch panel (through touchPanelDriver.py) in order to find the position and velocity of the ball. This data will be shared with shares.py.

Parameters
debugFlagEnables or prevents certain print statements from appearing.

Member Function Documentation

◆ tchPanelFcn()

def touchPanelTask.touchPanelTask.tchPanelFcn (   self)

State machine for running the touch panel driver.

This generator is used to run the touch panel task. The main states are initializing the touch panel (including determining whether or not the ball is on the platform), and running the drivers to filter the position and speed.

◆ transitionTo()

def touchPanelTask.touchPanelTask.transitionTo (   self,
  state,
  newState 
)

Method for transitioning states.

The method will reassign the state variable when directed to transition.

Parameters
stateThe current state of the system.
newStateThe new desired state for the system.
Returns
The new state of the finite state machine.

Member Data Documentation

◆ touchPanel

touchPanelTask.touchPanelTask.touchPanel

Create an instance of the touch panel driver.

This object needs the pin values for the xm, xp, ym, and yp ports on the resistive touch panel. These must be passed in as such Pin.cpu.##. Also, the length of the board, width of the board, and the coordinates of the center location must be passed in.


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