Ryan Scott / menuSystemMbedBroken

Dependencies:   ANSITermMenuSystem

Fork of menuSystemMbed by Ryan Scott

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HANDLER_DeletetrackPage.cpp Source File

HANDLER_DeletetrackPage.cpp

00001 #include "mbed.h"
00002 
00003 #include "menuIDs.h"
00004 #include "MainMenu.h"
00005 #include "console.h"
00006 
00007 //extern Serial pc(USBTX, USBRX);
00008 extern BusInOut switches; //(p21, p22, p23, p24)
00009 extern MainMenu pageMenu[MAXPAGES ];
00010 extern volatile bool exittorecord;
00011 
00012 int DeletetrackPageHandler()
00013 {
00014      int userSelection = 0;
00015      pageMenu[DELETESCR].printMenu();
00016 
00017      unsigned char lastState = 0x0f;  //0000 1111
00018      bool exitCurrentMenu = false;
00019 
00020      while ( exitCurrentMenu == false)
00021         {
00022         
00023         unsigned char currentState = switches.read();  //reading a port add a AND MASK & 0b00000111
00024         wait_ms(10);
00025         if( currentState == switches.read() && currentState != lastState)
00026             {
00027             lastState = currentState; 
00028             switch(currentState)
00029                 {
00030                 case 0x0e:
00031                     pageMenu[DELETESCR].erase();
00032                     printXY("                       ", 5, 10);    //erases the ACTION prompt
00033                     userSelection = PLAYBACK;
00034                     exitCurrentMenu = true;
00035                     break;
00036                 case 0x0d:
00037                      pageMenu[DELETESCR].highlightPrevItem();
00038                     break;
00039                 case 0x0b:
00040                      pageMenu[DELETESCR].highlightNextItem();
00041                     break;
00042                 case 0x07:
00043                     userSelection = pageMenu[DELETESCR].getHighlightedItem() ;
00044                     break;
00045                 }//eo select
00046 /*
00047                 // is the user selection an ACTION  assigned to this page
00048                 if (userSelection != 0 && userSelection > DELETETRACKOFFSET )  //page selections are 0 through 12
00049                     {
00050                     // place code here to handle actions processed directly from this page
00051                     switch(userSelection)
00052                         {
00053                     
00054                         case D_TRACKFILE:
00055                             printXY("Example Track selected          ", 5, 10); // Discuss with Brad ************---------------**************---------*************
00056                             //call function to perform task
00057                             break;
00058                         }
00059                     
00060                     // eo place code here ......
00061                     userSelection = 0;
00062                     }
00063 */
00064                 wait_ms(200);
00065                 if (exittorecord == true)
00066                     break;
00067                     
00068             }//eo if kbhit
00069         }//eo while
00070         return userSelection;
00071 }