Latest revision
Fork of capstone_display by
display.cpp@1:b98cc52519e9, 2014-04-03 (annotated)
- Committer:
- ryanyuyu
- Date:
- Thu Apr 03 20:29:44 2014 +0000
- Revision:
- 1:b98cc52519e9
- Parent:
- 0:6846cd4549ba
Progress?
Who changed what in which revision?
User | Revision | Line number | New 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 | |
ryanyuyu | 1:b98cc52519e9 | 5 | |
ryanyuyu | 1:b98cc52519e9 | 6 | |
jmoffat | 0:6846cd4549ba | 7 | display::display(ST7735_LCD *disp) |
jmoffat | 0:6846cd4549ba | 8 | { |
jmoffat | 0:6846cd4549ba | 9 | lcd = disp; |
jmoffat | 0:6846cd4549ba | 10 | lcd->Initialize(); |
jmoffat | 0:6846cd4549ba | 11 | lcd->ClearScreen(); |
jmoffat | 0:6846cd4549ba | 12 | strength = " "; |
jmoffat | 0:6846cd4549ba | 13 | } |
jmoffat | 0:6846cd4549ba | 14 | void display::print(char *str) |
jmoffat | 0:6846cd4549ba | 15 | { |
jmoffat | 0:6846cd4549ba | 16 | lcd->SetFont( &TerminusFont ); |
jmoffat | 0:6846cd4549ba | 17 | lcd->SetForeground(COLOR_BLACK); |
jmoffat | 0:6846cd4549ba | 18 | lcd->Print(strength, CENTER, 50); |
jmoffat | 0:6846cd4549ba | 19 | strength = str; |
jmoffat | 0:6846cd4549ba | 20 | lcd->SetForeground(COLOR_WHITE); |
jmoffat | 0:6846cd4549ba | 21 | lcd->Print(str, CENTER, 50); |
jmoffat | 0:6846cd4549ba | 22 | } |
jmoffat | 0:6846cd4549ba | 23 | void display::printrb(const char *str) |
jmoffat | 0:6846cd4549ba | 24 | { |
jmoffat | 0:6846cd4549ba | 25 | lcd->SetForeground(COLOR_RED); |
jmoffat | 0:6846cd4549ba | 26 | lcd->Print(str, CENTER, 0); |
jmoffat | 0:6846cd4549ba | 27 | lcd->SetForeground(COLOR_CYAN); |
jmoffat | 0:6846cd4549ba | 28 | lcd->Print(str, CENTER, 25); |
jmoffat | 0:6846cd4549ba | 29 | lcd->SetForeground(COLOR_YELLOW); |
jmoffat | 0:6846cd4549ba | 30 | lcd->Print(str, CENTER, 50); |
jmoffat | 0:6846cd4549ba | 31 | lcd->SetForeground(COLOR_GREEN); |
jmoffat | 0:6846cd4549ba | 32 | lcd->Print(str, CENTER, 75); |
jmoffat | 0:6846cd4549ba | 33 | |
jmoffat | 0:6846cd4549ba | 34 | |
jmoffat | 0:6846cd4549ba | 35 | |
jmoffat | 0:6846cd4549ba | 36 | } |
jmoffat | 0:6846cd4549ba | 37 | void display::blinktext(const char *str) |
jmoffat | 0:6846cd4549ba | 38 | { |
jmoffat | 0:6846cd4549ba | 39 | lcd->SetForeground(COLOR_GREEN); |
jmoffat | 0:6846cd4549ba | 40 | wait(1); |
jmoffat | 0:6846cd4549ba | 41 | lcd->Print(str, CENTER, 55); |
jmoffat | 0:6846cd4549ba | 42 | lcd->SetForeground(COLOR_BLACK); |
jmoffat | 0:6846cd4549ba | 43 | wait(1); |
jmoffat | 0:6846cd4549ba | 44 | lcd->Print(str, CENTER, 55); |
jmoffat | 0:6846cd4549ba | 45 | } |
jmoffat | 0:6846cd4549ba | 46 | |
jmoffat | 0:6846cd4549ba | 47 | void display::displayStr(double dNewStrength) |
jmoffat | 0:6846cd4549ba | 48 | { |
jmoffat | 0:6846cd4549ba | 49 | lcd->SetForeground(COLOR_BLACK); |
jmoffat | 0:6846cd4549ba | 50 | // lcd->Print("Strength: "+strength, CENTER, 25); |
jmoffat | 0:6846cd4549ba | 51 | //strength = to_string(dNewStrength); |
jmoffat | 0:6846cd4549ba | 52 | lcd->SetForeground(COLOR_WHITE); |
jmoffat | 0:6846cd4549ba | 53 | //lcd->Print("Strength: "+newstr, CENTER, 25); |
jmoffat | 0:6846cd4549ba | 54 | } |