Latest revision

Dependencies:   TFTLCD

Fork of capstone_display by James Moffat

Committer:
jmoffat
Date:
Thu Apr 03 20:24:36 2014 +0000
Revision:
2:a6f341df1ef1
Parent:
0:6846cd4549ba
Child:
3:c3231b95aff0
Mostly finished. Have added the functions for displaying strength and dist, though minor mods may be needed. Also need to add calibration screens.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmoffat 0:6846cd4549ba 1 #include "st7735.h"
jmoffat 0:6846cd4549ba 2 #include "display.h"
jmoffat 0:6846cd4549ba 3 #include "mbed.h"
jmoffat 0:6846cd4549ba 4
jmoffat 0:6846cd4549ba 5 display::display(ST7735_LCD *disp)
jmoffat 0:6846cd4549ba 6 {
jmoffat 0:6846cd4549ba 7 lcd = disp;
jmoffat 0:6846cd4549ba 8 lcd->Initialize();
jmoffat 0:6846cd4549ba 9 lcd->ClearScreen();
jmoffat 2:a6f341df1ef1 10
jmoffat 0:6846cd4549ba 11 }
jmoffat 0:6846cd4549ba 12 void display::print(char *str)
jmoffat 0:6846cd4549ba 13 {
jmoffat 0:6846cd4549ba 14 lcd->SetFont( &TerminusFont );
jmoffat 0:6846cd4549ba 15 lcd->SetForeground(COLOR_BLACK);
jmoffat 2:a6f341df1ef1 16 lcd->Print(debugstr, CENTER, 50);
jmoffat 2:a6f341df1ef1 17 debugstr = str;
jmoffat 0:6846cd4549ba 18 lcd->SetForeground(COLOR_WHITE);
jmoffat 0:6846cd4549ba 19 lcd->Print(str, CENTER, 50);
jmoffat 0:6846cd4549ba 20 }
jmoffat 0:6846cd4549ba 21 void display::printrb(const char *str)
jmoffat 0:6846cd4549ba 22 {
jmoffat 0:6846cd4549ba 23 lcd->SetForeground(COLOR_RED);
jmoffat 0:6846cd4549ba 24 lcd->Print(str, CENTER, 0);
jmoffat 0:6846cd4549ba 25 lcd->SetForeground(COLOR_CYAN);
jmoffat 0:6846cd4549ba 26 lcd->Print(str, CENTER, 25);
jmoffat 0:6846cd4549ba 27 lcd->SetForeground(COLOR_YELLOW);
jmoffat 0:6846cd4549ba 28 lcd->Print(str, CENTER, 50);
jmoffat 0:6846cd4549ba 29 lcd->SetForeground(COLOR_GREEN);
jmoffat 0:6846cd4549ba 30 lcd->Print(str, CENTER, 75);
jmoffat 0:6846cd4549ba 31
jmoffat 0:6846cd4549ba 32
jmoffat 0:6846cd4549ba 33
jmoffat 0:6846cd4549ba 34 }
jmoffat 0:6846cd4549ba 35 void display::blinktext(const char *str)
jmoffat 0:6846cd4549ba 36 {
jmoffat 0:6846cd4549ba 37 lcd->SetForeground(COLOR_GREEN);
jmoffat 0:6846cd4549ba 38 wait(1);
jmoffat 0:6846cd4549ba 39 lcd->Print(str, CENTER, 55);
jmoffat 0:6846cd4549ba 40 lcd->SetForeground(COLOR_BLACK);
jmoffat 0:6846cd4549ba 41 wait(1);
jmoffat 0:6846cd4549ba 42 lcd->Print(str, CENTER, 55);
jmoffat 0:6846cd4549ba 43 }
jmoffat 0:6846cd4549ba 44
jmoffat 2:a6f341df1ef1 45 void display::displayStr(char *newStrength)
jmoffat 0:6846cd4549ba 46 {
jmoffat 0:6846cd4549ba 47 lcd->SetForeground(COLOR_BLACK);
jmoffat 2:a6f341df1ef1 48 lcd->Print("Strength: ", LEFT, 25);
jmoffat 2:a6f341df1ef1 49 lcd->Print(strength, CENTER, 25);
jmoffat 2:a6f341df1ef1 50 strength = newStrength;
jmoffat 0:6846cd4549ba 51 lcd->SetForeground(COLOR_WHITE);
jmoffat 2:a6f341df1ef1 52 lcd->Print("Strength: ", LEFT, 25);
jmoffat 2:a6f341df1ef1 53 lcd->Print(strength, CENTER, 25);
jmoffat 2:a6f341df1ef1 54
jmoffat 2:a6f341df1ef1 55 }
jmoffat 2:a6f341df1ef1 56
jmoffat 2:a6f341df1ef1 57 void display::displayDist(char *newDist)
jmoffat 2:a6f341df1ef1 58 {
jmoffat 2:a6f341df1ef1 59 lcd->SetForeground(COLOR_BLACK);
jmoffat 2:a6f341df1ef1 60 lcd->Print("Dist: ", LEFT, 75);
jmoffat 2:a6f341df1ef1 61 lcd->Print(dist, CENTER, 75);
jmoffat 2:a6f341df1ef1 62 dist = newDist;
jmoffat 2:a6f341df1ef1 63 lcd->SetForeground(COLOR_WHITE);
jmoffat 2:a6f341df1ef1 64 lcd->Print("Dist: ", LEFT, 75);
jmoffat 2:a6f341df1ef1 65 lcd->Print(dist, CENTER, 75);
jmoffat 2:a6f341df1ef1 66
jmoffat 0:6846cd4549ba 67
jmoffat 0:6846cd4549ba 68 }