Mochu Yao explorer game
Dependencies: mbed
main.cpp@19:14c5427b30d1, 2020-04-28 (annotated)
- Committer:
- el17my
- Date:
- Tue Apr 28 13:37:26 2020 +0000
- Revision:
- 19:14c5427b30d1
- Parent:
- 16:ccd6f707dc79
- Child:
- 21:349c70c8a7de
4.28
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17my | 16:ccd6f707dc79 | 1 | /* |
el17my | 16:ccd6f707dc79 | 2 | ELEC2645 Embedded Systems Project |
el17my | 16:ccd6f707dc79 | 3 | School of Electronic & Electrical Engineering |
el17my | 16:ccd6f707dc79 | 4 | University of Leeds |
el17my | 16:ccd6f707dc79 | 5 | 2019/20 |
el17my | 16:ccd6f707dc79 | 6 | |
el17my | 16:ccd6f707dc79 | 7 | Name:Yao mochu |
el17my | 16:ccd6f707dc79 | 8 | Username:el17my |
el17my | 16:ccd6f707dc79 | 9 | Student ID Number:201199854 |
el17my | 16:ccd6f707dc79 | 10 | Date:2020/4/28 |
el17my | 16:ccd6f707dc79 | 11 | */ |
el17my | 16:ccd6f707dc79 | 12 | |
el17my | 16:ccd6f707dc79 | 13 | // includes |
el17my | 16:ccd6f707dc79 | 14 | #include "mbed.h" |
el17my | 16:ccd6f707dc79 | 15 | #include "Gamepad.h" |
el17my | 16:ccd6f707dc79 | 16 | #include "N5110.h" |
el17my | 16:ccd6f707dc79 | 17 | #include "menu.h" |
el17my | 16:ccd6f707dc79 | 18 | |
el17my | 16:ccd6f707dc79 | 19 | |
el17my | 16:ccd6f707dc79 | 20 | // objects |
el17my | 16:ccd6f707dc79 | 21 | Gamepad gamepad; |
el17my | 16:ccd6f707dc79 | 22 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
el17my | 16:ccd6f707dc79 | 23 | menu _menu; |
el17my | 16:ccd6f707dc79 | 24 | |
el17my | 16:ccd6f707dc79 | 25 | int main() |
el17my | 16:ccd6f707dc79 | 26 | { gamepad.init(); |
el17my | 16:ccd6f707dc79 | 27 | _menu.init(); |
el17my | 16:ccd6f707dc79 | 28 | lcd.init(); |
el17my | 16:ccd6f707dc79 | 29 | lcd.normalMode(); |
el17my | 16:ccd6f707dc79 | 30 | lcd.setBrightness(0.5); |
el17my | 16:ccd6f707dc79 | 31 | while(1) { |
el17my | 16:ccd6f707dc79 | 32 | lcd.setContrast(gamepad.read_pot()); // Contrast is controlled by pot. |
el17my | 16:ccd6f707dc79 | 33 | lcd.clear(); |
el17my | 19:14c5427b30d1 | 34 | _menu.run_engine(lcd, gamepad); |
el17my | 16:ccd6f707dc79 | 35 | lcd.refresh(); |
el17my | 16:ccd6f707dc79 | 36 | wait(0.01); } |
el17my | 16:ccd6f707dc79 | 37 | } |