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 #include "UserInterface.h"
ovidiup13 0:1e597b0f8b3b 2
ovidiup13 7:11675c1dce4f 3 /*
ovidiup13 0:1e597b0f8b3b 4 //colors
ovidiup13 0:1e597b0f8b3b 5 PwmOut red(p21);
ovidiup13 0:1e597b0f8b3b 6 PwmOut green(p22);
ovidiup13 0:1e597b0f8b3b 7 PwmOut blue(p23);
ovidiup13 0:1e597b0f8b3b 8 PwmOut a(p24);
ovidiup13 0:1e597b0f8b3b 9
ovidiup13 0:1e597b0f8b3b 10 void UI::set_colors(float r, float g, float b, float aa){ //red, green, blue, a+
ovidiup13 0:1e597b0f8b3b 11 //check that colors are between 0.0 and 1.0
ovidiup13 0:1e597b0f8b3b 12 assert(r >=0 && r <= 1);
ovidiup13 0:1e597b0f8b3b 13 assert(g >=0 && g <= 1);
ovidiup13 0:1e597b0f8b3b 14 assert(b >=0 && b <= 1);
ovidiup13 0:1e597b0f8b3b 15 assert(aa >=0 && aa <= 1);
ovidiup13 0:1e597b0f8b3b 16
ovidiup13 0:1e597b0f8b3b 17 //define colors
ovidiup13 0:1e597b0f8b3b 18 red = r;
ovidiup13 0:1e597b0f8b3b 19 green = g;
ovidiup13 0:1e597b0f8b3b 20 blue = b;
ovidiup13 0:1e597b0f8b3b 21 a = aa;
ovidiup13 0:1e597b0f8b3b 22 }
ovidiup13 7:11675c1dce4f 23 */
ovidiup13 0:1e597b0f8b3b 24
ovidiup13 0:1e597b0f8b3b 25 void UI::init(void){
ovidiup13 0:1e597b0f8b3b 26 //initialize variables
ovidiup13 0:1e597b0f8b3b 27 int brightness = _DEFAULT_BRIGHTNESS;
ovidiup13 0:1e597b0f8b3b 28
ovidiup13 0:1e597b0f8b3b 29 //start LCD and display logo
ovidiup13 0:1e597b0f8b3b 30 st7565->begin(_DEFAULT_CONTRAST);
ovidiup13 0:1e597b0f8b3b 31 st7565->st7565_set_brightness(brightness);
ovidiup13 0:1e597b0f8b3b 32 //set colors
ovidiup13 7:11675c1dce4f 33 //set_colors(0, 1, 1, 1);
ovidiup13 0:1e597b0f8b3b 34 //display logo
ovidiup13 0:1e597b0f8b3b 35 st7565->display();
ovidiup13 0:1e597b0f8b3b 36 wait(2.0);
ovidiup13 0:1e597b0f8b3b 37
ovidiup13 3:688b62ff6474 38 header->setTitle(current->getTitle());
ovidiup13 2:fcde41900fa5 39 display();
ovidiup13 0:1e597b0f8b3b 40 }
ovidiup13 0:1e597b0f8b3b 41
ovidiup13 0:1e597b0f8b3b 42 void UI::display(void){
ovidiup13 0:1e597b0f8b3b 43 st7565->clear();
ovidiup13 2:fcde41900fa5 44 current->display();
ovidiup13 0:1e597b0f8b3b 45 header->display();
ovidiup13 0:1e597b0f8b3b 46 }
ovidiup13 0:1e597b0f8b3b 47
ovidiup13 0:1e597b0f8b3b 48 void UI::update(char c){
ovidiup13 0:1e597b0f8b3b 49 current->update(c);
ovidiup13 3:688b62ff6474 50 //set header after update
ovidiup13 3:688b62ff6474 51 if(c == 'y'){
ovidiup13 3:688b62ff6474 52 current = current->getSelectedScreen();
ovidiup13 3:688b62ff6474 53 header->setTitle(current->getTitle());
ovidiup13 3:688b62ff6474 54 }
ovidiup13 3:688b62ff6474 55 this->display();
ovidiup13 0:1e597b0f8b3b 56 }