Classes | Defines

/home/jgoppert/Projects/ap/libraries/AP_Common/include/menu.h File Reference

Simple commandline menu subsystem. The Menu class implements a simple CLI that accepts commands typed by the user, and passes the arguments to those commands to a function defined as handing the command. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Menu
 Class defining and handling one menu tree. More...
struct  Menu::arg
struct  Menu::command

Defines

#define MENU_COMMANDLINE_MAX   32
 maximum input line length
#define MENU_ARGS_MAX   4
 maximum number of arguments
#define MENU_COMMAND_MAX   14
 maximum size of a command name
#define MENU(name, prompt, commands)
#define MENU2(name, prompt, commands, preprompt)

Detailed Description

Simple commandline menu subsystem. The Menu class implements a simple CLI that accepts commands typed by the user, and passes the arguments to those commands to a function defined as handing the command.

Commands are defined in an array of Menu::command structures passed to the constructor. Each entry in the array defines one command.

Arguments passed to the handler function are pre-converted to both long and float for convenience.

Definition in file menu.h.


Define Documentation

#define MENU (   name,
  prompt,
  commands 
)
Value:
static const char __menu_name__ ##name[] PROGMEM = prompt;      \
        static Menu name(__menu_name__ ##name, commands, sizeof(commands) / sizeof(commands[0]))

Macros used to define a menu.

The commands argument should be an arary of Menu::command structures, one per command name. The array does not need to be terminated with any special record.

Use name.run() to run the menu.

The MENU2 macro supports the optional pre-prompt printing function.

Definition at line 133 of file menu.h.

#define MENU2 (   name,
  prompt,
  commands,
  preprompt 
)
Value:
static const char __menu_name__ ##name[] PROGMEM = prompt;      \
        static Menu name(__menu_name__ ##name, commands, sizeof(commands) / sizeof(commands[0]), preprompt)

Definition at line 137 of file menu.h.

#define MENU_ARGS_MAX   4

maximum number of arguments

Definition at line 20 of file menu.h.

#define MENU_COMMAND_MAX   14

maximum size of a command name

Definition at line 21 of file menu.h.

#define MENU_COMMANDLINE_MAX   32

maximum input line length

Definition at line 19 of file menu.h.