Menu system broken

Dependencies:   ANSITermMenuSystem

Fork of menuSystemMbed by Ryan Scott

Revision:
3:bdf42b6c15f4
Child:
7:df9f5b6dd4ed
diff -r a3b65af969d4 -r bdf42b6c15f4 HANDLER_PlayscreenPage.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HANDLER_PlayscreenPage.cpp	Fri Mar 08 17:37:11 2013 +0000
@@ -0,0 +1,69 @@
+#include "mbed.h"
+
+#include "menuIDs.h"
+#include "MainMenu.h"
+#include "console.h"
+
+extern BusInOut switches; //(p21, p22, p23, p24)
+extern MainMenu pageMenu[MAXPAGES];
+
+
+int PlayscreenPageHandler()
+{
+     int userSelection = 0;
+     pageMenu[PLAYSCR].printMenu();
+
+     unsigned char lastState = 0x0f;  //0000 1111
+     bool exitCurrentMenu = false;
+
+     while ( exitCurrentMenu == false)
+        {
+        
+        unsigned char currentState = switches.read();  //reading a port add a AND MASK & 0b00000111
+        wait_ms(10);
+        if( currentState == switches.read() && currentState != lastState)
+            {
+            lastState = currentState; 
+            switch(currentState)
+                {
+                case 0x0e:
+                    pageMenu[PLAYSCR].erase();
+                    printXY("                       ", 5, 10);    //erases the ACTION prompt
+                    userSelection = PLAY;
+                    exitCurrentMenu = true;
+                    break;
+                case 0x0d:
+                     pageMenu[PLAYSCR].highlightPrevItem();
+                    break;
+                case 0x0b:
+                     pageMenu[PLAYSCR].highlightNextItem();
+                    break;
+                case 0x07:
+                    userSelection = pageMenu[PLAYSCR].getHighlightedItem() ;
+                    break;
+                }//eo select
+
+                // is the user selection an ACTION  assigned to this page
+                if (userSelection != 0 && userSelection > PLAYSCROFFSET)  //page selections are 0 through 12
+                    {
+                    // place code here to handle actions processed directly from this page
+                    
+                    // TODO ask Brad about this section ******************---------------------*************
+                    switch(userSelection)
+                        {
+                    
+                        case EX_PLAYTRACK :
+                            printXY("Example Track selected          ", 5, 10); //***********---------------***************------------********** Discuss with Brad
+                            //call function to perform task
+                            break;
+                  
+                        }
+                    
+                    // eo place code here ......
+                    userSelection = 0;
+                    }
+                wait_ms(200);
+            }//eo if kbhit
+        }//eo while
+        return userSelection;
+}
\ No newline at end of file