LCD implementation of our project.

Dependencies:   mbed mbed-rtos MLX90614

Committer:
ovidiup13
Date:
Wed Jun 03 17:42:47 2015 +0000
Revision:
10:97389d774ae1
Parent:
7:11675c1dce4f
working version, comment out thermo in main;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ovidiup13 0:1e597b0f8b3b 1 #ifndef _MENU_H_
ovidiup13 0:1e597b0f8b3b 2 #define _MENU_H_
ovidiup13 0:1e597b0f8b3b 3
ovidiup13 0:1e597b0f8b3b 4 #include "Item.h"
ovidiup13 0:1e597b0f8b3b 5
ovidiup13 0:1e597b0f8b3b 6 int const MAX_ITEMS = 16;
ovidiup13 0:1e597b0f8b3b 7 int const TITLE_LINE = 1;
ovidiup13 7:11675c1dce4f 8 int const FIRST_ITEM_LINE = 2;
ovidiup13 0:1e597b0f8b3b 9 int const LAST_ITEM_LINE = 7;
ovidiup13 7:11675c1dce4f 10 int const ITEMS_PER_SCREEN = 6;
ovidiup13 0:1e597b0f8b3b 11
ovidiup13 0:1e597b0f8b3b 12 class Menu: public Item {
ovidiup13 0:1e597b0f8b3b 13 public:
ovidiup13 0:1e597b0f8b3b 14 Item ** items;
ovidiup13 3:688b62ff6474 15 int size, selected, current_line;
ovidiup13 0:1e597b0f8b3b 16 bool isScreen;
ovidiup13 0:1e597b0f8b3b 17
ovidiup13 0:1e597b0f8b3b 18 //menu constructor
ovidiup13 3:688b62ff6474 19 Menu(char * t, ST7565 *lcd){
ovidiup13 0:1e597b0f8b3b 20 title = t;
ovidiup13 0:1e597b0f8b3b 21 st7565 = lcd;
ovidiup13 0:1e597b0f8b3b 22 items = new Item*[MAX_ITEMS];
ovidiup13 3:688b62ff6474 23 selected = size = 0;
ovidiup13 0:1e597b0f8b3b 24 current_line = FIRST_ITEM_LINE;
ovidiup13 0:1e597b0f8b3b 25 isScreen = false;
ovidiup13 0:1e597b0f8b3b 26 isSelectable = false;
ovidiup13 0:1e597b0f8b3b 27 }
ovidiup13 0:1e597b0f8b3b 28
ovidiup13 0:1e597b0f8b3b 29 //menu item constructor - go to a screen
ovidiup13 3:688b62ff6474 30 Menu(char * t, Item *screen){
ovidiup13 0:1e597b0f8b3b 31 title = t;
ovidiup13 0:1e597b0f8b3b 32 st7565 = NULL;
ovidiup13 0:1e597b0f8b3b 33 items = new Item*[1];
ovidiup13 0:1e597b0f8b3b 34 items[0] = screen;
ovidiup13 0:1e597b0f8b3b 35 selected = 0;
ovidiup13 0:1e597b0f8b3b 36 size = 1;
ovidiup13 0:1e597b0f8b3b 37 current_line = FIRST_ITEM_LINE;
ovidiup13 0:1e597b0f8b3b 38 isScreen = true;
ovidiup13 0:1e597b0f8b3b 39 isSelectable = true;
ovidiup13 0:1e597b0f8b3b 40 }
ovidiup13 0:1e597b0f8b3b 41
ovidiup13 0:1e597b0f8b3b 42 //display the menu
ovidiup13 0:1e597b0f8b3b 43 virtual void display(void);
ovidiup13 0:1e597b0f8b3b 44
ovidiup13 0:1e597b0f8b3b 45 //update current selection
ovidiup13 0:1e597b0f8b3b 46 virtual void update(char c);
ovidiup13 0:1e597b0f8b3b 47
ovidiup13 0:1e597b0f8b3b 48 //set the title
ovidiup13 0:1e597b0f8b3b 49 void setTitle(char * t){
ovidiup13 0:1e597b0f8b3b 50 title = t;
ovidiup13 0:1e597b0f8b3b 51 }
ovidiup13 0:1e597b0f8b3b 52
ovidiup13 0:1e597b0f8b3b 53 //highlights the current selection
ovidiup13 0:1e597b0f8b3b 54 void addItem(Item * i);
ovidiup13 0:1e597b0f8b3b 55
ovidiup13 0:1e597b0f8b3b 56 private:
ovidiup13 0:1e597b0f8b3b 57 //display items on a new screen starting with a specific index
ovidiup13 0:1e597b0f8b3b 58 void display_items(int index);
ovidiup13 0:1e597b0f8b3b 59 };
ovidiup13 0:1e597b0f8b3b 60
ovidiup13 0:1e597b0f8b3b 61 #endif
ovidiup13 0:1e597b0f8b3b 62