A retro gaming programme, designed for use on a portable embedded system. Incorporates power saving techniques.
Dependencies: ConfigFile N5110 PowerControl beep mbed
main.cpp
- Committer:
- el13drt
- Date:
- 2015-04-21
- Revision:
- 35:9f55326c1b0a
- Parent:
- 19:e0fd493816ae
- Child:
- 40:56ab6d368e9b
File content as of revision 35:9f55326c1b0a:
/** @file main.cpp @brief Program implementation */ #include "mbed.h" #include "N5110.h" #include "beep.h" #include "tower.h" #include "PowerControl/PowerControl.h" #include <ctime> #include <cstdlib> int main() { ledR = 1;//power LED on randomise();//randomises falling hazards (initial values only) calibrateJoystick();//get centred values of joystick 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 int exitFlag = 0;//exit flag int mainOption = 0;//counter for main menu int exitOption = 0;//counter for exit menu timerA.attach(&timerExpiredA, 0.2);//checks state of buttonA timerB.attach(&timerExpiredB, 0.2);//checks state of buttonB while(1) { drawMainMenu();//draws main menu mainMenu(mainOption);//presents main menu options // if 'Play Game' selected if ((mainOption == 0)&&(buttonFlagA)) { buttonFlagA = 0; buttonFlagB = 0; game(exitFlag, exitOption);//actual game } // if 'Scores' selected if((mainOption == 1)&&(buttonFlagA)) { buttonFlagA = 0; buttonFlagB = 0; scores(); } // if 'option' selected if((mainOption == 2)&&(buttonFlagA)) { buttonFlagA = 0; buttonFlagB = 0; optionsMenu(); } sleep(); } }