Release 1.01

Dependents:   mbed_escm2000

Committer:
foxbrianr
Date:
Tue Sep 17 13:48:22 2019 +0000
Revision:
5:9f4d4f8ffc00
Parent:
4:7226c43320b5
Beta 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
foxbrianr 5:9f4d4f8ffc00 1 /**************************************************************************
foxbrianr 5:9f4d4f8ffc00 2 * @file Menu.h
foxbrianr 5:9f4d4f8ffc00 3 * @brief Base class for wrapping the interface with LCD Menu display
foxbrianr 5:9f4d4f8ffc00 4 * @version: V1.0
foxbrianr 5:9f4d4f8ffc00 5 * @date: 9/17/2019
foxbrianr 5:9f4d4f8ffc00 6
foxbrianr 5:9f4d4f8ffc00 7 *
foxbrianr 5:9f4d4f8ffc00 8 * @note
foxbrianr 5:9f4d4f8ffc00 9 * Copyright (C) 2019 E3 Design. All rights reserved.
foxbrianr 5:9f4d4f8ffc00 10 *
foxbrianr 5:9f4d4f8ffc00 11 * @par
foxbrianr 5:9f4d4f8ffc00 12 * E3 Designers LLC is supplying this software for use with Cortex-M3 LPC1768
foxbrianr 5:9f4d4f8ffc00 13 * processor based microcontroller for the ESCM 2000 Monitor and Display.
foxbrianr 5:9f4d4f8ffc00 14 * *
foxbrianr 5:9f4d4f8ffc00 15 * @par
foxbrianr 5:9f4d4f8ffc00 16 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
foxbrianr 5:9f4d4f8ffc00 17 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
foxbrianr 5:9f4d4f8ffc00 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
foxbrianr 5:9f4d4f8ffc00 19 * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
foxbrianr 5:9f4d4f8ffc00 20 * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
foxbrianr 5:9f4d4f8ffc00 21 *
foxbrianr 5:9f4d4f8ffc00 22 ******************************************************************************/
pyeh9 0:577f0ec71f4c 23 #ifndef MENU_H
pyeh9 0:577f0ec71f4c 24 #define MENU_H
pyeh9 0:577f0ec71f4c 25
pyeh9 0:577f0ec71f4c 26 #include "mbed.h"
foxbrianr 3:8395f7ab6d3e 27 #include "LCD.h"
foxbrianr 3:8395f7ab6d3e 28
pyeh9 0:577f0ec71f4c 29 #include <vector>
foxbrianr 3:8395f7ab6d3e 30 #include <string>
pyeh9 0:577f0ec71f4c 31
pyeh9 1:84d263c8932d 32
pyeh9 0:577f0ec71f4c 33 class Menu {
pyeh9 0:577f0ec71f4c 34 private:
foxbrianr 4:7226c43320b5 35
foxbrianr 4:7226c43320b5 36 Mutex display_mutex;
pyeh9 0:577f0ec71f4c 37
pyeh9 0:577f0ec71f4c 38 public:
foxbrianr 4:7226c43320b5 39 static Menu * currentMenu;
foxbrianr 4:7226c43320b5 40 static Menu * getCurrentMenu () ;
foxbrianr 4:7226c43320b5 41 static Menu * setCurrentMenu (Menu * value) ;
foxbrianr 3:8395f7ab6d3e 42
foxbrianr 3:8395f7ab6d3e 43 LCD * lcd;
foxbrianr 4:7226c43320b5 44
foxbrianr 3:8395f7ab6d3e 45
foxbrianr 3:8395f7ab6d3e 46 int update_needed;
foxbrianr 3:8395f7ab6d3e 47
foxbrianr 4:7226c43320b5 48 int selectedMenu; // what selection the cursor points to
foxbrianr 4:7226c43320b5 49
foxbrianr 3:8395f7ab6d3e 50 int cursorLine; // what line of the lcd the cursor is one
foxbrianr 4:7226c43320b5 51 int cursorIndex; // what line of the lcd the cursor is one
foxbrianr 3:8395f7ab6d3e 52
foxbrianr 4:7226c43320b5 53 Menu * parent;
foxbrianr 4:7226c43320b5 54
foxbrianr 4:7226c43320b5 55 vector<Menu*> children;
foxbrianr 4:7226c43320b5 56
foxbrianr 4:7226c43320b5 57 char* menuID;
pyeh9 1:84d263c8932d 58
foxbrianr 3:8395f7ab6d3e 59 Menu(char *id);
foxbrianr 4:7226c43320b5 60
foxbrianr 4:7226c43320b5 61 void add( Menu *submenu);
foxbrianr 3:8395f7ab6d3e 62
foxbrianr 4:7226c43320b5 63 virtual void init();
foxbrianr 4:7226c43320b5 64 virtual void select();
foxbrianr 4:7226c43320b5 65 virtual void back();
foxbrianr 3:8395f7ab6d3e 66
foxbrianr 4:7226c43320b5 67 virtual char* getText() { return "Main"; }
foxbrianr 3:8395f7ab6d3e 68
foxbrianr 4:7226c43320b5 69 virtual void DrawDisplay(LCD * lcd);
foxbrianr 3:8395f7ab6d3e 70 virtual void display(LCD * lcd);
foxbrianr 4:7226c43320b5 71 void displayCurrentTime (LCD * lcd);
foxbrianr 4:7226c43320b5 72 void displayVersion (LCD * lcd);
foxbrianr 4:7226c43320b5 73
foxbrianr 3:8395f7ab6d3e 74 void moveUp();
foxbrianr 3:8395f7ab6d3e 75 void moveDown();
foxbrianr 3:8395f7ab6d3e 76
foxbrianr 3:8395f7ab6d3e 77 virtual void pressClear();
foxbrianr 3:8395f7ab6d3e 78 virtual void pressMode();
foxbrianr 3:8395f7ab6d3e 79 virtual void pressSet();
foxbrianr 3:8395f7ab6d3e 80 virtual void pressDown();
foxbrianr 3:8395f7ab6d3e 81 virtual void pressUp();
foxbrianr 3:8395f7ab6d3e 82
foxbrianr 4:7226c43320b5 83 virtual void lock() { display_mutex.lock();}
foxbrianr 4:7226c43320b5 84 virtual void unlock() { display_mutex.unlock();}
foxbrianr 3:8395f7ab6d3e 85
pyeh9 0:577f0ec71f4c 86 };
pyeh9 0:577f0ec71f4c 87 #endif