Menu system broken
Dependencies: ANSITermMenuSystem
Fork of menuSystemMbed by
HANDLER_OutputPage.cpp@8:6ddb8c26387a, 2013-05-04 (annotated)
- Committer:
- Rybowonder
- Date:
- Sat May 04 17:37:57 2013 +0000
- Revision:
- 8:6ddb8c26387a
- Parent:
- 7:df9f5b6dd4ed
For Mitchener
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 | #include "console.h" |
mbedDevLondon | 0:a5ece7312edc | 6 | |
mbedDevLondon | 0:a5ece7312edc | 7 | extern BusInOut switches; //(p21, p22, p23, p24) |
Rybowonder | 7:df9f5b6dd4ed | 8 | extern MainMenu pageMenu[MAXPAGES]; |
Rybowonder | 7:df9f5b6dd4ed | 9 | extern volatile bool exittorecord; |
mbedDevLondon | 0:a5ece7312edc | 10 | |
mbedDevLondon | 0:a5ece7312edc | 11 | |
mbedDevLondon | 0:a5ece7312edc | 12 | int OutputPageHandler() |
mbedDevLondon | 0:a5ece7312edc | 13 | { |
mbedDevLondon | 0:a5ece7312edc | 14 | int userSelection = 0; |
mbedDevLondon | 0:a5ece7312edc | 15 | pageMenu[OUTPUT].printMenu(); |
mbedDevLondon | 0:a5ece7312edc | 16 | |
mbedDevLondon | 0:a5ece7312edc | 17 | unsigned char lastState = 0x0f; //0000 1111 |
mbedDevLondon | 0:a5ece7312edc | 18 | bool exitCurrentMenu = false; |
mbedDevLondon | 0:a5ece7312edc | 19 | |
mbedDevLondon | 0:a5ece7312edc | 20 | while ( exitCurrentMenu == false) |
mbedDevLondon | 0:a5ece7312edc | 21 | { |
mbedDevLondon | 0:a5ece7312edc | 22 | |
mbedDevLondon | 0:a5ece7312edc | 23 | unsigned char currentState = switches.read(); //reading a port add a AND MASK & 0b00000111 |
mbedDevLondon | 0:a5ece7312edc | 24 | wait_ms(10); |
mbedDevLondon | 0:a5ece7312edc | 25 | if( currentState == switches.read() && currentState != lastState) |
mbedDevLondon | 0:a5ece7312edc | 26 | { |
mbedDevLondon | 0:a5ece7312edc | 27 | lastState = currentState; |
mbedDevLondon | 0:a5ece7312edc | 28 | switch(currentState) |
mbedDevLondon | 0:a5ece7312edc | 29 | { |
mbedDevLondon | 0:a5ece7312edc | 30 | case 0x0e: |
mbedDevLondon | 0:a5ece7312edc | 31 | pageMenu[OUTPUT].erase(); |
mbedDevLondon | 0:a5ece7312edc | 32 | printXY(" ", 5, 10); |
mbedDevLondon | 0:a5ece7312edc | 33 | userSelection = RECORDSET; |
mbedDevLondon | 0:a5ece7312edc | 34 | exitCurrentMenu = true; |
mbedDevLondon | 0:a5ece7312edc | 35 | break; |
mbedDevLondon | 0:a5ece7312edc | 36 | case 0x0d: |
mbedDevLondon | 0:a5ece7312edc | 37 | pageMenu[OUTPUT].highlightPrevItem(); |
mbedDevLondon | 0:a5ece7312edc | 38 | break; |
mbedDevLondon | 0:a5ece7312edc | 39 | case 0x0b: |
mbedDevLondon | 0:a5ece7312edc | 40 | pageMenu[OUTPUT].highlightNextItem(); |
mbedDevLondon | 0:a5ece7312edc | 41 | break; |
mbedDevLondon | 0:a5ece7312edc | 42 | case 0x07: |
mbedDevLondon | 0:a5ece7312edc | 43 | userSelection = pageMenu[OUTPUT].getHighlightedItem() ; |
Rybowonder | 4:1178a1905490 | 44 | pageMenu[OUTPUT].removeselection(); |
Rybowonder | 7:df9f5b6dd4ed | 45 | pageMenu[OUTPUT].selection(); |
mbedDevLondon | 0:a5ece7312edc | 46 | break; |
mbedDevLondon | 0:a5ece7312edc | 47 | }//eo select |
mbedDevLondon | 0:a5ece7312edc | 48 | |
Rybowonder | 4:1178a1905490 | 49 | /* |
mbedDevLondon | 0:a5ece7312edc | 50 | if (userSelection != 0 && userSelection != RECORDSET) |
mbedDevLondon | 0:a5ece7312edc | 51 | { |
mbedDevLondon | 0:a5ece7312edc | 52 | // place code here to handle actions processed directly from this page |
mbedDevLondon | 0:a5ece7312edc | 53 | switch(userSelection) |
mbedDevLondon | 0:a5ece7312edc | 54 | { |
mbedDevLondon | 0:a5ece7312edc | 55 | case LINE: |
mbedDevLondon | 0:a5ece7312edc | 56 | printXY("Line selected ", 5, 10); |
mbedDevLondon | 0:a5ece7312edc | 57 | //call function to perform task |
mbedDevLondon | 0:a5ece7312edc | 58 | break; |
mbedDevLondon | 0:a5ece7312edc | 59 | case HEADPHONES: |
mbedDevLondon | 0:a5ece7312edc | 60 | printXY("Headphones selected ",5,10); |
mbedDevLondon | 0:a5ece7312edc | 61 | //call function to perform task |
mbedDevLondon | 0:a5ece7312edc | 62 | break; |
mbedDevLondon | 0:a5ece7312edc | 63 | case SPEAKERS: |
mbedDevLondon | 0:a5ece7312edc | 64 | printXY("Speakers selected ", 5, 10); |
mbedDevLondon | 0:a5ece7312edc | 65 | //call function to perform task |
mbedDevLondon | 0:a5ece7312edc | 66 | break; |
mbedDevLondon | 0:a5ece7312edc | 67 | } |
mbedDevLondon | 0:a5ece7312edc | 68 | // eo place code here ...... |
mbedDevLondon | 0:a5ece7312edc | 69 | userSelection = 0; |
mbedDevLondon | 0:a5ece7312edc | 70 | } |
Rybowonder | 4:1178a1905490 | 71 | */ |
mbedDevLondon | 0:a5ece7312edc | 72 | wait_ms(200); |
Rybowonder | 7:df9f5b6dd4ed | 73 | if (exittorecord == true) |
Rybowonder | 7:df9f5b6dd4ed | 74 | break; |
Rybowonder | 7:df9f5b6dd4ed | 75 | |
mbedDevLondon | 0:a5ece7312edc | 76 | }//eo if kbhit |
mbedDevLondon | 0:a5ece7312edc | 77 | }//eo while |
mbedDevLondon | 0:a5ece7312edc | 78 | return userSelection; |
mbedDevLondon | 0:a5ece7312edc | 79 | } |