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...
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) |
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 MENU | ( | name, | ||
prompt, | ||||
commands | ||||
) |
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.
#define MENU2 | ( | name, | ||
prompt, | ||||
commands, | ||||
preprompt | ||||
) |