Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Menu by
Navigator.h@2:2654dc659298, 2013-03-05 (annotated)
- Committer:
- pyeh9
- Date:
- Tue Mar 05 21:24:37 2013 +0000
- Revision:
- 2:2654dc659298
- Parent:
- 1:84d263c8932d
- Child:
- 3:cfc36b42ae75
Second version - with comments
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" |
| pyeh9 | 1:84d263c8932d | 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: |
| pyeh9 | 2:2654dc659298 | 13 | Navigator(Menu *, RPG &, TextLCD *); |
| pyeh9 | 2:2654dc659298 | 14 | Menu *activeMenu; // the current menu - can change when RPG is pushed on selection with child menu |
| pyeh9 | 1:84d263c8932d | 15 | RPG rpg; |
| pyeh9 | 1:84d263c8932d | 16 | TextLCD *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(); |
| pyeh9 | 1:84d263c8932d | 28 | void printMenu(); |
| pyeh9 | 1:84d263c8932d | 29 | void printCursor(); |
| pyeh9 | 1:84d263c8932d | 30 | }; |
| pyeh9 | 1:84d263c8932d | 31 | |
| pyeh9 | 1:84d263c8932d | 32 | #endif |
