Dependents: SnakeProjectRev1 SnakeProjectRev1
Revision 1:b5f4e9c759a9, committed 2016-05-04
- Comitter:
- meurigp
- Date:
- Wed May 04 15:16:03 2016 +0000
- Parent:
- 0:d74f3a7ca036
- Commit message:
- fsm working, need to initialise game accordingly
Changed in this revision
fsmMenu.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r d74f3a7ca036 -r b5f4e9c759a9 fsmMenu.h --- a/fsmMenu.h Wed May 04 12:33:44 2016 +0000 +++ b/fsmMenu.h Wed May 04 15:16:03 2016 +0000 @@ -2,8 +2,7 @@ #define FSMMENU_H #include "mbed.h" -#include "Joystick.h" -#include "beep.h" + // defines directions as 0/1. Note UPPERCASE #define menuSTOP 0 @@ -14,38 +13,8 @@ int state = 0; int menuDirection = menuSTOP; -lcd.printString("Classic",0,1); -lcd.printString("Infinite",0,3); -lcd.printString("Hard Map",0,5); - // function prototypes -void readJoyMenu(); void menuFSM(); -void displayMenu(); - -void readJoyMenu() { - -// check if flag i.e. interrupt has occured - if (printFlag ==1) { - printFlag = 0; // if it has, clear the flag - - // swap direction when button has been pressed - // (could just use ! but want this to be explicit to aid understanding) - if (joystick.direction == CENTRE) { - serial.printf(" CENTRE\n"); - menuDirection = menuSTOP; - } - else if (joystick.direction == UP) { - serial.printf(" UP\n"); - menuDirection = menuUP; - } - else if (joystick.direction == DOWN) { - serial.printf(" DOWN\n"); - menuDirection = menuDOWN; - } - } - -} void menuFSM() { @@ -98,25 +67,6 @@ } -displayMenu() { - - wait(0.2); // small delay - if (state ==0) { - lcd.clear(); - lcd.printString("*",70,1); - buzzer.beep(2000,0.2); - } - else if (state ==1) { - lcd.clear(); - lcd.printString("*",70,3); - buzzer.beep(2000,0.2); - } - else if (state ==2) { - lcd.clear(); - lcd.printString("*",70,5); - buzzer.beep(2000,0.2); - } - -} + #endif \ No newline at end of file