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
main.cpp@9:03aa2479b941, 2019-05-01 (annotated)
- Committer:
- MYY
- Date:
- Wed May 01 18:19:15 2019 +0000
- Revision:
- 9:03aa2479b941
- Parent:
- 7:8d63dc3948c1
- Child:
- 10:3ecbf164c0d3
Add level 3 and TNT effect.;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MYY | 7:8d63dc3948c1 | 1 | #include "Level.h" |
| MYY | 0:4ada39fe4ffc | 2 | |
| MYY | 9:03aa2479b941 | 3 | |
| MYY | 0:4ada39fe4ffc | 4 | Image Image; |
| MYY | 0:4ada39fe4ffc | 5 | |
| MYY | 0:4ada39fe4ffc | 6 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| MYY | 0:4ada39fe4ffc | 7 | |
| MYY | 9:03aa2479b941 | 8 | Menu Menu; |
| MYY | 7:8d63dc3948c1 | 9 | Level Level; |
| MYY | 0:4ada39fe4ffc | 10 | Rotate Rotate; |
| MYY | 1:7a3eed610fea | 11 | Release Release; |
| MYY | 4:b52a0d2925df | 12 | Detect detect; |
| MYY | 6:7d0e05c39c22 | 13 | Draw Draw; |
| MYY | 9:03aa2479b941 | 14 | logistic logistic; |
| MYY | 9:03aa2479b941 | 15 | TNT TNT; |
| MYY | 5:fe1f5b231446 | 16 | |
| MYY | 0:4ada39fe4ffc | 17 | InterruptIn A(PTB9); |
| MYY | 9:03aa2479b941 | 18 | InterruptIn START(PTC5); |
| MYY | 1:7a3eed610fea | 19 | InterruptIn B(PTD0); |
| MYY | 9:03aa2479b941 | 20 | InterruptIn Back(PTB19); |
| MYY | 9:03aa2479b941 | 21 | Gamepad Gamepad; |
| MYY | 0:4ada39fe4ffc | 22 | |
| MYY | 0:4ada39fe4ffc | 23 | void init_K64F(); |
| MYY | 0:4ada39fe4ffc | 24 | |
| MYY | 0:4ada39fe4ffc | 25 | |
| MYY | 5:fe1f5b231446 | 26 | |
| MYY | 0:4ada39fe4ffc | 27 | int main() |
| MYY | 0:4ada39fe4ffc | 28 | { |
| MYY | 9:03aa2479b941 | 29 | Gamepad.init(); |
| MYY | 9:03aa2479b941 | 30 | while(1) { |
| MYY | 9:03aa2479b941 | 31 | // first need to initialise display |
| MYY | 9:03aa2479b941 | 32 | lcd.init(); |
| MYY | 9:03aa2479b941 | 33 | // change set contrast in range 0.0 to 1.0 |
| MYY | 9:03aa2479b941 | 34 | // 0.4 appears to be a good starting point |
| MYY | 9:03aa2479b941 | 35 | lcd.setContrast(0.5); |
| MYY | 9:03aa2479b941 | 36 | |
| MYY | 9:03aa2479b941 | 37 | A.mode(PullDown); |
| MYY | 9:03aa2479b941 | 38 | START.mode(PullDown); |
| MYY | 9:03aa2479b941 | 39 | B.mode(PullDown); |
| MYY | 9:03aa2479b941 | 40 | Back.mode(PullDown); |
| MYY | 9:03aa2479b941 | 41 | // since SW2 has an external pull-up, we should disable to internal pull-down |
| MYY | 9:03aa2479b941 | 42 | // resistor that is enabled by default using InterruptIn |
| MYY | 9:03aa2479b941 | 43 | switch(level) { |
| MYY | 9:03aa2479b941 | 44 | case 1: |
| MYY | 9:03aa2479b941 | 45 | Level.level_1(Menu, Image, lcd, Rotate, Release, detect, Draw, START, B, Back, A, TNT, Gamepad, logistic); |
| MYY | 9:03aa2479b941 | 46 | break; |
| MYY | 9:03aa2479b941 | 47 | |
| MYY | 9:03aa2479b941 | 48 | case 2: |
| MYY | 9:03aa2479b941 | 49 | Menu.TNT_m(lcd, A, B); |
| MYY | 9:03aa2479b941 | 50 | Level.level_2(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic); |
| MYY | 9:03aa2479b941 | 51 | break; |
| MYY | 9:03aa2479b941 | 52 | |
| MYY | 9:03aa2479b941 | 53 | case 3: |
| MYY | 9:03aa2479b941 | 54 | Menu.TNT_m(lcd, A, B); |
| MYY | 9:03aa2479b941 | 55 | Level.level_3(Image, lcd, Rotate, Release, detect, Draw, A, B, TNT, logistic); |
| MYY | 9:03aa2479b941 | 56 | break; |
| MYY | 9:03aa2479b941 | 57 | } |
| MYY | 0:4ada39fe4ffc | 58 | } |
| MYY | 0:4ada39fe4ffc | 59 | } |
| MYY | 0:4ada39fe4ffc | 60 |