A retro gaming programme, designed for use on a portable embedded system. Incorporates power saving techniques.

Dependencies:   ConfigFile N5110 PowerControl beep mbed

Revision:
62:827cda7a2663
Parent:
60:681bc941b94d
Child:
63:ff9b64b23d26
--- a/tower.h	Sun May 03 22:57:57 2015 +0000
+++ b/tower.h	Tue May 05 22:24:35 2015 +0000
@@ -1,50 +1,101 @@
+/**
+@file tower.h
+@brief Revision 1.0.
+@author Daniel R. Tomlinson
+@date   May 2015
 
-//change this to alter tolerance of joystick direction
+@brief Header file - Contains Global Variables, Inputs/Outputs and Function prototypes. 
+*/
+
+///Alters tolerance of Joystick directions
 #define DIRECTION_TOLERANCE 0.05
 #include "ConfigFile.h"
 
-//VCC,SCE,RST,D/C,MOSI,SCLK,LED - set pins for LCD
-N5110 lcd(p7,p8,p9,p10,p11,p13,p22);
+/**
+@namespace lcd
+*/
+N5110 lcd(p7,p8,p9,p10,p11,p13,p22);//VCC, SCE, RST, D/C, MOSI, SCLK, LED - assign pins for LCD.
 
-//config file declaration
+/**
+@namespace local
+*/
 LocalFileSystem local("local");
 ConfigFile cfg;
 
-//serial for debugging
+/**
+@namespace serial.
+*/
 Serial serial(USBTX, USBRX);
 
-//timers to check state of buttons
+/**  
+@namespace timerA.
+@brief timerA - the function timerExpiredA every 0.1 sec.
+*/
 Ticker timerA;//for buttonA
+
+/**
+@namespace timerB.
+@parameter Calls the function timerExpiredB every 0.1 sec.
+*/
 Ticker timerB;//for buttonB
 
-//create buzzer objecct
+/**
+@namespace pollJoystick.
+*/
+Ticker pollJoystick;
+
+/**
+@namespace buzzer.
+*/
 Beep buzzer(p21);
 
-//navigation/action buttons
-DigitalIn buttonA(p20);//buttonA
-DigitalIn buttonB(p19);//buttonB
+/**  
+@namespace buttonA
+*/
+DigitalIn buttonA(p20);
 
-//LED indicators
+/**  
+@namespace buttonB
+*/
+DigitalIn buttonB(p19);
+
+/**
+@namespace ledA.
+*/
 AnalogOut ledA(p18);//action LED
+
+/**
+@namespace ledP.
+*/
 DigitalOut ledP(p24);//Power LED
 
-//connections for joystick
+/**
+@namespace joyButton.
+*/
 InterruptIn joyButton(p17);//Interrupt for ISR
+
+/**
+@namespace xpot.
+*/
 AnalogIn xPot(p15);//left/right
+
+/**
+@namespace ypot.
+*/
 AnalogIn yPot(p16);//up/down
 
-//Globabl Variables /////////////////////////
+//Globabl Variables
 
 //sound FX toggle
-int FX = 0;
+int FX = 0;/*!< Toggle for Sound FX. */
 
 //previous Direction
 //stops continuous scrolling on some features
-int preDirection;
+int preDirection;/*!< Used to stop continuous scrolling. */
 
 //timer flags to check state of the buttons
-int buttonFlagA = 0;
-int buttonFlagB = 0;
+int buttonFlagA = 0;/*!< Button flag set for ISR when state of buttonA changes. */
+int buttonFlagB = 0;/*!< Button flag set for ISR when state of buttonB changes. */
 
 //button values for debounce problem
 int oldButtonA = 0;
@@ -54,13 +105,13 @@
 int newButtonB;
 
 //flag for joystick reading
-int printFlag = 0;
+int printFlag = 0;/*!< Print flag set for ISR when Joystick is moved. */
 
 //boundary conditions
-int cells [84][48];
+int cells [84][48];/*!< Boundary conditions for cells.*/
 
 //real time score
-int score = 0;
+int score = 0;/*!< Integer to show and print Scores. */
 
 //stored high score variables
 int highScore1;
@@ -68,12 +119,12 @@
 int highScore3;
 
 //global char arrays to store initials/score
-char player1initials[14] = {"1.AAA.....0"};
-char player2initials[14] = {"2.BBB.....0"};
-char player3initials[14] = {"3.CCC.....0"};
+char player1initials[14] = {"1.AAA.....0"};/*!< Buffer for printing Initials and Top Score 1.*/
+char player2initials[14] = {"2.BBB.....0"};/*!< Buffer for printing Initials and Top Score 2.*/
+char player3initials[14] = {"3.CCC.....0"};/*!< Buffer for printing Initials and Top Score 3.*/
 
 //difficulty variable - hazards fall at 2 pixels per refresh
-int fall = 2;
+int fall = 2;/*!< Increments hazards each Iteration by the Integer stored. */
 
 //global variables for movement (pixelNinja)
 int a1 = 22;
@@ -94,25 +145,25 @@
 int a16 = 21;
 
 //global variable for hazard X co-ordinates
-int randX1;
-int randX2;
-int randX3;
-int randX4;
-int randX5;
-int randX6;
+int randX1;/*!< X co-ordinate for Hazard 1. */
+int randX2;/*!< X co-ordinate for Hazard 2. */
+int randX3;/*!< X co-ordinate for Hazard 3. */
+int randX4;/*!< X co-ordinate for Hazard 4. */
+int randX5;/*!< X co-ordinate for Hazard 5. */
+int randX6;/*!< X co-ordinate for Hazard 6. */
 
 //global variable for hazard Y co-ordinates
-int randY1 = 1;
-int randY2 = 1;
-int randY3 = 1;
-int randY4 = 1;
-int randY5 = 1;
-int randY6 = 1;
+int randY1 = 1;/*!< Y co-ordinate for Hazard 1. */
+int randY2 = 1;/*!< Y co-ordinate for Hazard 2. */
+int randY3 = 1;/*!< Y co-ordinate for Hazard 3. */
+int randY4 = 1;/*!< Y co-ordinate for Hazard 4. */
+int randY5 = 1;/*!< Y co-ordinate for Hazard 5. */
+int randY6 = 1;/*!< Y co-ordinate for Hazard 6. */
 
 //integers for changing struct ouput states
-int state1 = 0;
-int state2 = 0;
-int state3 = 0;
+int state1 = 0;/*!< State number for Output 1.*/
+int state2 = 0;/*!< State number for output 2.*/
+int state3 = 0;/*!< State number for output 3.*/
 
 //prototypes
 void calibrateJoystick();
@@ -140,12 +191,48 @@
 void soundFXMenu();
 void scores();
 
+/**
+
+*/
 void drawNinja();
+
+/**
+
+*/
 void drawHazards();
+
+/**
+
+*/
 void drawWelcome();
+
+/**
+
+*/
 void drawBackground();
+
+/**
+
+*/
 void drawSoundFXMenu();
+
+/**
+
+*/
 void drawDifficultyMenu();
+
+/**
+
+*/
 void drawMainMenu();
+
+/**
+
+*/
 void drawOptionsMenu();
+
+/**
+
+*/
 void drawExitMenu();
+