Menu system broken

Dependencies:   ANSITermMenuSystem

Fork of menuSystemMbed by Ryan Scott

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?

UserRevisionLine numberNew 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 3:bdf42b6c15f4 7 extern BusInOut switches; //(p21, p22, p23, p24)
Rybowonder 3:bdf42b6c15f4 8 extern MainMenu pageMenu[MAXPAGES ];
Rybowonder 7:df9f5b6dd4ed 9 extern volatile bool exittorecord;
Rybowonder 3:bdf42b6c15f4 10
Rybowonder 3:bdf42b6c15f4 11
Rybowonder 3:bdf42b6c15f4 12 int AGCPageHandler()
Rybowonder 3:bdf42b6c15f4 13 {
Rybowonder 3:bdf42b6c15f4 14 int userSelection = 0;
Rybowonder 3:bdf42b6c15f4 15 pageMenu[AGC].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[AGC].erase();
Rybowonder 3:bdf42b6c15f4 32 printXY(" ", 5, 10);
Rybowonder 3:bdf42b6c15f4 33 userSelection = RECORDSET;
Rybowonder 3:bdf42b6c15f4 34 exitCurrentMenu = true;
Rybowonder 3:bdf42b6c15f4 35 break;
Rybowonder 3:bdf42b6c15f4 36 case 0x0d:
Rybowonder 3:bdf42b6c15f4 37 pageMenu[AGC].highlightPrevItem();
Rybowonder 3:bdf42b6c15f4 38 break;
Rybowonder 3:bdf42b6c15f4 39 case 0x0b:
Rybowonder 3:bdf42b6c15f4 40 pageMenu[AGC].highlightNextItem();
Rybowonder 3:bdf42b6c15f4 41 break;
Rybowonder 3:bdf42b6c15f4 42 case 0x07:
Rybowonder 3:bdf42b6c15f4 43 userSelection = pageMenu[AGC].getHighlightedItem() ;
Rybowonder 4:1178a1905490 44 pageMenu[AGC].removeselection();
Rybowonder 4:1178a1905490 45 pageMenu[AGC].selection();
Rybowonder 3:bdf42b6c15f4 46 break;
Rybowonder 3:bdf42b6c15f4 47 }//eo select
Rybowonder 4:1178a1905490 48 /*
Rybowonder 3:bdf42b6c15f4 49 if (userSelection != 0 && userSelection != RECORDSET)
Rybowonder 3:bdf42b6c15f4 50 {
Rybowonder 3:bdf42b6c15f4 51 // place code here to handle actions processed directly from this page
Rybowonder 3:bdf42b6c15f4 52 switch(userSelection)
Rybowonder 3:bdf42b6c15f4 53 {
Rybowonder 3:bdf42b6c15f4 54 case AGCON:
Rybowonder 4:1178a1905490 55 printXY(" ", 5,2);
Rybowonder 4:1178a1905490 56 printXY("<", 4, 1);
Rybowonder 3:bdf42b6c15f4 57 //call function to perform task
Rybowonder 3:bdf42b6c15f4 58 break;
Rybowonder 3:bdf42b6c15f4 59 case AGCOFF:
Rybowonder 4:1178a1905490 60 printXY(" ", 4, 1);
Rybowonder 4:1178a1905490 61 printXY("<",5, 2);
Rybowonder 3:bdf42b6c15f4 62 //call function to perform task
Rybowonder 3:bdf42b6c15f4 63 break;
Rybowonder 3:bdf42b6c15f4 64 }
Rybowonder 3:bdf42b6c15f4 65 // eo place code here ......
Rybowonder 3:bdf42b6c15f4 66 userSelection = 0;
Rybowonder 3:bdf42b6c15f4 67 }
Rybowonder 4:1178a1905490 68 */
Rybowonder 3:bdf42b6c15f4 69 wait_ms(200);
Rybowonder 7:df9f5b6dd4ed 70 if (exittorecord == true)
Rybowonder 7:df9f5b6dd4ed 71 break;
Rybowonder 7:df9f5b6dd4ed 72
Rybowonder 7:df9f5b6dd4ed 73
Rybowonder 3:bdf42b6c15f4 74 }//eo if kbhit
Rybowonder 3:bdf42b6c15f4 75 }//eo while
Rybowonder 3:bdf42b6c15f4 76 return userSelection;
Rybowonder 3:bdf42b6c15f4 77 }