Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/neu-rah/arduinomenu

Arduino generic menu/interactivity system
https://github.com/neu-rah/arduinomenu

ansi arduino avr buttons control encoder esp8266 iot keyboard keys lcd menu pcint progmem ram static system tft touch web

Last synced: 5 days ago
JSON representation

Arduino generic menu/interactivity system

Awesome Lists containing this project

README

        

# ArduinoMenu 4

**Generic menu/interactivity system for the arduino framework**

[![License: LGPL-2.1+](https://img.shields.io/badge/License%20LGPL-2.1+-lightgrey.svg)](https://spdx.org/licenses/LGPL-2.1-or-later.html)
[![Build Status](https://travis-ci.org/neu-rah/ArduinoMenu.svg?branch=master)](https://travis-ci.org/neu-rah/ArduinoMenu)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/ruihfazevedo)
[![Join Gitter](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/ArduinoMenu/Lobby)

## Purpose
Full automated or user code driven navigation system.
With this system you can define menus, submenus, input fields and other iteration objects that deal with all input/output and can call user defined handler as a result of user iteration.
The user function can be operated as a single action called on click/enter or as a event driven function responding to focus In/Out or Enter/Esc events.
The system is designed as a non blocking polling system, allowing concurrent task to run.
Optionally the system can be operated in semi-automated mode, issuing navigation command from user code.

See the [wiki](https://github.com/neu-rah/ArduinoMenu/wiki)

## Simple Example
```c++
#include
#include
#include
#include

using namespace Menu;

#define LEDPIN LED_BUILTIN
#define MAX_DEPTH 1

unsigned int timeOn=10;
unsigned int timeOff=90;

MENU(mainMenu, "Blink menu", Menu::doNothing, Menu::noEvent, Menu::wrapStyle
,FIELD(timeOn,"On","ms",0,1000,10,1, Menu::doNothing, Menu::noEvent, Menu::noStyle)
,FIELD(timeOff,"Off","ms",0,10000,10,1,Menu::doNothing, Menu::noEvent, Menu::noStyle)
,EXIT("`

depending on your output driver it may be one of (can install both)
- https://github.com/neu-rah/streamFlow
- https://github.com/scottdky/Streaming

### Input devices

Serial https://www.arduino.cc/en/Reference/Serial

quadEncoder - Generic encoder using PCINT (builtin)

Buttons - simple digital keyboard (builtin)

Generic keyboard (no PCINT) - configurable for digital or analog keyboards (builtin)

Analog Joystick

ClickEncoder https://github.com/0xPIT/encoder

Matrix keypad
http://playground.arduino.cc/Code/Keypad
https://github.com/Nullkraft/Keypad

PCF8574 based i2c matrix keypad
https://github.com/whatnick/i2ckeypad

User defined input calling menu navigation API

Web browser (experimental) when using ESP devices

## Dependencies
This library depends on the following libraries:

- streamFlow https://github.com/neu-rah/streamFlow (on debug mode)

Depending on the type of input or output, other libraries might be needed. Essentially any library needed for your devices.

## Limits

- when using macros the menu is limited to 16 options (current macro limnit).
- menus **must** have at least 2 options when built using macros.
- maximum 127 options.
- fast access (numeric keys) only supports 9 options (1 to 9)
- prompts can overflow on panels with less than 4 characters width
- menu system is character based, so choose monometric font to achieve best results, it will work with any font but the text can overflow.

## Base

- Character based information display.
- Line based menu organization.
- Stream IO + specializations.

## info

more info at

[wiki](https://github.com/neu-rah/ArduinoMenu/wiki) pages, [issues](https://github.com/neu-rah/ArduinoMenu/issues?utf8=%E2%9C%93&q=) or [r-site.net](http://www.r-site.net/?lang=en&at=//op%5B@id=%273090%27%5D)

## Errors / Sugestions

Please report errors, problems or enhancement ideas, I apreciate the feedback. Thanks.

On issues report please specify the input and output drivers or devices as well as target platform.

## notes

encoder now needs begin() to be called on setup (2.x)

input is read from generic streams, included simple streams for encoders and keyboards
- provided encoder driver uses internal pull-ups and reverse logic

multiple stream packing for input to mix encoder stream with encoder keyboard (usually 1 or 2 keys)

## History

### 4.0
- SdFat plugin and example
- EscControl examle
- support Bodmer/TFT_eSPI
- SDCard file picker plugin
- Allow virtual/dynamic data custom menus
- alternative key driver with explicit pin modes
- More examples
- Text edit fields with validation *
- Pad style menus (horizontal list)
- inline pad menus can input custom formats like IP/Date/Time, experimental and just for devices that can position a cursor
- Plugins, alternative menu items potentially device specific
- Allow multiple concurrent menus
- Support UCGLib displays
- Support U8x8 displays
- Support Arduino TFT
- Support PCF8574 I2C LCD
- Support Analog Joystick input
- Added input burst config option
- VALUEOBJ macro, user allocated values
- menuIn class for menu inputs (allows device field invertion) *
- some options have been distributed to some other classes
- allow dynamic menu construction (ram) even for AVR's

#### * API changes

##### Options

**invertFieldKeys** option removed, invertion is now supported by specific menuIn objects.

_regression: still needed to ease simple input cases._

**numValueInput** moved to menuIn object

**navRoot** extra options, previously on global options object
```c++
bool nav2D=false;//not used
bool canExit=true;//v4.0 moved from global options
bool useUpdateEvent=false;//if false, use enterEvent when field value is changed.
idx_t inputBurst=1;//limit of inputs that can be processed before output
```

##### Serial input

Serial is no longer accepted as an input directly, use serialIn instead

##### prompt base API

printTo member function changed from:

```c++
Used printTo(navRoot&,bool,menuOut&,idx_t,idx_t);
```

to

```c++
Used printTo(navRoot&,bool,menuOut&,idx_t,idx_t,idx_t=0);
```

_this should only affect customized components_

inputs are now from class menuIn, derived from Stream but including flag functions for field axis inversion per input class.

### 3.0
- complete revision of menu control system
- menu structure separated in ram objects and flash objects
- using separate navigation control objects **navNode**
- central navigation control object **navRoot**
- using event for all menu objects (focus, blur, enter, exit).
- multiple panels
- color enumeration at base level
- multiple output devices in parallel
- define exit as regular option
- limiting text width to prevent overflow

### 2.4
- support for teensy (tested on 3.2)
- new field type SELECT
- reflexivity, fields reflect external changes to values
- store field strings to progmem
- automatic use of RAM on system without PROGMEM

### 2.3

- action functions now need to return bool (only affects menus)

>**false** = continue menu
>
>**true** = exit menu

- Support for U8GLib screens
- alternative use ClickEncoder
- using flash memory to store menu strings and lists (PROGMEM)

### 2.0

- non-blocking menu main cycle
- Menufields as menu prompts with associated value
values can be:
numeric withing range
list of values toggled on click (for small lists)
list of values selected as submenu (for longer lists)
- PCINT now supports Mega/2560 and possibly others

### 1.x
- basic menu functionality