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

Dependencies:   ConfigFile N5110 PowerControl beep mbed

Revision:
20:993c12c6a7bc
Parent:
19:e0fd493816ae
Child:
21:1fbbd8ebb3d9
--- a/tower.h	Sat Apr 18 05:13:05 2015 +0000
+++ b/tower.h	Sat Apr 18 05:43:48 2015 +0000
@@ -765,7 +765,7 @@
         if (joystick.direction == DOWN) {
             serial.printf(" DOWN\n");
             fxOption = fxOption++;
-            if (fxOption > 2)fxOption = 2;
+            if (fxOption > 1)fxOption = 1;
         }
         // Centre / Unknown orientation
         if (joystick.direction == CENTRE)
@@ -904,7 +904,8 @@
 
 /// Exit Menu (Back button pressed)///
             if(buttonFlagB) {
-                buttonFlagB = 0;
+                buttonFlagB = 0;//reset flags
+                buttonFlagA = 0;
                 actionButtons();
                 drawExitMenu();//draws the exit menu
 
@@ -913,7 +914,8 @@
 
                     // 'exit' option YES
                     if((buttonFlagA)&&(exitOption == 0)) { //returns to menu
-                        buttonFlagA = 0;
+                        buttonFlagA = 0;//reset flags
+                        buttonFlagB = 0;
                         actionButtons();
                         lcd.clear();//clears screen
                         resetGame();//resets scores/objects
@@ -922,7 +924,8 @@
                     }
                     // 'exit' option NO - returns to game
                     if((buttonFlagA)&&(exitOption == 1)) {
-                        buttonFlagA = 0;
+                        buttonFlagA = 0;//resets flags
+                        buttonFlagB = 0;
                         break;
                     }
                     sleep();//put while to sleep
@@ -1001,7 +1004,8 @@
                 difficultyMenu(subOption);//presents difficulty options
 
                 if(buttonFlagB) {
-                    buttonFlagB = 0;//reset flag
+                    buttonFlagB = 0;//reset flags
+                    buttonFlagA = 0;
                     lcd.clear();//clear screen
                     break;//return back
                 }
@@ -1011,7 +1015,8 @@
         }
 ///////////////////// sound FX menu //////////////////////////////////////
         if((option ==1)&&(buttonFlagA)) {
-            buttonFlagA = 0;//reset flag
+            buttonFlagA = 0;//reset flags
+            buttonFlagB = 0;
             actionButtons();
             drawSoundFXMenu();//draw menu
 
@@ -1021,7 +1026,8 @@
 
                 // back to options menu
                 if(buttonFlagB) {
-                    buttonFlagB = 0;//reset flag
+                    buttonFlagB = 0;//reset flags
+                    buttonFlagA = 0;
                     lcd.clear();//clear screen
                     break;//return back
                 }
@@ -1031,7 +1037,8 @@
         }
         // back to mainmenu
         if(buttonFlagB) {
-            buttonFlagB = 0;//reset flag
+            buttonFlagB = 0;//reset flags
+            buttonFlagA = 0;
             lcd.clear();//clear
             break;//return back
         }