Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9

Fork of Menu by Peihsun Yeh

Embed: (wiki syntax)

« Back to documentation index

Navigator Class Reference

Navigator Class Reference

Class Navigator does the Navigation in the menu and updates the display. More...

#include <Navigator.h>

Public Member Functions

void moveUp ()
 Move up one line in menu.
void moveDown ()
 Move down one line in menu.
void select ()
 User presses Select Button.
void printMenu ()
 print the menu on LCD
void printCursor ()
 print cursor on the beginning of line

Detailed Description

Class Navigator does the Navigation in the menu and updates the display.

Interaction from outside is done by calling moveUp(), moveDown() or select(). Could be done by an RPG or via Buttons.

Example:

 #include "MenuItem.h"
 #include "Menu.h"
 #include "Navigator.h"
 #include <vector>
 #include <string>
 PinDetect  T1 ( p21,PullNone); //Button 1 - UP
 PinDetect  T2 ( p22,PullNone); //Button 2 - Down
 PinDetect  T3 ( p23,PullNone); //Button 3 - Select
 ...
     // Here is the heart of the system: the navigator. 
     // The navigator takes in a reference to the root and a reference to an lcd
     Navigator navigator(&rootMenu, &lcd);
     
     // attach the methods for buttons Up, Down, Select to the navigator
     T1.attach_asserted( &navigator, &Navigator::moveUp);
     T2.attach_asserted( &navigator, &Navigator::moveDown);
     T3.attach_asserted( &navigator, &Navigator::select);
     // do whatever you need to do in your main-loop.
        while( 1 ) {
          led4 = !led4;
          wait( 1 );
        }

Definition at line 40 of file Navigator.h.


Member Function Documentation

void moveDown (  )

Move down one line in menu.

call this method when user moves down one line. can be triggered by RPG or Button (PinDetect) or otherwise.

Definition at line 190 of file Navigator.cpp.

void moveUp (  )

Move up one line in menu.

call this method when user moves up one line. can be triggered by RPG or Button (PinDetect) or otherwise.

Definition at line 156 of file Navigator.cpp.

void printCursor (  )

print cursor on the beginning of line

Definition at line 38 of file Navigator.cpp.

void printMenu (  )

print the menu on LCD

Definition at line 22 of file Navigator.cpp.

void select (  )

User presses Select Button.

call this method when user wants to select an item. can be triggered by RPG or Button (PinDetect) or otherwise.

Definition at line 95 of file Navigator.cpp.