ELEC2645 (2018/19) / Mbed 2 deprecated el16y2m

Dependencies:   mbed

Revision:
10:3ecbf164c0d3
Parent:
9:03aa2479b941
Child:
11:ef3d6696ae84
--- a/main.cpp	Wed May 01 18:19:15 2019 +0000
+++ b/main.cpp	Mon May 06 13:33:13 2019 +0000
@@ -1,7 +1,7 @@
 #include "Level.h"
+#include "Initialization.h"
 
 
-Image Image;
 
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 
@@ -13,47 +13,37 @@
 Draw Draw;
 logistic logistic;
 TNT TNT;
-
+Timer_cal Timer_cal;
+Image Image;
+Initialization Initialization;
 InterruptIn A(PTB9);
 InterruptIn START(PTC5);
 InterruptIn B(PTD0);
 InterruptIn Back(PTB19);
 Gamepad Gamepad;
 
-void init_K64F();
-
-
+void init();
+void init_value();
 
 int main()
 {
-    Gamepad.init();
+    Initialization.init(lcd, A, B, Back, START, Gamepad);
+    Initialization.init_value(Rotate, Level);
     while(1) {
-        // first need to initialise display
-        lcd.init();
-        // change set contrast in range 0.0 to 1.0
-        // 0.4 appears to be a good starting point
-        lcd.setContrast(0.5);
-
-        A.mode(PullDown);
-        START.mode(PullDown);
-        B.mode(PullDown);
-        Back.mode(PullDown);
-        // since SW2 has an external pull-up, we should disable to internal pull-down
-        // resistor that is enabled by default using InterruptIn
         switch(level) {
             case 1:
-                Level.level_1(Menu, Image, lcd, Rotate, Release, detect, Draw, START, B, Back, A, TNT, Gamepad, logistic);
+                Level.level_1(Menu, Image, lcd, Rotate, Release, detect, Draw, START, B, Back, A, TNT, Gamepad, logistic, Timer_cal, Level);
                 break;
 
             case 2:
                 Menu.TNT_m(lcd, A, B);
-                Level.level_2(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic);
+                Level.level_2(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic, Timer_cal, Level);
                 break;
-            
+
             case 3:
                 Menu.TNT_m(lcd, A, B);
-                Level.level_3(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic);
-                break;    
+                Level.level_3(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic, Timer_cal, Level);
+                break;
         }
     }
 }