el15mh 200929957

Dependencies:   mbed

Committer:
el15mh
Date:
Fri Apr 07 10:29:30 2017 +0000
Revision:
5:55eee1d71c1d
Parent:
4:66ab008f7b06
Child:
6:84572bbd9c5c
whole program basic with menu interface

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el15mh 0:d7701c5c20e6 1 #include "mbed.h"
el15mh 0:d7701c5c20e6 2 #include "N5110.h"
el15mh 0:d7701c5c20e6 3 #include "Gamepad.h"
el15mh 3:02653cb1c8f8 4 #include "Menu.h"
el15mh 4:66ab008f7b06 5 #include "Maze.h"
el15mh 4:66ab008f7b06 6 #include "Ball.h"
el15mh 5:55eee1d71c1d 7 #include "MazeEngine.h"
el15mh 0:d7701c5c20e6 8
el15mh 0:d7701c5c20e6 9 // CREATE OBJECTS //
el15mh 0:d7701c5c20e6 10 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
el15mh 5:55eee1d71c1d 11 MazeEngine engine;
el15mh 0:d7701c5c20e6 12 Gamepad pad;
el15mh 3:02653cb1c8f8 13 Menu menu;
el15mh 4:66ab008f7b06 14 Maze maze;
el15mh 4:66ab008f7b06 15 Ball ball;
el15mh 0:d7701c5c20e6 16
el15mh 5:55eee1d71c1d 17 // STRUCT FOR INPUT //
el15mh 5:55eee1d71c1d 18 struct input {
el15mh 5:55eee1d71c1d 19
el15mh 5:55eee1d71c1d 20 Direction direction;
el15mh 5:55eee1d71c1d 21 float magnitude;
el15mh 5:55eee1d71c1d 22 };
el15mh 5:55eee1d71c1d 23
el15mh 0:d7701c5c20e6 24 // FUNCTION PROTOTYPES //
el15mh 0:d7701c5c20e6 25 void init();
el15mh 0:d7701c5c20e6 26
el15mh 0:d7701c5c20e6 27 int main()
el15mh 0:d7701c5c20e6 28 {
el15mh 0:d7701c5c20e6 29 init(); // initialise devices
el15mh 5:55eee1d71c1d 30 printf("Devices initialised \n");
el15mh 0:d7701c5c20e6 31
el15mh 5:55eee1d71c1d 32 menu.intro(lcd, pad);
el15mh 2:a488caea1601 33
el15mh 2:a488caea1601 34 while(1) {
el15mh 0:d7701c5c20e6 35
el15mh 5:55eee1d71c1d 36 menu.main(lcd, pad);
el15mh 5:55eee1d71c1d 37
el15mh 5:55eee1d71c1d 38 printf("Start menu \n");
el15mh 1:8ce2586b5965 39
el15mh 4:66ab008f7b06 40 // menu.main(lcd, pad);
el15mh 4:66ab008f7b06 41 // maze.drawBox(lcd);
el15mh 4:66ab008f7b06 42 // lcd.drawCircle(15, 15, 3, FILL_BLACK);
el15mh 4:66ab008f7b06 43 // ball.draw(lcd, 20, 20, 10);
el15mh 0:d7701c5c20e6 44 }
el15mh 0:d7701c5c20e6 45 }
el15mh 0:d7701c5c20e6 46
el15mh 2:a488caea1601 47
el15mh 1:8ce2586b5965 48 void init()
el15mh 0:d7701c5c20e6 49 {
el15mh 1:8ce2586b5965 50 lcd.init();
el15mh 1:8ce2586b5965 51 pad.init();
el15mh 5:55eee1d71c1d 52 lcd.setBrightness(pad.read_pot());
el15mh 5:55eee1d71c1d 53 }