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

Dependencies:   ConfigFile N5110 PowerControl beep mbed

Revision:
55:bb4f6cc196c8
Parent:
54:8180eec1656d
Child:
56:7c2a4f2a6d70
--- a/main.cpp	Fri May 01 22:07:05 2015 +0000
+++ b/main.cpp	Fri May 01 23:12:52 2015 +0000
@@ -3,17 +3,16 @@
 @brief Program implementation
 */
 
+#include "PowerControl/PowerControl.h"
 #include "mbed.h"
 #include "N5110.h"
 #include "beep.h"
 #include "tower.h"
-#include "PowerControl/PowerControl.h"
-
 #include <ctime>
 #include <cstdlib>
 
 //read/write memory function
-void memory()
+void write()
 {
     //write
     if (!cfg.setValue("Open", player1initials)) {//key/value
@@ -23,8 +22,10 @@
     if (!cfg.write("/local/towerMemory.cfg")) {
         error("Failure to write a configuration file.\n");
     }
+}
 
-//read
+//read file
+void read(){
     char *key = "Open";//check key matches
 
     //check file-if read unsuccessful print  error message
@@ -1206,14 +1207,13 @@
     pollJoystick.attach(&updateJoystick,1.0/10.0);//read joystick 10 times per second
 
     lcd.init();//initialise screen
-
     drawWelcome();//welcome screen
-
     lcd.clear();//clear pixels
 
     buttonA.mode(PullDown);//pull down buttonA
     buttonB.mode(PullDown);//pull down buttonB
-    memory();
+    write();
+    read();
 
     int exitFlag = 0;//exit flag
     int mainOption = 0;//counter for main menu
@@ -1221,7 +1221,7 @@
 
     timerA.attach(&timerExpiredA, 0.1);//checks state of buttonA
     timerB.attach(&timerExpiredB, 0.1);//checks state of buttonB
-
+  
     while(1) {
         drawMainMenu();//draws main menu
         mainMenu(mainOption);//presents main menu options