-
-
Notifications
You must be signed in to change notification settings - Fork 196
Input
##Full automated input
Input is normally done by reading a Stream, like the Serial. Menu input drivers are almost all build around the stream functionality, they all have a read and available functions like Serial. So anything that you can transform into a stream can be an input driver, provided that it uses the defined navigation characters.
The library also provides the chainStream utility to concatenate multiple input streams into a single stream. In this case the next device is only read after the current input is exausted.
With this utility we can have multiple input in parallel
constructing a chain of streams:
chainStream<N> name(Stream** chain)
where:
N number of streams to concatenate
name object name
chain and array of Stream pointers
example:
Stream const* myStreams[]={Serial,quadEncoder,encButton}
chainStream<3> allStreams(myStreams)
this construction can be automated by the MENU_INPUTS macro
MENU_INPUTS(name[,stream]);
where:
name is the new stream name followed by a list of streams
example:
MENU_INPUTS(in,&encStream,&encButton,&Serial);
You can also use the chainStream utility to generate a NULL stream if you plan to use the system without stream input.
chainStream<0> in(NULL);//<-- this creates a NULL stream
The null stream (never has input) might be useful for programatic menu drive.
##Programatic drive
###Parsed drive
You can drive the menu system by calling the navRoot::doInput function with a navigation character. This is the easy way.
###API driven
Menu system can also be driven by calling navRoot::doCmd function with a navCmd structure. See details on Navigation -> navRoot object