Release 1.01
Menu.h@4:7226c43320b5, 2019-09-12 (annotated)
- Committer:
- foxbrianr
- Date:
- Thu Sep 12 11:27:50 2019 +0000
- Revision:
- 4:7226c43320b5
- Parent:
- 3:8395f7ab6d3e
- Child:
- 5:9f4d4f8ffc00
beta1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pyeh9 | 0:577f0ec71f4c | 1 | #ifndef MENU_H |
pyeh9 | 0:577f0ec71f4c | 2 | #define MENU_H |
pyeh9 | 0:577f0ec71f4c | 3 | |
pyeh9 | 0:577f0ec71f4c | 4 | #include "mbed.h" |
foxbrianr | 3:8395f7ab6d3e | 5 | #include "LCD.h" |
foxbrianr | 3:8395f7ab6d3e | 6 | |
pyeh9 | 0:577f0ec71f4c | 7 | #include <vector> |
foxbrianr | 3:8395f7ab6d3e | 8 | #include <string> |
pyeh9 | 0:577f0ec71f4c | 9 | |
pyeh9 | 1:84d263c8932d | 10 | |
pyeh9 | 0:577f0ec71f4c | 11 | class Menu { |
pyeh9 | 0:577f0ec71f4c | 12 | private: |
foxbrianr | 4:7226c43320b5 | 13 | |
foxbrianr | 4:7226c43320b5 | 14 | Mutex display_mutex; |
pyeh9 | 0:577f0ec71f4c | 15 | |
pyeh9 | 0:577f0ec71f4c | 16 | public: |
foxbrianr | 4:7226c43320b5 | 17 | static Menu * currentMenu; |
foxbrianr | 4:7226c43320b5 | 18 | static Menu * getCurrentMenu () ; |
foxbrianr | 4:7226c43320b5 | 19 | static Menu * setCurrentMenu (Menu * value) ; |
foxbrianr | 3:8395f7ab6d3e | 20 | |
foxbrianr | 3:8395f7ab6d3e | 21 | LCD * lcd; |
foxbrianr | 4:7226c43320b5 | 22 | |
foxbrianr | 3:8395f7ab6d3e | 23 | |
foxbrianr | 3:8395f7ab6d3e | 24 | int update_needed; |
foxbrianr | 3:8395f7ab6d3e | 25 | |
foxbrianr | 4:7226c43320b5 | 26 | int selectedMenu; // what selection the cursor points to |
foxbrianr | 4:7226c43320b5 | 27 | |
foxbrianr | 3:8395f7ab6d3e | 28 | int cursorLine; // what line of the lcd the cursor is one |
foxbrianr | 4:7226c43320b5 | 29 | int cursorIndex; // what line of the lcd the cursor is one |
foxbrianr | 3:8395f7ab6d3e | 30 | |
foxbrianr | 4:7226c43320b5 | 31 | Menu * parent; |
foxbrianr | 4:7226c43320b5 | 32 | |
foxbrianr | 4:7226c43320b5 | 33 | vector<Menu*> children; |
foxbrianr | 4:7226c43320b5 | 34 | |
foxbrianr | 4:7226c43320b5 | 35 | char* menuID; |
pyeh9 | 1:84d263c8932d | 36 | |
foxbrianr | 3:8395f7ab6d3e | 37 | Menu(char *id); |
foxbrianr | 4:7226c43320b5 | 38 | |
foxbrianr | 4:7226c43320b5 | 39 | void add( Menu *submenu); |
foxbrianr | 3:8395f7ab6d3e | 40 | |
foxbrianr | 4:7226c43320b5 | 41 | virtual void init(); |
foxbrianr | 4:7226c43320b5 | 42 | virtual void select(); |
foxbrianr | 4:7226c43320b5 | 43 | virtual void back(); |
foxbrianr | 3:8395f7ab6d3e | 44 | |
foxbrianr | 4:7226c43320b5 | 45 | virtual char* getText() { return "Main"; } |
foxbrianr | 3:8395f7ab6d3e | 46 | |
foxbrianr | 4:7226c43320b5 | 47 | virtual void DrawDisplay(LCD * lcd); |
foxbrianr | 3:8395f7ab6d3e | 48 | virtual void display(LCD * lcd); |
foxbrianr | 4:7226c43320b5 | 49 | void displayCurrentTime (LCD * lcd); |
foxbrianr | 4:7226c43320b5 | 50 | void displayVersion (LCD * lcd); |
foxbrianr | 4:7226c43320b5 | 51 | |
foxbrianr | 3:8395f7ab6d3e | 52 | void moveUp(); |
foxbrianr | 3:8395f7ab6d3e | 53 | void moveDown(); |
foxbrianr | 3:8395f7ab6d3e | 54 | |
foxbrianr | 3:8395f7ab6d3e | 55 | virtual void pressClear(); |
foxbrianr | 3:8395f7ab6d3e | 56 | virtual void pressMode(); |
foxbrianr | 3:8395f7ab6d3e | 57 | virtual void pressSet(); |
foxbrianr | 3:8395f7ab6d3e | 58 | virtual void pressDown(); |
foxbrianr | 3:8395f7ab6d3e | 59 | virtual void pressUp(); |
foxbrianr | 3:8395f7ab6d3e | 60 | |
foxbrianr | 4:7226c43320b5 | 61 | virtual void lock() { display_mutex.lock();} |
foxbrianr | 4:7226c43320b5 | 62 | virtual void unlock() { display_mutex.unlock();} |
foxbrianr | 3:8395f7ab6d3e | 63 | |
pyeh9 | 0:577f0ec71f4c | 64 | }; |
pyeh9 | 0:577f0ec71f4c | 65 | #endif |