Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 9:03aa2479b941
- Parent:
- 7:8d63dc3948c1
- Child:
- 10:3ecbf164c0d3
--- a/main.cpp Wed Apr 24 16:49:55 2019 +0000
+++ b/main.cpp Wed May 01 18:19:15 2019 +0000
@@ -1,18 +1,24 @@
#include "Level.h"
+
Image Image;
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
+Menu Menu;
Level Level;
Rotate Rotate;
Release Release;
Detect detect;
Draw Draw;
+logistic logistic;
+TNT TNT;
InterruptIn A(PTB9);
+InterruptIn START(PTC5);
InterruptIn B(PTD0);
-
+InterruptIn Back(PTB19);
+Gamepad Gamepad;
void init_K64F();
@@ -20,26 +26,35 @@
int main()
{
- 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);
- B.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(Image, lcd, Rotate, Release, detect, Draw, A, B);
- break;
-
- case 2:
- Level.level_2(Image, lcd, Rotate, Release, detect, Draw, A, B);
- break;
+ Gamepad.init();
+ 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);
+ break;
+
+ case 2:
+ Menu.TNT_m(lcd, A, B);
+ Level.level_2(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic);
+ break;
+
+ case 3:
+ Menu.TNT_m(lcd, A, B);
+ Level.level_3(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic);
+ break;
+ }
}
}
-}