contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Committer:
OmarAlebiary
Date:
Tue May 07 15:17:21 2019 +0000
Revision:
40:13b8467526d0
Parent:
39:822b66b1c935
Final Submission. I have read and agreed with Statement of Academic Integrity

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OmarAlebiary 27:771d186b1bc8 1 /*
OmarAlebiary 27:771d186b1bc8 2 ELEC2645 Embedded Systems Project
OmarAlebiary 39:822b66b1c935 3 School of Electronic & Electrical Engineering
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 33:24ef796ff2c8 15 // create object and specifiy pins
OmarAlebiary 30:c5060010a1e6 16 FXOS8700CQ devicee(I2C_SDA,I2C_SCL);
OmarAlebiary 29:e660274d8222 17 //instantiating the Gamepad object
OmarAlebiary 22:3e6ff378d651 18 Gamepad pad;
OmarAlebiary 29:e660274d8222 19
OmarAlebiary 29:e660274d8222 20 // instantiating the RocketRacer object
OmarAlebiary 22:3e6ff378d651 21 RocketRacer Rocket_Racer;
OmarAlebiary 29:e660274d8222 22
OmarAlebiary 29:e660274d8222 23 //instantiating the lcd object and assigning the pins on the gamepad to it
OmarAlebiary 22:3e6ff378d651 24 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
OmarAlebiary 29:e660274d8222 25
OmarAlebiary 29:e660274d8222 26 //instantiating the Menus object
OmarAlebiary 22:3e6ff378d651 27 Menus menus;
OmarAlebiary 29:e660274d8222 28
OmarAlebiary 29:e660274d8222 29 // instantiating the tests object
OmarAlebiary 26:35714debc45f 30 tests test;
OmarAlebiary 22:3e6ff378d651 31
OmarAlebiary 30:c5060010a1e6 32
OmarAlebiary 22:3e6ff378d651 33 // prototypes
OmarAlebiary 22:3e6ff378d651 34 /**
OmarAlebiary 22:3e6ff378d651 35 * @brief object initialization method
OmarAlebiary 32:e5d997d2ed79 36 * @param None @details method that initializes objects like lcd,gampad and device(for accelerometer)and
OmarAlebiary 32:e5d997d2ed79 37 * sets the default contrast of the lcd and brightness
OmarAlebiary 22:3e6ff378d651 38 */
OmarAlebiary 22:3e6ff378d651 39 void setup();
OmarAlebiary 22:3e6ff378d651 40 /**
OmarAlebiary 22:3e6ff378d651 41 * @brief main method
OmarAlebiary 22:3e6ff378d651 42 * @param None @details main method that has all the method calls of the Menus.cpp and
OmarAlebiary 22:3e6ff378d651 43 * the RocketRacer class and has the Game_Loop method that runs the game
OmarAlebiary 22:3e6ff378d651 44 */
OmarAlebiary 22:3e6ff378d651 45 int main();
OmarAlebiary 22:3e6ff378d651 46
OmarAlebiary 22:3e6ff378d651 47
OmarAlebiary 22:3e6ff378d651 48
OmarAlebiary 22:3e6ff378d651 49 void setup(){
OmarAlebiary 22:3e6ff378d651 50
OmarAlebiary 22:3e6ff378d651 51 lcd.init();//initialize the lcd
OmarAlebiary 22:3e6ff378d651 52 pad.init();//initialize the pad
OmarAlebiary 22:3e6ff378d651 53 lcd.clear();
OmarAlebiary 22:3e6ff378d651 54 lcd.setBrightness(0.4);//sets the default brightness
OmarAlebiary 22:3e6ff378d651 55 lcd.setContrast(0.55);//set the default contrast
OmarAlebiary 22:3e6ff378d651 56 lcd.normalMode();
OmarAlebiary 30:c5060010a1e6 57 devicee.init();
OmarAlebiary 22:3e6ff378d651 58
OmarAlebiary 22:3e6ff378d651 59 }
OmarAlebiary 22:3e6ff378d651 60
OmarAlebiary 22:3e6ff378d651 61
OmarAlebiary 22:3e6ff378d651 62
OmarAlebiary 22:3e6ff378d651 63
OmarAlebiary 22:3e6ff378d651 64 int main(){
OmarAlebiary 22:3e6ff378d651 65
OmarAlebiary 22:3e6ff378d651 66
OmarAlebiary 40:13b8467526d0 67 setup();//initializes all the objects
OmarAlebiary 31:4d4a9d78cae5 68
OmarAlebiary 33:24ef796ff2c8 69 menus.welcomeMenu(pad,lcd);//displays the welcome menu
OmarAlebiary 33:24ef796ff2c8 70 menus.loading_menu(lcd);//displays the loading menu next
OmarAlebiary 33:24ef796ff2c8 71 pad.leds_off();//turns off the leds
OmarAlebiary 33:24ef796ff2c8 72 //calls the drawMenu which has the main menus and the game loop
OmarAlebiary 33:24ef796ff2c8 73 while(1){ //infinite loop
OmarAlebiary 25:7e3b6df93dd5 74 menus.drawMenu(lcd,pad);
OmarAlebiary 22:3e6ff378d651 75 }
OmarAlebiary 25:7e3b6df93dd5 76
OmarAlebiary 22:3e6ff378d651 77 }
OmarAlebiary 22:3e6ff378d651 78