LCD implementation of our project.

Dependencies:   mbed mbed-rtos MLX90614

Committer:
ovidiup13
Date:
Sat Apr 04 18:24:21 2015 +0000
Revision:
2:fcde41900fa5
Parent:
0:1e597b0f8b3b
Child:
4:024e6a9c2ebf
Cleaned up interface, added buttons.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ovidiup13 0:1e597b0f8b3b 1 #include "Header.h"
ovidiup13 0:1e597b0f8b3b 2
ovidiup13 2:fcde41900fa5 3 Header::Header(float lvl, char * t, ST7565 * lcd){
ovidiup13 0:1e597b0f8b3b 4 battery_level = lvl;
ovidiup13 2:fcde41900fa5 5 title = t;
ovidiup13 0:1e597b0f8b3b 6 st7565 = lcd;
ovidiup13 0:1e597b0f8b3b 7 }
ovidiup13 0:1e597b0f8b3b 8
ovidiup13 0:1e597b0f8b3b 9 void Header::display(void){
ovidiup13 0:1e597b0f8b3b 10 //create strings
ovidiup13 2:fcde41900fa5 11 //char temp[7];
ovidiup13 2:fcde41900fa5 12 char level[5];
ovidiup13 2:fcde41900fa5 13 //char sign = ' ';
ovidiup13 0:1e597b0f8b3b 14 //set sign
ovidiup13 2:fcde41900fa5 15 //if(temp > 0) sign = 43;
ovidiup13 2:fcde41900fa5 16 //else if(temp < 0) sign = 45;
ovidiup13 0:1e597b0f8b3b 17
ovidiup13 0:1e597b0f8b3b 18 //strcat(temp, sign);
ovidiup13 0:1e597b0f8b3b 19
ovidiup13 0:1e597b0f8b3b 20 //convert to char array
ovidiup13 2:fcde41900fa5 21 //sprintf(temp, " %c%.1f%c", sign, degrees, scale);
ovidiup13 0:1e597b0f8b3b 22 sprintf(level, "%d%%", battery_level);
ovidiup13 0:1e597b0f8b3b 23
ovidiup13 0:1e597b0f8b3b 24 //add to header
ovidiup13 2:fcde41900fa5 25 st7565->drawstring(LEFT_MARGIN*5, 0, title);
ovidiup13 0:1e597b0f8b3b 26 st7565->drawstring(LCDWIDTH - LEFT_MARGIN*4, 0, level);
ovidiup13 0:1e597b0f8b3b 27
ovidiup13 0:1e597b0f8b3b 28 st7565->display();
ovidiup13 0:1e597b0f8b3b 29 }