Skip to content
Louis Beaudoin edited this page Mar 20, 2017 · 42 revisions

ArduinoMenu Library 3.x Wiki

Menu library basics

This library is divided in parts to be included on your project as needed, this is a way of minimizing compile time. Be sure to include the needed parts.

Some examples of this wiki refer to some parts like the menu serial output driver.

Parts are usually in menuIO/... folder. So be sure to include the needed parts.

The code is focused on lower resource profile.

The menu is static constructed to allow PROGMEM usage. Meaning that construction is more complicated than dynamic menus

The menu system does not store field variables, instead it uses references to variables already in your code, this makes integration easier and avoids translations and extra functions.

##Objects organization

Objects can be IO devices, navigation controllers or menu structure. All is organized around the root navigation object.

####Navigation The root navigation object uses a set of navigation level controllers and deal with all aspects of navigation, selected options, active menus etc... It also responds to commands and its the way of doing navigation status, by sending navigation commands to the navigation objects.

####Menu Structure This objects deal with the menu text and structure along with user iteration hooks.

####IO Objects Store information about IO device. The root navigation access to them to do its job.

##Menu software components

###menuIO files

include this files as needed ex: #include <menuIO/serialOut.h>

menuIO/adafruitGfxOut.h - use adafruit output devices.

menuIO/ansiSerialOut.h - use serial output with an ANSI terminal

menuIO/chainStream.h - join multiple input streams into one.

menuIO/clickEncoderIn.h - use PCINT wired encoder

menuIO/encoderIn.h - use generic encoder

menuIO/esp8266Out.h - for esp8266 web output (experimental)

menuIO/keyIn.h - use generic buttons

menuIO/lcdOut.h - use Malpartida's LCD's drivers

menuIO/liquidCrystalOut.h - standard LCD output

menuIO/serialOut.h - use standard serial output.

menuIO/softKeyIn.h - use generic buttons with software debounce

menuIO/u8g2Out.h - use U8g² screen device.

menuIO/U8GLibOut.h - use U8GLib screen device.

menuIO/utftOut.h - use utf screen device.

menuIO/utouchIn.h - use touch input device.

menuIO/xmlFmt.h - formater to write menu as xml, used by esp8266 web interface (experimental)

###Menu structure

This is done using a set of macros to define menus, atach menus to other menus to form sub-menus, numeric fields and choice/selection fields. Macros are used to define most of the menu data as static and stored on flash memory, because ram memory is critical on AVR devices. Also all menu used ram is allocated at startup, avoiding dynamic ram allocation and making memory usage more predictable.

###Inputs

We support multiple parallel inputs, so the input is usually either a single stream or an array of streams concatenated with chainStream object.

see inputs and initialization for more details.

###Outputs

We support multiple parallel devices, this is useful on final products because it provides alternatives in case of failure of the main output device. Usually an LCD or TFT as main output and serial output as a maintenance/backup output device.

see output and initialization for more details

###Navigation control All navigation is centrally controlled by a navigation root object

the navigation root object holds the lists of inputs and outputs as well as a list layer navigation status aus. objects, used to navigate down on sub-menus and to preserve status when we navigate back. Because this menu avoids dynamic memory allocation, we need to tell beforehand the maximum nested depth level, any sub-menu or choice/select field must count as one depth layer.

see navigation and initialization for more details

###Menu execution

The menu system depends on your code to call one of its functions to iterate the system. So if none is called the menu is not executing any IO and your code is free to use the IO devices. Also if the menu system calls one of your functions as a result of iteration, then the menu will not be executing while your function does not return. Unless of course you define some other interrupt driven method that calls the menu meanwhile.

menu execution/iteration is done by using some API functions as members of the main navigation object (navRoot).

One of this functions must be called regularly because the system just verifies if there is available input or output need and returns.

void poll();

the most simple and powerful menu execution function,it will deal with all IO driving the menu on a full automated mode.

inline void doInput();

check inputs list for available data

void doInput(const char*in);

call the menu system to consider one given character as input

inline void doOutput();

verify the need of output and satisfy it.

Clone this wiki locally