The Shooter Module is programmed to handle all events that involve shooting and reading the lasers that we use to fire at the targets
Click here to see the hardware setup of the Lasers
Click here to see and download the complete Shooter.h module
Click here to see and download the complete Shooter.c module
Public Level Functions:
Function: |
initShooter(void) |
Description: |
Initializes the shooter module at the beginning of each game. |
Input: |
None |
Output: |
None |
Psuedocode: |
Initialize outputs as off
Set correct input and output ports
Initialize all timers as expired
Set gun cooldown based on difficulty |
Function: |
checkTrigger1(void), checkTrigger2(void) |
Description: |
Checks to see if there is a valid trigger pull |
Input: |
None |
Output: |
Unsigned char 1 for a trigger pull, 0 otherwise |
Psuedocode: |
If the trigger is pulled and the fire cooldown has expired, return 1
Otherwise, return 0 |
Function: |
checkShooter1(void), checkShooter2(void) |
Description: |
Checks to see if the shooters need to be deactivated |
Input: |
None |
Output: |
Unsigned char 1 for yes, 0 for no |
Psuedocode: |
Return if the fire timer is expired |
Function: |
fireShooter1(void), fireShooter2(void) |
Description: |
Activates the laser pointers and relevant timers. |
Input: |
None |
Output: |
None |
Psuedocode: |
Initialize fire timer
Initialize cooldown timer
Turn on laser |
Function: |
turnOffShooter1(void), turnOffShooter2(void) |
Description: |
Deactivates the laser pointer and relevant timer. |
Input: |
None |
Output: |
None |
Psuedocode: |
Turn off laser
Clear fire timer. |
Function: |
isFiring1(void), isFiring2(void) |
Description: |
Checks to see if the shooter is firing |
Input: |
None |
Output: |
Unsigned char 1 for yes, 0 for no |
Psuedocode: |
Return if the fire timer is active |
Function: |
vibrate1(void), vibrate2(void) |
Description: |
Activates the gun vibrate motors and relevant timer. |
Input: |
None |
Output: |
None |
Psuedocode: |
Turn on vibrate motor
Initialize vibrate timer |
Function: |
checkVibrate1(void), checkVibrate2(void) |
Description: |
Checks to see if the vibrate motors need to be deactivated |
Input: |
None |
Output: |
Unsigned char 1 for yes, 0 for no |
Psuedocode: |
Return if the vibrate timer is expired |
Function: |
turnOffVibrate1(void), turnOffVibrate2(void) |
Description: |
Deactivates the vibrate motors and relevant timer. |
Input: |
None |
Output: |
None |
Psuedocode: |
Turn off vibrate motor
Clear vibrate timer |
Function: |
endShooter(void) |
Description: |
Deactivates all actuators controlled by the shooter module at the end of each game. |
Input: |
None |
Output: |
None |
Psuedocode: |
Turn off both shooters
Turn off both vibrate motors |
|