Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HANDLER_OutputPage.cpp
- Committer:
- mbedDevLondon
- Date:
- 2013-02-28
- Revision:
- 0:a5ece7312edc
File content as of revision 0:a5ece7312edc:
#include "mbed.h"
#include "menuIDs.h"
#include "MainMenu.h"
#include "console.h"
extern BusInOut switches; //(p21, p22, p23, p24)
extern MainMenu pageMenu[12];
int OutputPageHandler()
{
int userSelection = 0;
pageMenu[OUTPUT].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[OUTPUT].erase();
printXY(" ", 5, 10);
userSelection = RECORDSET;
exitCurrentMenu = true;
break;
case 0x0d:
pageMenu[OUTPUT].highlightPrevItem();
break;
case 0x0b:
pageMenu[OUTPUT].highlightNextItem();
break;
case 0x07:
userSelection = pageMenu[OUTPUT].getHighlightedItem() ;
break;
}//eo select
if (userSelection != 0 && userSelection != RECORDSET)
{
// place code here to handle actions processed directly from this page
switch(userSelection)
{
case LINE:
printXY("Line selected ", 5, 10);
//call function to perform task
break;
case HEADPHONES:
printXY("Headphones selected ",5,10);
//call function to perform task
break;
case SPEAKERS:
printXY("Speakers selected ", 5, 10);
//call function to perform task
break;
}
// eo place code here ......
userSelection = 0;
}
wait_ms(200);
}//eo if kbhit
}//eo while
return userSelection;
}