Su 200943147

Dependencies:   Gamepad N5110 mbed

Committer:
GS00
Date:
Sat Apr 29 13:10:21 2017 +0000
Revision:
3:9dd35424cdfe
Parent:
0:444b4d0a113d
Child:
4:1faa216ac5cd
Child:
5:afa6592a4ba5
Version 4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GS00 0:444b4d0a113d 1 #include "mbed.h"
GS00 0:444b4d0a113d 2 #include "N5110.h"
GS00 3:9dd35424cdfe 3 #include "Engine.h"
GS00 3:9dd35424cdfe 4 #include "Gamepad.h"
GS00 0:444b4d0a113d 5
GS00 3:9dd35424cdfe 6 struct UserInput {
GS00 3:9dd35424cdfe 7 Direction d;
GS00 3:9dd35424cdfe 8 };
GS00 3:9dd35424cdfe 9
GS00 3:9dd35424cdfe 10 //N5110 lcd(p7,p8,p9,p10,p11,p13,p21);
GS00 0:444b4d0a113d 11 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
GS00 3:9dd35424cdfe 12 Gamepad pad;
GS00 3:9dd35424cdfe 13 Engine Engine;
GS00 3:9dd35424cdfe 14 void Init();
GS00 0:444b4d0a113d 15
GS00 3:9dd35424cdfe 16 int main()
GS00 3:9dd35424cdfe 17 {
GS00 3:9dd35424cdfe 18 Init();
GS00 3:9dd35424cdfe 19 // game loop - read input, update the game state and render the display
GS00 3:9dd35424cdfe 20 while (1) {
GS00 3:9dd35424cdfe 21 Engine.ReadInput(pad);
GS00 3:9dd35424cdfe 22 Engine.Update(pad);
GS00 3:9dd35424cdfe 23 Engine.Pixel(lcd);
GS00 3:9dd35424cdfe 24 lcd.refresh();
GS00 3:9dd35424cdfe 25 wait(0.1);
GS00 3:9dd35424cdfe 26 }
GS00 3:9dd35424cdfe 27 }
GS00 3:9dd35424cdfe 28
GS00 3:9dd35424cdfe 29 void Init()
GS00 3:9dd35424cdfe 30 {
GS00 3:9dd35424cdfe 31 // need to initialise LCD and Gamepad
GS00 3:9dd35424cdfe 32 lcd.init();
GS00 3:9dd35424cdfe 33 pad.init();
GS00 3:9dd35424cdfe 34
GS00 3:9dd35424cdfe 35 // initialise the game
GS00 3:9dd35424cdfe 36 Engine.Init();
GS00 3:9dd35424cdfe 37 lcd.normalMode(); // normal colour mode
GS00 3:9dd35424cdfe 38 lcd.setBrightness(0.5); // put LED backlight on 50%
GS00 3:9dd35424cdfe 39
GS00 3:9dd35424cdfe 40 }