ELEC2645 (2018/19) / Mbed 2 deprecated el17dtt

Dependencies:   mbed

main.cpp

Committer:
batJoro
Date:
2019-05-04
Revision:
7:9e9424f5ec4b
Parent:
6:4c55dd4b6d42
Child:
8:b3738229ba85

File content as of revision 7:9e9424f5ec4b:



/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering University of Leeds

Name: Dobri Tsvetkov
Username: el17dtt
Student ID Number: 201154059
Date: 12.03.2019
*/


#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "menu.h"
#include "engine.h"



/////////////// structs /////////////////


/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad gamepad;

///////////// prototypes ///////////////
void init();
void welcome();
void render();

///////////// functions ////////////////
int main() {
    
    init();
    
    welcome();
    
    // game loop - read input, update the game state and render the display
    while(1) {
        render();
    }
}

// initialies all classes and libraries
void init()
{

    // need to initialise LCD and Gamepad 
    lcd.init();
    gamepad.init();

    gamepad.leds_on();
    lcd.setContrast(0.4);
}
// function to call the intro method of the menu class
void welcome() {
    
    Menu menu;   
    menu.intro(lcd, gamepad);
    menu.startMainMenu(lcd, gamepad);
}
// this function draws each frame on the LCD
void render() {
    
        lcd.clear();
        lcd.refresh();
}