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
Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9
Navigator.h@3:cfc36b42ae75, 2015-01-01 (annotated)
- Committer:
- charly
- Date:
- Thu Jan 01 22:27:30 2015 +0000
- Revision:
- 3:cfc36b42ae75
- Parent:
- 2:2654dc659298
- Child:
- 4:67097127da6c
Removed RPG; added method select.; Interaction can be handled outside Menu with methods Navigator::moveUp, moveDown and select.; Changed from TextLCD to http://developer.mbed.org/cookbook/Text-LCD-Enhanced; Fixed bug to display 15 Chars per line
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pyeh9 | 1:84d263c8932d | 1 | #ifndef NAVIGATOR_H |
pyeh9 | 1:84d263c8932d | 2 | #define NAVIGATOR_H |
pyeh9 | 1:84d263c8932d | 3 | |
pyeh9 | 1:84d263c8932d | 4 | #include "mbed.h" |
pyeh9 | 1:84d263c8932d | 5 | #include "Menu.h" |
pyeh9 | 1:84d263c8932d | 6 | #include "TextLCD.h" |
charly | 3:cfc36b42ae75 | 7 | //#include "RPG.h" |
pyeh9 | 1:84d263c8932d | 8 | |
pyeh9 | 1:84d263c8932d | 9 | class Navigator { |
pyeh9 | 1:84d263c8932d | 10 | private: |
pyeh9 | 1:84d263c8932d | 11 | |
pyeh9 | 1:84d263c8932d | 12 | public: |
charly | 3:cfc36b42ae75 | 13 | Navigator(Menu *, /*RPG &,*/ TextLCD_Base *); |
pyeh9 | 2:2654dc659298 | 14 | Menu *activeMenu; // the current menu - can change when RPG is pushed on selection with child menu |
charly | 3:cfc36b42ae75 | 15 | // RPG rpg; |
charly | 3:cfc36b42ae75 | 16 | TextLCD_Base *lcd; |
pyeh9 | 1:84d263c8932d | 17 | |
pyeh9 | 1:84d263c8932d | 18 | bool lastButton, button; |
pyeh9 | 2:2654dc659298 | 19 | int direction; // 1 = CW, -1 = CCW |
pyeh9 | 1:84d263c8932d | 20 | |
pyeh9 | 2:2654dc659298 | 21 | int bottom; // the index of the last item of current menu |
pyeh9 | 2:2654dc659298 | 22 | int cursorPos; // what selection the cursor points to |
pyeh9 | 1:84d263c8932d | 23 | int cursorLine; // what line of the lcd the cursor is on. 1 = first line, 2 = second line |
pyeh9 | 1:84d263c8932d | 24 | |
pyeh9 | 2:2654dc659298 | 25 | void poll(); // repeatedly call this function to determine if RPG is being used |
pyeh9 | 1:84d263c8932d | 26 | void moveUp(); |
pyeh9 | 1:84d263c8932d | 27 | void moveDown(); |
charly | 3:cfc36b42ae75 | 28 | void select(); |
pyeh9 | 1:84d263c8932d | 29 | void printMenu(); |
pyeh9 | 1:84d263c8932d | 30 | void printCursor(); |
pyeh9 | 1:84d263c8932d | 31 | }; |
pyeh9 | 1:84d263c8932d | 32 | |
pyeh9 | 1:84d263c8932d | 33 | #endif |