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:
8:81ed1135ba02
working version, comment out thermo in main;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ovidiup13 0:1e597b0f8b3b 1 #ifndef _UI_H_
ovidiup13 0:1e597b0f8b3b 2 #define _UI_H_
ovidiup13 0:1e597b0f8b3b 3
ovidiup13 3:688b62ff6474 4 //include files
ovidiup13 3:688b62ff6474 5 #include "st7565LCD.h"
ovidiup13 3:688b62ff6474 6 #include "Header.h"
ovidiup13 3:688b62ff6474 7 #include "Item.h"
ovidiup13 3:688b62ff6474 8 #include "Menu.h"
ovidiup13 3:688b62ff6474 9 #include "Compass.h"
ovidiup13 3:688b62ff6474 10 #include "LevelMeter.h"
ovidiup13 3:688b62ff6474 11 #include "Measure.h"
ovidiup13 8:81ed1135ba02 12 #include "Thermometer.h"
ovidiup13 3:688b62ff6474 13
ovidiup13 3:688b62ff6474 14 //include libs
ovidiup13 0:1e597b0f8b3b 15 #include <string.h>
ovidiup13 0:1e597b0f8b3b 16 #include <assert.h>
ovidiup13 0:1e597b0f8b3b 17 #include <stdio.h>
ovidiup13 0:1e597b0f8b3b 18 #include <stdlib.h>
ovidiup13 0:1e597b0f8b3b 19
ovidiup13 0:1e597b0f8b3b 20 //define brightness and contrast
ovidiup13 0:1e597b0f8b3b 21 #define _DEFAULT_BRIGHTNESS 25
ovidiup13 0:1e597b0f8b3b 22 #define _DEFAULT_CONTRAST 20
ovidiup13 0:1e597b0f8b3b 23 #define _MAX_BRIGHTNESS 200
ovidiup13 0:1e597b0f8b3b 24 #define _MIN_BRIGHTNESS 10
ovidiup13 0:1e597b0f8b3b 25
ovidiup13 0:1e597b0f8b3b 26 //define default color
ovidiup13 0:1e597b0f8b3b 27 #define _DEFAULT_COLOR 20
ovidiup13 0:1e597b0f8b3b 28
ovidiup13 6:49a007861c76 29 //define mbed pins
ovidiup13 7:11675c1dce4f 30 #define _MOSI p5
ovidiup13 7:11675c1dce4f 31 #define _SCLK p7
ovidiup13 6:49a007861c76 32 #define _RST p24
ovidiup13 6:49a007861c76 33 #define _A0 p8
ovidiup13 7:11675c1dce4f 34 #define _CS p6
ovidiup13 6:49a007861c76 35
ovidiup13 0:1e597b0f8b3b 36 using namespace std;
ovidiup13 0:1e597b0f8b3b 37
ovidiup13 0:1e597b0f8b3b 38 class Item;
ovidiup13 0:1e597b0f8b3b 39
ovidiup13 0:1e597b0f8b3b 40 class UI {
ovidiup13 0:1e597b0f8b3b 41 public:
ovidiup13 0:1e597b0f8b3b 42
ovidiup13 0:1e597b0f8b3b 43 //functions
ovidiup13 0:1e597b0f8b3b 44 void init(void);
ovidiup13 0:1e597b0f8b3b 45 //update all screen
ovidiup13 0:1e597b0f8b3b 46 void update(char c);
ovidiup13 0:1e597b0f8b3b 47 //update header only
ovidiup13 0:1e597b0f8b3b 48 void display(void);
ovidiup13 0:1e597b0f8b3b 49 //update current menu
ovidiup13 0:1e597b0f8b3b 50 void setCurrent(Item * item){
ovidiup13 0:1e597b0f8b3b 51 current = item;
ovidiup13 0:1e597b0f8b3b 52 }
ovidiup13 0:1e597b0f8b3b 53 //set header
ovidiup13 0:1e597b0f8b3b 54 void setHeader(Header * h){
ovidiup13 0:1e597b0f8b3b 55 header = h;
ovidiup13 0:1e597b0f8b3b 56 }
ovidiup13 2:fcde41900fa5 57 //set header title
ovidiup13 2:fcde41900fa5 58 void setHeaderTitle(char * title){
ovidiup13 4:024e6a9c2ebf 59 header->setTitle(title);
ovidiup13 2:fcde41900fa5 60 }
ovidiup13 0:1e597b0f8b3b 61
ovidiup13 0:1e597b0f8b3b 62 UI(ST7565 *lcd){
ovidiup13 0:1e597b0f8b3b 63 current = NULL;
ovidiup13 0:1e597b0f8b3b 64 header = NULL;
ovidiup13 0:1e597b0f8b3b 65 st7565 = lcd;
ovidiup13 0:1e597b0f8b3b 66 }
ovidiup13 4:024e6a9c2ebf 67
ovidiup13 4:024e6a9c2ebf 68 private:
ovidiup13 4:024e6a9c2ebf 69 //variables
ovidiup13 4:024e6a9c2ebf 70 //current selected menu
ovidiup13 4:024e6a9c2ebf 71 Item * current;
ovidiup13 4:024e6a9c2ebf 72 //header object
ovidiup13 4:024e6a9c2ebf 73 Header * header;
ovidiup13 4:024e6a9c2ebf 74 //display pointer
ovidiup13 4:024e6a9c2ebf 75 ST7565 * st7565;
ovidiup13 4:024e6a9c2ebf 76 //set colors
ovidiup13 4:024e6a9c2ebf 77 void set_colors(float r, float g, float b, float aa);
ovidiup13 0:1e597b0f8b3b 78 };
ovidiup13 0:1e597b0f8b3b 79
ovidiup13 0:1e597b0f8b3b 80 #endif