ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Revision:
1:0001cb3eb053
Parent:
0:40c03e733b77
Child:
2:360a6c301a4e
--- a/main.cpp	Mon Mar 11 10:04:06 2019 +0000
+++ b/main.cpp	Tue Apr 09 20:15:33 2019 +0000
@@ -1,10 +1,50 @@
-/*
-ELEC2645 Embedded Systems Project
-School of Electronic & Electrical Engineering
-University of Leeds
-Name: Melissa Hartmann
-Username: el17m2h
-Student ID Number: 201176603
-Date: 11/03/2019
-*/
-
+#include "mbed.h" 
+#include "Gamepad.h" 
+#include "N5110.h" 
+#include "Floors.h"  
+
+#define FLOORS_WIDTH 2
+#define FLOORS_HEIGHT 10
+
+// objects
+N5110 lcd(PTC5,PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); // START, LCD SCE, LCD RST, LCD DC, LCD MOSI, LCD CLK, LCD Backlight
+Gamepad pad;
+Floors fls;
+
+// prototypes 
+void init();
+void draw();
+void welcome();
+
+// functions
+int main(){
+    int fps = 8;  // frames per second
+    init();     // initialise and then display welcome screen...
+    while(1){   
+      welcome();
+      if ( pad.check_event(Gamepad::START_PRESSED) == true) {      
+           break; }
+    }
+    draw();  
+}
+
+// initialies all classes and libraries
+void init(){
+    // need to initialise LCD and Gamepad 
+    lcd.init();
+    pad.init();
+    fls.init(FLOORS_HEIGHT, FLOORS_WIDTH);
+}
+
+// Starting menu screen display
+void welcome() {   
+    lcd.printString(" Doodle Jump! ",0,1);  
+    lcd.printString("  Press Start ",0,4);
+    lcd.refresh();
+ }
+ 
+void draw(){
+    lcd.clear();
+    fls.draw(lcd);
+    lcd.refresh();
+}
\ No newline at end of file