Menu system broken
Dependencies: ANSITermMenuSystem
Fork of menuSystemMbed by
Diff: HANDLER_RecordscreenPage.cpp
- Revision:
- 7:df9f5b6dd4ed
- Parent:
- 3:bdf42b6c15f4
--- a/HANDLER_RecordscreenPage.cpp Sun Apr 21 20:46:28 2013 +0000 +++ b/HANDLER_RecordscreenPage.cpp Fri Apr 26 16:17:18 2013 +0000 @@ -6,19 +6,45 @@ extern BusInOut switches; //(p21, p22, p23, p24) extern MainMenu pageMenu[MAXPAGES ]; +extern volatile bool exittorecord; +Timer t; +Ticker printtime; +void displaytime(void) +{ + char tickertime[50]; + sprintf(tickertime, "Song Length:%4.2f", t.read()); + printXY(tickertime, 2, 2); +} + int RecordscreenPageHandler() { + bool recordflag = true; + + char timebuf[50]; + + + clrscr(); int userSelection = 0; - pageMenu[RECORDSCR].printMenu(); - unsigned char lastState = 0x0f; //0000 1111 bool exitCurrentMenu = false; - + + printtime.attach(&displaytime, 1); + + t.start(); + + while ( exitCurrentMenu == false) - { - + { + + if (exittorecord == true && recordflag == true) + { + printXY("Recording", 5, 2); + // printXY("To Stop", 2, 5); + // printXY("Recording", 2, 6); + recordflag = false; + } unsigned char currentState = switches.read(); //reading a port add a AND MASK & 0b00000111 wait_ms(10); if( currentState == switches.read() && currentState != lastState) @@ -27,42 +53,30 @@ switch(currentState) { case 0x0e: + if (exittorecord == false) + { pageMenu[RECORDSCR].erase(); printXY(" ", 5, 10); //erases the ACTION prompt userSelection = HOME; - exitCurrentMenu = true; - break; - case 0x0d: - pageMenu[RECORDSCR].highlightPrevItem(); - break; - case 0x0b: - pageMenu[RECORDSCR].highlightNextItem(); - break; + exitCurrentMenu = true; + } + break; case 0x07: - userSelection = pageMenu[RECORDSCR].getHighlightedItem() ; - break; - }//eo select - - // is the user selection an ACTION assigned to this page - if (userSelection != 0 && userSelection > RECORDSCROFFSET) //page selections are 0 through 12 + if (exittorecord == true) { - // 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; + clrscr(); + t.stop(); + printtime.detach(); + sprintf(timebuf, "Total Length:%4.2f", t.read()); + printXY(timebuf, 2, 2); + t.reset(); + exittorecord = false; } + break; + } wait_ms(200); + + }//eo if kbhit }//eo while return userSelection;