This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to implement LCD menu structure

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

Parents
  • "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;
    }

Reply
  • "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;
    }

Children
No data