This project provides a complete GUI system for systems with limited resources.Image of a 128x64 LCD

Sourceforge start page


Get MenuDesigner at Fast, secure and Free Open Source software downloads


The project consists of two parts. The MenuInterpreter and the MenuEditor. The MenuEditor is a graphical editor, written in Pascal/Lazarus (tested with Linux and Windows), where you can build your menu system. The MenuEditor then will compile the menu into a compact bytecode. The MenuInterpreter, written in platform independent C, draws screens according to the bytecode. The MenuInterpreter is optimized to use very small resources.
For example, the MenuInterpreter can run on a small 8 bit microcontroller like an AVR ATmega32 (32KB flash, 2KB RAM) with a 128x64 black/white LCD and some keys connected. An example menu which uses ASCII characters as display and runs on an ATmega8 (8KB flash, 1KB RAM) is provided.



What is needed to use the code

Generally the code should work on any platform, supported by gcc or a similar C compiler.Diagram showing the functions of the interpreter
Normally you have to implemented five functions for yourself:

Implement unsigned char menu_byte_get(MENUADDR addr)
The access to the binary menu structure. Like RAM, Flash or EEPROM read. Its best to make sure 'addr' is below the MENU_DATASIZE definition.

Implement void menu_screen_set(SCREENPOS x, SCREENPOS y, unsigned char color)
This function gets called while the screen is redrawn. Please note that x and y can be outside of the defined screen size. You must catch this in order to prevent memory corruption.
Depending on your selected screen resolution, SCREENPOS is a 8 or 16 bit unsigned integer.

Implement void menu_screen_flush(void)
This function gets called once, when redrawing has completed. Use this to draw the values set by the function above to the screen.

Implement void menu_screen_clear(void)
Gets called on every screen switch. Simply provided, because there are often faster methods for clearing a screen than drawing every single pixel.

Implement unsigned char menu_action(unsigned short action)
This function gets called so you can react on the user inputs of the screen, return 1 if you want a redraw, 0 if not. If a screen change occurs, a redraw is made anyway.

Call void menu_keypress(unsigned char key)
You should call this  function in order to initiate screen changes or let the menu react on other key inputs.

Call void menu_redraw(void)
If you have dynamic data (text, graphics) on the screen you should call void menu_redraw(void) in order
to init a redraw.

(Since version 1.4) If compiled with mouse/touch support,
call, void menu_mouse(SCREENPOS x, SCREENPOS y, unsigned char key)
to run the menu_keypress(unsigned char key) function for the element on the given screen position.
Note: This behaviour is currently not sufficient for comfortable using with the list element.

(Since version 1.5) If compiled with multi-language support,
call void menu_language_set(unsigned char id)
To set the language to display. You may need to call menu_redraw(void) afterward in order for displaying the menu in the new selected language.

To exchange dynamic data with the GUI, like text which is modified during run-time or read out the state of a checkbox, global variables (the five arrays in the graphic) are used. They are used in favor of getter and setter functions in order to reduce the program size. To find the correct index in the array, the editor generates some #define with user configurable names.

Additional resources

I wrote a wiki article over the menu system (in German) some time ago
and posted the source code to a forum


You used the MenuDesigner?
Write me your opinion m DOT talk AT marwedels DOT de

Last changed: 23.05.2012