UI Task interfaces between front end and the serial port. More...
Public Member Functions | |
| def | __init__ (self, debugFlag=True) |
| Initialize the UI task. More... | |
| def | run (self) |
| Report necessary measurements the front end. More... | |
| def | transitionTo (self, newState) |
| Method for transitioning states. More... | |
Public Attributes | |
| state | |
| Contains the information for which state its in. | |
| debugFlag | |
| Debugging flag for detailed analysis while running. | |
| voltages | |
| An array to store voltage data to plot. | |
| val | |
| Holds the input commands (letters) from serial. | |
| n | |
| Counter used for sending data one element at a time. | |
| sendingDataFlag | |
| Sends a signal to start data sending to console. | |
| adc | |
| Create an ADC on pin PA0. | |
| tim | |
| Create a timer running at 250kHz. | |
| differenceInVoltage | |
| Difference between final and initial voltage readings from ADC. | |
Static Public Attributes | |
| int | S0_INIT = 0 |
| Basic init state. | |
| int | S1_READY_FOR_INPUT = 1 |
| Wait for user to press a letter. | |
| int | S2_COLLECT_DATA = 2 |
| Sample data and store to array. | |
| int | S3_PRINT_DATA = 3 |
| Print data back to PC. | |
| int | S4_RESET = 4 |
| Reset for another round of data collection. | |
UI Task interfaces between front end and the serial port.
This class will take data and report it through serial to the front end. It also receives characters/commands from the front end.
| def Lab0x03_uiTask.uiTask.__init__ | ( | self, | |
debugFlag = True |
|||
| ) |
Initialize the UI task.
This task will collect and send data to the front end for the voltage reading from the button circuitry.
| debugFlag | Enables or prevents certain print statements from appearing. |
| def Lab0x03_uiTask.uiTask.run | ( | self | ) |
Report necessary measurements the front end.
This method will wait for a 'g' to be pressed, and then subsequently take data until a button press has been identified. It will then send the data through serial to the front end for further data processing.
| def Lab0x03_uiTask.uiTask.transitionTo | ( | self, | |
| newState | |||
| ) |
Method for transitioning states.
The method will reassign the self.state variable when directed to transition.
| newState | Controls which state is the new state for the FSM. |