Support library for the ESP8266 Wireless Terminal. Can also be used for communicating with any VT100-compatible terminal.
Diff: espterm.cpp
- Revision:
- 3:1114012184bf
- Parent:
- 1:09dfc9fd55f4
- Child:
- 4:294e8f53ebcd
--- a/espterm.cpp Mon Mar 06 22:32:37 2017 +0000 +++ b/espterm.cpp Sun Mar 19 10:34:48 2017 +0000 @@ -15,6 +15,8 @@ this->ser = new Serial(PA_2, PA_3, 115200); } +// ----- Printing ----- + int ESPTerm::printf(const char *format, ...) { @@ -37,6 +39,12 @@ return r; } +// print without args +int ESPTerm::puts(const char *str) +{ + return ser->puts(str); +} + int ESPTerm::println(const char *format, ...) { std::va_list arg; @@ -49,7 +57,10 @@ } -void ESPTerm::fg(ANSI_Color c) +// ----- Colors ----- + + +void ESPTerm::fg(Color c) { int ci = c; if(ci > 7) { @@ -61,7 +72,7 @@ } -void ESPTerm::bg(ANSI_Color c) +void ESPTerm::bg(Color c) { int ci = c; if(ci > 7) { @@ -73,7 +84,7 @@ } -void ESPTerm::colors(ANSI_Color fg, ANSI_Color bg) +void ESPTerm::colors(Color fg, Color bg) { this->fg(fg); this->bg(bg); @@ -93,6 +104,9 @@ } +// ----- Cursor control & erasing ----- + + void ESPTerm::go_to(int y, int x) { ser->printf("\033[%d;%dH", y, x); @@ -126,6 +140,9 @@ } +// ----- System commands ----- + + void ESPTerm::factory_reset(void) { ser->puts("\033]FR\a");