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@7:8d63dc3948c1, 2019-04-23 (annotated)
- Committer:
- MYY
- Date:
- Tue Apr 23 17:56:57 2019 +0000
- Revision:
- 7:8d63dc3948c1
- Parent:
- 6:7d0e05c39c22
- Child:
- 9:03aa2479b941
Create new levels, and also make the code more simplify and debuggable.
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 | 0:4ada39fe4ffc | 3 | Image Image; |
| MYY | 0:4ada39fe4ffc | 4 | |
| MYY | 0:4ada39fe4ffc | 5 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| MYY | 0:4ada39fe4ffc | 6 | |
| MYY | 7:8d63dc3948c1 | 7 | Level Level; |
| MYY | 0:4ada39fe4ffc | 8 | Rotate Rotate; |
| MYY | 1:7a3eed610fea | 9 | Release Release; |
| MYY | 4:b52a0d2925df | 10 | Detect detect; |
| MYY | 6:7d0e05c39c22 | 11 | Draw Draw; |
| MYY | 5:fe1f5b231446 | 12 | |
| MYY | 0:4ada39fe4ffc | 13 | InterruptIn A(PTB9); |
| MYY | 1:7a3eed610fea | 14 | InterruptIn B(PTD0); |
| MYY | 0:4ada39fe4ffc | 15 | |
| MYY | 0:4ada39fe4ffc | 16 | |
| MYY | 0:4ada39fe4ffc | 17 | void init_K64F(); |
| MYY | 0:4ada39fe4ffc | 18 | |
| MYY | 0:4ada39fe4ffc | 19 | |
| MYY | 5:fe1f5b231446 | 20 | |
| MYY | 0:4ada39fe4ffc | 21 | int main() |
| MYY | 0:4ada39fe4ffc | 22 | { |
| MYY | 7:8d63dc3948c1 | 23 | while(1) { |
| MYY | 0:4ada39fe4ffc | 24 | // first need to initialise display |
| MYY | 0:4ada39fe4ffc | 25 | lcd.init(); |
| MYY | 0:4ada39fe4ffc | 26 | // change set contrast in range 0.0 to 1.0 |
| MYY | 0:4ada39fe4ffc | 27 | // 0.4 appears to be a good starting point |
| MYY | 0:4ada39fe4ffc | 28 | lcd.setContrast(0.5); |
| MYY | 1:7a3eed610fea | 29 | |
| MYY | 0:4ada39fe4ffc | 30 | A.mode(PullDown); |
| MYY | 1:7a3eed610fea | 31 | B.mode(PullDown); |
| MYY | 0:4ada39fe4ffc | 32 | // since SW2 has an external pull-up, we should disable to internal pull-down |
| MYY | 0:4ada39fe4ffc | 33 | // resistor that is enabled by default using InterruptIn |
| MYY | 7:8d63dc3948c1 | 34 | switch(level) { |
| MYY | 7:8d63dc3948c1 | 35 | case 1: |
| MYY | 7:8d63dc3948c1 | 36 | Level.level_1(Image, lcd, Rotate, Release, detect, Draw, A, B); |
| MYY | 7:8d63dc3948c1 | 37 | break; |
| MYY | 7:8d63dc3948c1 | 38 | |
| MYY | 7:8d63dc3948c1 | 39 | case 2: |
| MYY | 7:8d63dc3948c1 | 40 | Level.level_2(Image, lcd, Rotate, Release, detect, Draw, A, B); |
| MYY | 7:8d63dc3948c1 | 41 | break; |
| MYY | 0:4ada39fe4ffc | 42 | } |
| MYY | 0:4ada39fe4ffc | 43 | } |
| MYY | 0:4ada39fe4ffc | 44 | } |
| MYY | 0:4ada39fe4ffc | 45 |