My implementation of VT100 ESC-sequence utility
Dependents:
test_vt100
maze_vt100_MMA8451Q
funcgen
test_MAG3110
... more
« Back to documentation index
vt100 Class Reference
vt100 class Utility for handling text/letter on a terminal which can handle VT100 escape command sequence.
More...
#include <vt100.h >
Public Member Functions
vt100 (int baud=115200)
constructor
~vt100 (void)
destructor
void cls (void)
clear screen
void locate (int x, int y)
move cursor to (x, y)
void putChar (int x, int y, char c)
print a letter c at (x,y)
void putStr (int x, int y, char *str)
print a string str from (x,y)
void line (int x1, int y1, int x2, int y2, char c='*')
print a line of char
void frame (int x1, int y1, int x2, int y2)
print a text frame
void circle (int x0, int y0, int r, char c='*')
print a text circle the
letter to form the circle
int setFG (int newFG)
set foreground color
int getFG (void)
get current foreground color
int setBG (int newBG)
set background color
int getBG (void)
get current background color
void black (void)
set foreground color to black
void red (void)
set foreground color to red
void green (void)
set foreground color to green
void yellow (void)
set foreground color to yellow
void blue (void)
set foreground color to blue
void purple (void)
set foreground color to purple
void cian (void)
set foreground color to cian
void white (void)
set foreground color to white
Detailed Description
vt100 class Utility for handling text/letter on a terminal which can handle VT100 escape command sequence.
Example:
#include "mbed.h"
#include "vt100.h"
vt100 tty ;
int main() {
int count = 0 ;
tty.cls () ;
tty.black () ;
tty.frame (5, 5, 15, 9) ;
while (1) {
tty.locate (7, 7) ;
tty.setFG (count % 8) ;
printf("%d\r\n" , count++) ;
wait(1.0) ;
}
}
Note: I know there should be other libraries with similar functions, but I could not help writing one for myself anyway.
Definition at line 34 of file vt100.h .
Constructor & Destructor Documentation
vt100
(
int
baud = 115200
)
constructor
Parameters:
Definition at line 16 of file vt100.cpp .
Member Function Documentation
set foreground color to black
Definition at line 178 of file vt100.cpp .
set foreground color to blue
Definition at line 198 of file vt100.cpp .
set foreground color to cian
Definition at line 208 of file vt100.cpp .
void circle
(
int
x0 ,
int
y0 ,
int
r ,
char
c = '*'
)
print a text circle the
letter to form the circle
Parameters:
x0 center column
y1 center row
r radius
Definition at line 120 of file vt100.cpp .
void frame
(
int
x1 ,
int
y1 ,
int
x2 ,
int
y2
)
print a text frame
Parameters:
x1 left column
y1 top row
x2 right column
y2 bottom row
Definition at line 91 of file vt100.cpp .
get current background color
Returns: current background color
Definition at line 173 of file vt100.cpp .
get current foreground color
Returns: current foreground color
Definition at line 161 of file vt100.cpp .
set foreground color to green
Definition at line 188 of file vt100.cpp .
void line
(
int
x1 ,
int
y1 ,
int
x2 ,
int
y2 ,
char
c = '*'
)
print a line of char
Parameters:
c the letter to form the line
x1 starting column
y1 starting row
x2 ending column
y2 ending row
Definition at line 49 of file vt100.cpp .
void locate
(
int
x ,
int
y
)
move cursor to (x, y)
Parameters:
x start column of the next letter
y start row of the next letter
Note: no value checking is performed.
Definition at line 32 of file vt100.cpp .
set foreground color to purple
Definition at line 203 of file vt100.cpp .
void putChar
(
int
x ,
int
y ,
char
c
)
print a letter c at (x,y)
Parameters:
c the letter to be written
x column of the letter
y row of the letter
Definition at line 37 of file vt100.cpp .
void putStr
(
int
x ,
int
y ,
char *
str
)
print a string str from (x,y)
Parameters:
*str c-style string to be written
x column of the first letter
y row of the first letter
Definition at line 43 of file vt100.cpp .
set foreground color to red
Definition at line 183 of file vt100.cpp .
set background color
Parameters:
newBG new background color
Returns: previous background color
Definition at line 166 of file vt100.cpp .
set foreground color
Parameters:
newFG new foreground color
Returns: previous foreground color
Note: 0 BLACK
1 RED
2 GREEN
3 YELLOW
4 BLUE
5 PURPLE
6 CIAN
7 WHITE
Definition at line 153 of file vt100.cpp .
set foreground color to white
Definition at line 213 of file vt100.cpp .
set foreground color to yellow
Definition at line 193 of file vt100.cpp .