contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Sat Apr 27 02:00:28 2019 +0000
Revision:
30:c5060010a1e6
Parent:
29:e660274d8222
Child:
31:4d4a9d78cae5
added accelerometer control for the game

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 27:771d186b1bc8 1 /*
OmarAlebiary 27:771d186b1bc8 2 Electronic & Computer Engineering
OmarAlebiary 27:771d186b1bc8 3 ELEC2645 Embedded Systems Project
OmarAlebiary 27:771d186b1bc8 4 University of Leeds
OmarAlebiary 27:771d186b1bc8 5 Name: Omar Alebiary
OmarAlebiary 27:771d186b1bc8 6 Username: el17oa
OmarAlebiary 27:771d186b1bc8 7 ID : 201172644
OmarAlebiary 27:771d186b1bc8 8 Date: 15/3/2019
OmarAlebiary 27:771d186b1bc8 9 */
OmarAlebiary 22:3e6ff378d651 10 #include "RocketRacer.h"
OmarAlebiary 22:3e6ff378d651 11 #include "Menus.h"
OmarAlebiary 26:35714debc45f 12 #include "tests.h"
OmarAlebiary 23:2ca9735b16ef 13
OmarAlebiary 22:3e6ff378d651 14 // objects
OmarAlebiary 30:c5060010a1e6 15 FXOS8700CQ devicee(I2C_SDA,I2C_SCL);
OmarAlebiary 29:e660274d8222 16 //instantiating the Gamepad object
OmarAlebiary 22:3e6ff378d651 17 Gamepad pad;
OmarAlebiary 29:e660274d8222 18
OmarAlebiary 29:e660274d8222 19 // instantiating the RocketRacer object
OmarAlebiary 22:3e6ff378d651 20 RocketRacer Rocket_Racer;
OmarAlebiary 29:e660274d8222 21
OmarAlebiary 29:e660274d8222 22 //instantiating the lcd object and assigning the pins on the gamepad to it
OmarAlebiary 22:3e6ff378d651 23 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
OmarAlebiary 29:e660274d8222 24
OmarAlebiary 29:e660274d8222 25 //instantiating the Menus object
OmarAlebiary 22:3e6ff378d651 26 Menus menus;
OmarAlebiary 29:e660274d8222 27
OmarAlebiary 29:e660274d8222 28 // instantiating the tests object
OmarAlebiary 26:35714debc45f 29 tests test;
OmarAlebiary 22:3e6ff378d651 30
OmarAlebiary 30:c5060010a1e6 31
OmarAlebiary 22:3e6ff378d651 32 // prototypes
OmarAlebiary 22:3e6ff378d651 33 /**
OmarAlebiary 22:3e6ff378d651 34 * @brief object initialization method
OmarAlebiary 22:3e6ff378d651 35 * @param None @details method that initializes objects like lcd,gampad and sets the default
OmarAlebiary 22:3e6ff378d651 36 * contrast of the lcd and brightness
OmarAlebiary 22:3e6ff378d651 37 */
OmarAlebiary 22:3e6ff378d651 38 void setup();
OmarAlebiary 22:3e6ff378d651 39 /**
OmarAlebiary 22:3e6ff378d651 40 * @brief main method
OmarAlebiary 22:3e6ff378d651 41 * @param None @details main method that has all the method calls of the Menus.cpp and
OmarAlebiary 22:3e6ff378d651 42 * the RocketRacer class and has the Game_Loop method that runs the game
OmarAlebiary 22:3e6ff378d651 43 */
OmarAlebiary 22:3e6ff378d651 44 int main();
OmarAlebiary 22:3e6ff378d651 45
OmarAlebiary 22:3e6ff378d651 46
OmarAlebiary 22:3e6ff378d651 47
OmarAlebiary 22:3e6ff378d651 48 void setup(){
OmarAlebiary 22:3e6ff378d651 49
OmarAlebiary 22:3e6ff378d651 50 lcd.init();//initialize the lcd
OmarAlebiary 22:3e6ff378d651 51 pad.init();//initialize the pad
OmarAlebiary 22:3e6ff378d651 52 lcd.clear();
OmarAlebiary 22:3e6ff378d651 53 lcd.setBrightness(0.4);//sets the default brightness
OmarAlebiary 22:3e6ff378d651 54 lcd.setContrast(0.55);//set the default contrast
OmarAlebiary 22:3e6ff378d651 55 lcd.normalMode();
OmarAlebiary 30:c5060010a1e6 56 devicee.init();
OmarAlebiary 22:3e6ff378d651 57
OmarAlebiary 22:3e6ff378d651 58 }
OmarAlebiary 22:3e6ff378d651 59
OmarAlebiary 22:3e6ff378d651 60
OmarAlebiary 22:3e6ff378d651 61
OmarAlebiary 22:3e6ff378d651 62
OmarAlebiary 22:3e6ff378d651 63 int main(){
OmarAlebiary 22:3e6ff378d651 64
OmarAlebiary 22:3e6ff378d651 65
OmarAlebiary 22:3e6ff378d651 66 setup();
OmarAlebiary 26:35714debc45f 67 // test.test_welcomeMenu(pad,lcd);
OmarAlebiary 28:39607fb67e88 68 // test.test_Play_Welcome_Melody(pad);
OmarAlebiary 28:39607fb67e88 69 // test.test_End_Game_Melody(Gamepad &pad);
OmarAlebiary 26:35714debc45f 70 // test.test_drawMenu(lcd, pad);
OmarAlebiary 26:35714debc45f 71 // test.test_credits_page(lcd,pad);
OmarAlebiary 26:35714debc45f 72 // test.test_loading_menu(lcd);
OmarAlebiary 26:35714debc45f 73 // test.test_InstructionsMenu(pad,lcd);
OmarAlebiary 26:35714debc45f 74 // test.test_Game_Loop(pad,lcd);
OmarAlebiary 30:c5060010a1e6 75
OmarAlebiary 26:35714debc45f 76
OmarAlebiary 25:7e3b6df93dd5 77 menus.welcomeMenu(pad,lcd);
OmarAlebiary 25:7e3b6df93dd5 78 menus.loading_menu(lcd);
OmarAlebiary 25:7e3b6df93dd5 79 pad.leds_off();
OmarAlebiary 22:3e6ff378d651 80
OmarAlebiary 22:3e6ff378d651 81 while(1){
OmarAlebiary 25:7e3b6df93dd5 82 menus.drawMenu(lcd,pad);
OmarAlebiary 22:3e6ff378d651 83 }
OmarAlebiary 25:7e3b6df93dd5 84
OmarAlebiary 22:3e6ff378d651 85 }
OmarAlebiary 22:3e6ff378d651 86