Chukwuebuka Nwibe
/
el16ccn
el16ccn_maze
main.cpp@10:e3faadd7d3db, 2018-05-08 (annotated)
- Committer:
- el16ccn
- Date:
- Tue May 08 14:42:55 2018 +0000
- Revision:
- 10:e3faadd7d3db
- Parent:
- 8:be96fa6ee999
final; re-do
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el16ccn | 0:6fd979edf153 | 1 | /* |
el16ccn | 0:6fd979edf153 | 2 | ELEC2645 Embedded Systems Project |
el16ccn | 0:6fd979edf153 | 3 | School of Electronic & Electrical Engineering |
el16ccn | 0:6fd979edf153 | 4 | University of Leeds |
el16ccn | 0:6fd979edf153 | 5 | Name:Chukwuebuka Nwibe |
el16ccn | 0:6fd979edf153 | 6 | Username:el16ccn |
el16ccn | 0:6fd979edf153 | 7 | Student ID Number:201035766 |
el16ccn | 0:6fd979edf153 | 8 | Date: |
el16ccn | 0:6fd979edf153 | 9 | */ |
el16ccn | 0:6fd979edf153 | 10 | #include "mbed.h" |
el16ccn | 0:6fd979edf153 | 11 | #include "Gamepad.h" |
el16ccn | 0:6fd979edf153 | 12 | #include "N5110.h" |
el16ccn | 7:cfd0854eee25 | 13 | #include "MazeEngine.h" |
el16ccn | 3:8562b22f22a8 | 14 | #include "Menu.h" |
el16ccn | 3:8562b22f22a8 | 15 | #include "Visuals.h" |
el16ccn | 0:6fd979edf153 | 16 | |
el16ccn | 8:be96fa6ee999 | 17 | |
el16ccn | 8:be96fa6ee999 | 18 | #define WITH_TESTING |
el16ccn | 8:be96fa6ee999 | 19 | #ifdef WITH_TESTING |
el16ccn | 8:be96fa6ee999 | 20 | # include "tests.h" |
el16ccn | 8:be96fa6ee999 | 21 | #endif |
el16ccn | 8:be96fa6ee999 | 22 | |
el16ccn | 8:be96fa6ee999 | 23 | |
el16ccn | 8:be96fa6ee999 | 24 | |
el16ccn | 8:be96fa6ee999 | 25 | |
el16ccn | 3:8562b22f22a8 | 26 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
el16ccn | 3:8562b22f22a8 | 27 | Visuals visual; |
el16ccn | 3:8562b22f22a8 | 28 | Gamepad pad; |
el16ccn | 3:8562b22f22a8 | 29 | Menu menu; |
el16ccn | 3:8562b22f22a8 | 30 | |
el16ccn | 3:8562b22f22a8 | 31 | void init(); |
el16ccn | 3:8562b22f22a8 | 32 | |
el16ccn | 3:8562b22f22a8 | 33 | int main() |
el16ccn | 3:8562b22f22a8 | 34 | { |
el16ccn | 8:be96fa6ee999 | 35 | #ifdef WITH_TESTING |
el16ccn | 8:be96fa6ee999 | 36 | int number_of_failures = run_all_tests(); |
el16ccn | 8:be96fa6ee999 | 37 | |
el16ccn | 8:be96fa6ee999 | 38 | if(number_of_failures > 0) return number_of_failures; |
el16ccn | 8:be96fa6ee999 | 39 | #endif |
el16ccn | 8:be96fa6ee999 | 40 | |
el16ccn | 3:8562b22f22a8 | 41 | init(); // initialise devices |
el16ccn | 7:cfd0854eee25 | 42 | printf("Device initialised \n"); |
el16ccn | 8:be96fa6ee999 | 43 | |
el16ccn | 8:be96fa6ee999 | 44 | |
el16ccn | 8:be96fa6ee999 | 45 | |
el16ccn | 3:8562b22f22a8 | 46 | menu.intro(lcd, pad, visual); |
el16ccn | 8:be96fa6ee999 | 47 | |
el16ccn | 3:8562b22f22a8 | 48 | while(1) { |
el16ccn | 8:be96fa6ee999 | 49 | |
el16ccn | 3:8562b22f22a8 | 50 | menu.main(lcd, pad, visual); |
el16ccn | 3:8562b22f22a8 | 51 | |
el16ccn | 0:6fd979edf153 | 52 | } |
el16ccn | 0:6fd979edf153 | 53 | } |
el16ccn | 0:6fd979edf153 | 54 | |
el16ccn | 3:8562b22f22a8 | 55 | |
el16ccn | 3:8562b22f22a8 | 56 | void init() |
el16ccn | 3:8562b22f22a8 | 57 | { |
el16ccn | 3:8562b22f22a8 | 58 | menu.init(); |
el16ccn | 3:8562b22f22a8 | 59 | lcd.init(); |
el16ccn | 3:8562b22f22a8 | 60 | pad.init(); |
el16ccn | 3:8562b22f22a8 | 61 | lcd.setContrast(0.5); |
el16ccn | 3:8562b22f22a8 | 62 | } |