Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of capstone_display by
display.cpp
00001 #include "st7735.h" 00002 #include "display.h" 00003 #include "mbed.h" 00004 /** 00005 *See display.h for instructions for functions. 00006 */ 00007 display::display(ST7735_LCD *disp) 00008 { 00009 lcd = disp; 00010 lcd->Initialize(); 00011 lcd->ClearScreen(); 00012 00013 } 00014 void display::print(char *str) 00015 { 00016 //lcd->ClearScreen(); 00017 lcd->SetFont( &TerminusFont ); 00018 lcd->SetForeground(COLOR_BLACK); 00019 lcd->Print(debugstr, CENTER, 50); 00020 debugstr = str; 00021 lcd->SetForeground(COLOR_WHITE); 00022 lcd->Print(str, CENTER, 50); 00023 } 00024 void display::printrb(const char *str) 00025 { 00026 lcd->SetForeground(COLOR_RED); 00027 lcd->Print(str, CENTER, 0); 00028 lcd->SetForeground(COLOR_CYAN); 00029 lcd->Print(str, CENTER, 25); 00030 lcd->SetForeground(COLOR_YELLOW); 00031 lcd->Print(str, CENTER, 50); 00032 lcd->SetForeground(COLOR_GREEN); 00033 lcd->Print(str, CENTER, 75); 00034 00035 00036 00037 } 00038 void display::blinktext(const char *str) 00039 { 00040 lcd->SetForeground(COLOR_GREEN); 00041 wait(1); 00042 lcd->Print(str, CENTER, 55); 00043 lcd->SetForeground(COLOR_BLACK); 00044 wait(1); 00045 lcd->Print(str, CENTER, 55); 00046 } 00047 00048 void display::displayStr(char *newStrength) 00049 { 00050 //lcd->ClearScreen(); 00051 lcd->SetForeground(COLOR_BLACK);//Set to black to overwrite old text. 00052 lcd->Print("Strength: ", LEFT, 25);//Overwrite old text. 00053 lcd->Print(strength, CENTER, 25); 00054 strength = newStrength;//Store new text for overwriting later. 00055 lcd->SetForeground(COLOR_WHITE);//Set to white for printing. 00056 lcd->Print("Strength: ", LEFT, 25);//Print. 00057 lcd->Print(strength, CENTER, 25); 00058 00059 } 00060 00061 void display::displayDist(char *newDist)//Works identically to above. 00062 { 00063 //lcd->ClearScreen(); 00064 lcd->SetForeground(COLOR_BLACK); 00065 lcd->Print("Dist: ", LEFT, 75); 00066 lcd->Print(dist, CENTER, 75); 00067 dist = newDist; 00068 lcd->SetForeground(COLOR_WHITE); 00069 lcd->Print("Dist: ", LEFT, 75); 00070 lcd->Print(dist, CENTER, 75); 00071 00072 } 00073 void display::calibrationdist(char *str) 00074 { 00075 lcd->ClearScreen(); 00076 lcd->SetForeground(COLOR_RED); 00077 lcd->Print("CALIBRATION", CENTER, 25); 00078 lcd->SetForeground(COLOR_WHITE); 00079 lcd->Print("Place beacon: ", LEFT, 50); 00080 lcd->Print(str, RIGHT, 50); 00081 lcd->Print("Then press button", LEFT, 75); 00082 00083 00084 } 00085 void display::calibrationunl(void) 00086 { 00087 lcd->ClearScreen(); 00088 lcd->SetForeground(COLOR_RED); 00089 lcd->Print("CALIBRATION", CENTER, 25); 00090 lcd->SetForeground(COLOR_WHITE); 00091 lcd->Print("Turn off Beacon", LEFT, 50); 00092 lcd->Print("Then press button", LEFT, 75); 00093 lcd->Print("Hold button to skip.", LEFT, 90); 00094 00095 00096 } 00097 void display::clearscreen(void) 00098 { 00099 lcd->ClearScreen(); 00100 00101 }
Generated on Tue Jul 26 2022 20:07:42 by
