Omar Alebiary / Mbed 2 deprecated el17oa

Dependencies:   mbed FXOS8700CQQQ

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 ELEC2645 Embedded Systems Project
00003 School of Electronic & Electrical Engineering
00004 University of Leeds
00005 Name:     Omar Alebiary
00006 Username: el17oa
00007 ID :      201172644
00008 Date:     15/3/2019
00009 */
00010 #include "RocketRacer.h"
00011 #include "Menus.h"
00012 #include "tests.h"
00013 
00014 // objects 
00015 // create object and specifiy pins
00016 FXOS8700CQ devicee(I2C_SDA,I2C_SCL);
00017 //instantiating the Gamepad object 
00018 Gamepad pad;
00019 
00020 // instantiating the RocketRacer object 
00021 RocketRacer Rocket_Racer;
00022 
00023 //instantiating the lcd object and assigning the pins on the gamepad to it
00024 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); 
00025 
00026 //instantiating the Menus object
00027 Menus menus;
00028 
00029 // instantiating the tests object 
00030 tests test;
00031 
00032 
00033 // prototypes
00034 /**
00035   * @brief object initialization method
00036   * @param None @details method that initializes objects like lcd,gampad and device(for accelerometer)and
00037   * sets the default contrast of the lcd and brightness 
00038   */
00039 void setup();
00040 /**
00041   * @brief main method
00042   * @param None @details main method that has all the method calls of the Menus.cpp and 
00043   * the RocketRacer class and has the Game_Loop method that runs the game
00044   */
00045 int main();
00046 
00047 
00048 
00049 void setup(){
00050     
00051     lcd.init();//initialize the lcd
00052     pad.init();//initialize the pad
00053     lcd.clear();
00054     lcd.setBrightness(0.4);//sets the default brightness
00055     lcd.setContrast(0.55);//set the default contrast
00056     lcd.normalMode();
00057     devicee.init();
00058     
00059     }
00060     
00061 
00062     
00063     
00064 int main(){
00065     
00066     
00067     setup();//initializes all the objects
00068    
00069     menus.welcomeMenu(pad,lcd);//displays the welcome menu
00070     menus.loading_menu(lcd);//displays the loading menu next
00071     pad.leds_off();//turns off the leds
00072     //calls the drawMenu which has the main menus and the game loop
00073     while(1){ //infinite loop
00074     menus.drawMenu(lcd,pad);
00075     }
00076     
00077 }
00078