Code Overview
Each function of our controller was handled by a different software module. We also created some helper modules to prevent us from going crazy. The modules are listed below, with links to the pseudo-code and full code. You can also download a zip of all of the code here.
our_c32
Utility module for ease of interaction with the C32 pins. Makes it more intuitive to set the data direction and read/write data from/to the pins.
ir_sensors
Interfaces with each IR distance sensor. Interprets the data to determine whether a sensor was covered or not.
atari
Interfaces with the Atari protection board. Sends the motion commands and reads the power status.
cheat
Controls the physical response of activating the cheat code (enabling/disabling the fans).
motion
The higher level event checker/handler. Interacts with the lower level modules to determine where the user's hands are. Sends the appropriate command to the Atari and activates/deactivates the cheat code.
main
The infinite loop that calls the event checkers and handlers.