Su 200943147

Dependencies:   Gamepad N5110 mbed

main.cpp

Committer:
GS00
Date:
2017-04-29
Revision:
3:9dd35424cdfe
Parent:
0:444b4d0a113d
Child:
4:1faa216ac5cd
Child:
5:afa6592a4ba5

File content as of revision 3:9dd35424cdfe:

#include "mbed.h"
#include "N5110.h"
#include "Engine.h"
#include "Gamepad.h"

struct UserInput {
    Direction d;
};

//N5110 lcd(p7,p8,p9,p10,p11,p13,p21);
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Gamepad pad;
Engine Engine;
void Init();

int main()
{
    Init();
    // game loop - read input, update the game state and render the display
    while (1) {
        Engine.ReadInput(pad);
        Engine.Update(pad);
        Engine.Pixel(lcd);
        lcd.refresh();
        wait(0.1);
    }
}

void Init()
{
    // need to initialise LCD and Gamepad
    lcd.init();
    pad.init();

    // initialise the game
    Engine.Init();
    lcd.normalMode();      // normal colour mode
    lcd.setBrightness(0.5); // put LED backlight on 50%
    
}