Hello all, I have to implement a MENU screen including a few sub menu's on a 230x240 pixel LCD display. Selecting sub-menu's is done through digital inputs(buttons). I can poll these inputs or generate an interrupt to detect an active input. I can write everything on the display I want to. So I can build the individial menu screens. My problem is how do I implement a software structure to write the mainmenu and sub-menu's to the screen. Does someone have an idea or an example? Thanks, Jan
"I find the software look very messy." This is largely a matter of style - and that is under your control! If your style looks messy, try to refine it, or change it.
"If your style looks messy, try to refine it, or change it." Control can sometimes be embodied in data. ------------------------------------------------------------ Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowcharts; they'll be obvious. Frederick P. Brooks, Jr., The Mythical Man Month
"Control can sometimes be embodied in data." Very true. One way to do it is tables of function pointers. I know this is problematic on C51, but I guess it should be OK on an ARM? If you don't like or can't use function pointers, you can simply use an ID in a switch to do direct calls; eg,
switch( menu_option ) { case OPTION_1: sub_menu_1(); break; case OPTION_2: sub_menu_2(); break; case OPTION_3: action_3(); break; case OPTION_4: action_4(); break; default: show_help(); break; }