Software - PAC
PAC: How we controller the Hovercraft
The PAC's (Political Artillery Controller) primary function was to take inputs from the user and communicate them to the LOBBYIST using an XBee.
Master State Machine
The Master State Machine controls the PAC in accordance with the communications protocol. The state machine, developed by our class' communications committee, is shown below.
|
|
|
The following modules and services are simple one-state state machines, that allowed us to organize our code in a way that helped us to incrementally build and debug our project.
UART Service
The UART Service handles the initialization of the Universal Asynchronous Receiver/Transmistter module of the TIVA, as well as notifying the Master SM when an individual byte is successfully sent or received from the data register.
|
|
|
Inputs Service
This service is responsible for interpreting all the buttons, switches, and sensors on the controller. It provides getter and setter functions to acquire the information outside the module.
|
|
|
Transmit Service
The Transmit Service is only responsible for forming and sending the status packets. Initially it sends a pairing packet and encryption packet, then it sends control packets at 5 Hz.
|
|
|
Receive State Machine
The Receive State Machine is used to collect the bytes of a single reception and parse through them to ultimately send the proper notifications to the Master. The PAC receives status updates from the LOBBYIST to indicate it is still paired and any errors in the communications.
|
|
|
Helper Functions, Definitions, and Configuration
The helper functions and definitions header made our code for the entire project much more readable and intuitive to implement. The helper functions allowed us to call a single function to change a duty cycle or initialize a module, and the definitions header allowed us to refer to a pin by its name or function. This ability allowed us to more easily refer to specific pins, and made our code more flexible, which helped when the need to rearrange hardware arose.
|
|
|
|