Menu system broken
Dependencies: ANSITermMenuSystem
Fork of menuSystemMbed by
HANDLER_HomePage.cpp@7:df9f5b6dd4ed, 2013-04-26 (annotated)
- Committer:
- Rybowonder
- Date:
- Fri Apr 26 16:17:18 2013 +0000
- Revision:
- 7:df9f5b6dd4ed
- Parent:
- 4:1178a1905490
April 26th Need To handle Saved Tracks
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedDevLondon | 0:a5ece7312edc | 1 | #include "mbed.h" |
mbedDevLondon | 0:a5ece7312edc | 2 | |
mbedDevLondon | 0:a5ece7312edc | 3 | #include "menuIDs.h" |
mbedDevLondon | 0:a5ece7312edc | 4 | #include "MainMenu.h" |
mbedDevLondon | 0:a5ece7312edc | 5 | |
mbedDevLondon | 0:a5ece7312edc | 6 | |
mbedDevLondon | 0:a5ece7312edc | 7 | extern BusInOut switches; //(p21, p22, p23, p24) |
Rybowonder | 4:1178a1905490 | 8 | extern MainMenu pageMenu[MAXPAGES]; |
Rybowonder | 7:df9f5b6dd4ed | 9 | extern volatile bool exittorecord; |
mbedDevLondon | 0:a5ece7312edc | 10 | |
mbedDevLondon | 0:a5ece7312edc | 11 | int homePageHandler() |
mbedDevLondon | 0:a5ece7312edc | 12 | { |
mbedDevLondon | 0:a5ece7312edc | 13 | int userSelection = 0; |
mbedDevLondon | 0:a5ece7312edc | 14 | pageMenu[HOME].printMenu(); |
mbedDevLondon | 0:a5ece7312edc | 15 | |
mbedDevLondon | 0:a5ece7312edc | 16 | unsigned char lastState = 0x0f; //0000 1111 |
mbedDevLondon | 0:a5ece7312edc | 17 | bool exitCurrentMenu = false; |
mbedDevLondon | 0:a5ece7312edc | 18 | |
mbedDevLondon | 0:a5ece7312edc | 19 | while ( exitCurrentMenu == false) |
mbedDevLondon | 0:a5ece7312edc | 20 | { |
mbedDevLondon | 0:a5ece7312edc | 21 | |
mbedDevLondon | 0:a5ece7312edc | 22 | unsigned char currentState = switches.read(); //reading a port add a AND MASK & 0b00000111 |
mbedDevLondon | 0:a5ece7312edc | 23 | wait_ms(10); |
mbedDevLondon | 0:a5ece7312edc | 24 | if( currentState == switches.read() && currentState != lastState) |
mbedDevLondon | 0:a5ece7312edc | 25 | { |
mbedDevLondon | 0:a5ece7312edc | 26 | lastState = currentState; |
mbedDevLondon | 0:a5ece7312edc | 27 | switch(currentState) |
mbedDevLondon | 0:a5ece7312edc | 28 | { |
mbedDevLondon | 0:a5ece7312edc | 29 | case 0x0e: |
mbedDevLondon | 0:a5ece7312edc | 30 | pageMenu[HOME].erase(); |
mbedDevLondon | 0:a5ece7312edc | 31 | userSelection = HOME; |
mbedDevLondon | 0:a5ece7312edc | 32 | exitCurrentMenu = true; |
mbedDevLondon | 0:a5ece7312edc | 33 | break; |
mbedDevLondon | 0:a5ece7312edc | 34 | case 0x0d: |
mbedDevLondon | 0:a5ece7312edc | 35 | pageMenu[HOME].highlightPrevItem(); |
mbedDevLondon | 0:a5ece7312edc | 36 | break; |
mbedDevLondon | 0:a5ece7312edc | 37 | case 0x0b: |
mbedDevLondon | 0:a5ece7312edc | 38 | pageMenu[HOME].highlightNextItem(); |
mbedDevLondon | 0:a5ece7312edc | 39 | break; |
mbedDevLondon | 0:a5ece7312edc | 40 | case 0x07: |
mbedDevLondon | 0:a5ece7312edc | 41 | pageMenu[HOME].erase(); |
mbedDevLondon | 0:a5ece7312edc | 42 | userSelection = pageMenu[HOME].getHighlightedItem(); |
mbedDevLondon | 0:a5ece7312edc | 43 | exitCurrentMenu = true; |
mbedDevLondon | 0:a5ece7312edc | 44 | break; |
mbedDevLondon | 0:a5ece7312edc | 45 | }//eo select |
mbedDevLondon | 0:a5ece7312edc | 46 | wait_ms(200); |
Rybowonder | 7:df9f5b6dd4ed | 47 | if (exittorecord == true) |
Rybowonder | 7:df9f5b6dd4ed | 48 | break; |
Rybowonder | 7:df9f5b6dd4ed | 49 | |
mbedDevLondon | 0:a5ece7312edc | 50 | }//eo if switch press detected |
mbedDevLondon | 0:a5ece7312edc | 51 | }//eo while |
mbedDevLondon | 0:a5ece7312edc | 52 | return userSelection; |
mbedDevLondon | 0:a5ece7312edc | 53 | } |