Menu system broken
Dependencies: ANSITermMenuSystem
Fork of menuSystemMbed by
HANDLER_DeletetrackPage.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 |
---|---|---|---|
Rybowonder | 3:bdf42b6c15f4 | 1 | #include "mbed.h" |
Rybowonder | 3:bdf42b6c15f4 | 2 | |
Rybowonder | 3:bdf42b6c15f4 | 3 | #include "menuIDs.h" |
Rybowonder | 3:bdf42b6c15f4 | 4 | #include "MainMenu.h" |
Rybowonder | 3:bdf42b6c15f4 | 5 | #include "console.h" |
Rybowonder | 3:bdf42b6c15f4 | 6 | |
Rybowonder | 8:6ddb8c26387a | 7 | //extern Serial pc(USBTX, USBRX); |
Rybowonder | 3:bdf42b6c15f4 | 8 | extern BusInOut switches; //(p21, p22, p23, p24) |
Rybowonder | 3:bdf42b6c15f4 | 9 | extern MainMenu pageMenu[MAXPAGES ]; |
Rybowonder | 7:df9f5b6dd4ed | 10 | extern volatile bool exittorecord; |
Rybowonder | 3:bdf42b6c15f4 | 11 | |
Rybowonder | 3:bdf42b6c15f4 | 12 | int DeletetrackPageHandler() |
Rybowonder | 3:bdf42b6c15f4 | 13 | { |
Rybowonder | 3:bdf42b6c15f4 | 14 | int userSelection = 0; |
Rybowonder | 3:bdf42b6c15f4 | 15 | pageMenu[DELETESCR].printMenu(); |
Rybowonder | 3:bdf42b6c15f4 | 16 | |
Rybowonder | 3:bdf42b6c15f4 | 17 | unsigned char lastState = 0x0f; //0000 1111 |
Rybowonder | 3:bdf42b6c15f4 | 18 | bool exitCurrentMenu = false; |
Rybowonder | 3:bdf42b6c15f4 | 19 | |
Rybowonder | 3:bdf42b6c15f4 | 20 | while ( exitCurrentMenu == false) |
Rybowonder | 3:bdf42b6c15f4 | 21 | { |
Rybowonder | 3:bdf42b6c15f4 | 22 | |
Rybowonder | 3:bdf42b6c15f4 | 23 | unsigned char currentState = switches.read(); //reading a port add a AND MASK & 0b00000111 |
Rybowonder | 3:bdf42b6c15f4 | 24 | wait_ms(10); |
Rybowonder | 3:bdf42b6c15f4 | 25 | if( currentState == switches.read() && currentState != lastState) |
Rybowonder | 3:bdf42b6c15f4 | 26 | { |
Rybowonder | 3:bdf42b6c15f4 | 27 | lastState = currentState; |
Rybowonder | 3:bdf42b6c15f4 | 28 | switch(currentState) |
Rybowonder | 3:bdf42b6c15f4 | 29 | { |
Rybowonder | 3:bdf42b6c15f4 | 30 | case 0x0e: |
Rybowonder | 3:bdf42b6c15f4 | 31 | pageMenu[DELETESCR].erase(); |
Rybowonder | 3:bdf42b6c15f4 | 32 | printXY(" ", 5, 10); //erases the ACTION prompt |
Rybowonder | 3:bdf42b6c15f4 | 33 | userSelection = PLAYBACK; |
Rybowonder | 3:bdf42b6c15f4 | 34 | exitCurrentMenu = true; |
Rybowonder | 3:bdf42b6c15f4 | 35 | break; |
Rybowonder | 3:bdf42b6c15f4 | 36 | case 0x0d: |
Rybowonder | 3:bdf42b6c15f4 | 37 | pageMenu[DELETESCR].highlightPrevItem(); |
Rybowonder | 3:bdf42b6c15f4 | 38 | break; |
Rybowonder | 3:bdf42b6c15f4 | 39 | case 0x0b: |
Rybowonder | 3:bdf42b6c15f4 | 40 | pageMenu[DELETESCR].highlightNextItem(); |
Rybowonder | 3:bdf42b6c15f4 | 41 | break; |
Rybowonder | 3:bdf42b6c15f4 | 42 | case 0x07: |
Rybowonder | 3:bdf42b6c15f4 | 43 | userSelection = pageMenu[DELETESCR].getHighlightedItem() ; |
Rybowonder | 3:bdf42b6c15f4 | 44 | break; |
Rybowonder | 3:bdf42b6c15f4 | 45 | }//eo select |
Rybowonder | 8:6ddb8c26387a | 46 | /* |
Rybowonder | 3:bdf42b6c15f4 | 47 | // is the user selection an ACTION assigned to this page |
Rybowonder | 3:bdf42b6c15f4 | 48 | if (userSelection != 0 && userSelection > DELETETRACKOFFSET ) //page selections are 0 through 12 |
Rybowonder | 3:bdf42b6c15f4 | 49 | { |
Rybowonder | 3:bdf42b6c15f4 | 50 | // place code here to handle actions processed directly from this page |
Rybowonder | 3:bdf42b6c15f4 | 51 | switch(userSelection) |
Rybowonder | 3:bdf42b6c15f4 | 52 | { |
Rybowonder | 3:bdf42b6c15f4 | 53 | |
Rybowonder | 8:6ddb8c26387a | 54 | case D_TRACKFILE: |
Rybowonder | 3:bdf42b6c15f4 | 55 | printXY("Example Track selected ", 5, 10); // Discuss with Brad ************---------------**************---------************* |
Rybowonder | 3:bdf42b6c15f4 | 56 | //call function to perform task |
Rybowonder | 3:bdf42b6c15f4 | 57 | break; |
Rybowonder | 3:bdf42b6c15f4 | 58 | } |
Rybowonder | 3:bdf42b6c15f4 | 59 | |
Rybowonder | 3:bdf42b6c15f4 | 60 | // eo place code here ...... |
Rybowonder | 3:bdf42b6c15f4 | 61 | userSelection = 0; |
Rybowonder | 3:bdf42b6c15f4 | 62 | } |
Rybowonder | 8:6ddb8c26387a | 63 | */ |
Rybowonder | 3:bdf42b6c15f4 | 64 | wait_ms(200); |
Rybowonder | 7:df9f5b6dd4ed | 65 | if (exittorecord == true) |
Rybowonder | 7:df9f5b6dd4ed | 66 | break; |
Rybowonder | 7:df9f5b6dd4ed | 67 | |
Rybowonder | 3:bdf42b6c15f4 | 68 | }//eo if kbhit |
Rybowonder | 3:bdf42b6c15f4 | 69 | }//eo while |
Rybowonder | 3:bdf42b6c15f4 | 70 | return userSelection; |
Rybowonder | 3:bdf42b6c15f4 | 71 | } |