@@ -13,21 +13,20 @@ Arduino library with basic ANSI display codes for terminal applications.
1313
1414# Description
1515
16- ANSI codes are special codes that are send to a terminal e.g. VT100 to add
17- attributes to displayed characters.
18- Typical examples are bold, blink or colour.
19- Also known as escape codes the set of codes is large, however not
20- all terminal types do support all codes.
16+ ANSI codes are special codes that are send to a terminal e.g. VT100 to add
17+ attributes to displayed characters.
18+ Typical examples are bold, blink or colour. ANSI codes are also known as escape codes.
19+ The set of codes is large, however not all terminal types do support all codes.
2120
2221Sending these ANSI codes to a simple ASCII only terminal like the one in the Arduino
2322IDE might result in garbage. So use with care.
2423
2524
2625## Terminals tested
2726
28- Tests are done with
27+ Tests are done with
2928- TeraTerm 4.102 + 4.106 (VT100, VT202, VT525 mode)
30- - Putty 0.71
29+ - Putty 0.71
3130
3231Other terminal program's exist so please let me know if yours is working too.
3332If not, please open an issue.
@@ -38,33 +37,114 @@ If not, please open an issue.
3837See examples
3938
4039
41- ## Performance
40+ ## Interface
41+
42+ ``` cpp
43+ #include " ansi.h"
44+ ```
45+
46+ #### Constructor
47+
48+ - ** ANSI(Stream \* stream = &Serial)** wrapper around Serial.
49+ Can be a software serial too.
50+
51+
52+ #### Stream interface
53+
54+ - ** int available()**
55+ - ** int read()**
56+ - ** int peek()**
57+ - ** void flush()**
58+
59+ Stream interface also includes print(), println(), write().
60+
61+
62+ #### Character modi
63+
64+ - ** void normal()** idem.
65+ - ** void bold()** idem.
66+ - ** void low()** idem.
67+ - ** void underline()** idem.
68+ - ** void blink()** idem.
69+ - ** void reverse()** idem.
70+
71+
72+ #### Colour
73+
74+ - ** void foreground(uint8_t fgcolor)**
75+ - ** void background(uint8_t bgcolor)**
76+ - ** void color(uint8_t fgcolor, uint8_t bgcolor)**
77+ - ** uint8_t gray2color(uint8_t gray)**
78+ - ** uint8_t grey2color(uint8_t grey)** idem
79+ - ** uint8_t rgb2color(uint8_t r, uint8_t g, uint8_t b)**
80+
81+
82+ todo colour table
4283
43- Since 0.1.5 there is some focus on performance.
44- Using ** ansi.print()** and ** ansi.println()** for printing text and numbers is
45- improved a bit since 0.1.4 by adding the private ** write(array, length)** .
4684
85+ #### Positioning
4786
48- ## Experimental 0.1.6
87+ - ** void clearScreen()**
88+ - ** void clearLine(uint8_t clear = toEnd)** toEnd = 0,
89+ toStart = 1,en tireLine = 2,
90+ - ** void home()** go to 0,0
91+ - ** void gotoXY(uint8_t x, uint8_t y)**
92+ - ** void cursorUp(uint8_t x)**
93+ - ** void cursorDown(uint8_t x)**
94+ - ** void cursorForward(uint8_t x)**
95+ - ** void cursorBack(uint8_t x)**
96+
97+
98+ #### Experimental
99+
100+ look into ** ansi.h** for experimental functions and notes.
49101
50102Version 0.1.6 added a number of experimental function that need more testing.
51- Some are working, others are unclear, but the user can uncomment these and
52- experiment with them if needed.
103+ Some are working with Teraterm , others are unclear of fail.
104+ The user can uncomment these and verify if these work with their terminal.
53105
54- Also added is the ** int deviceType()** function which also need more testing
106+ Also added is the ** int deviceType()** function which also need more testing.
55107
56108As always, constructive feedback is welcome.
57109
58110
111+ ## Performance
112+
113+ Since 0.1.5 there is some focus on performance.
114+ Using ** ansi.print()** and ** ansi.println()** for printing text and numbers is
115+ improved a bit since 0.1.4 by adding the private ** write(array, length)** .
116+
117+
59118## Future
60119
120+ #### Must
121+
122+ - improve documentation
123+ - elaborate interface
124+ - colour info
125+
126+ #### Should
127+
128+ - test experimental functions
61129- test more terminal programs (Linux mac)
62- - write more examples
130+ - add examples
63131 - DOS emulator?
132+ - experimental section
133+
134+ #### Could
135+
64136- increase functionality
65- - which codes are useful ?
66- - investigate performance. (first step made in 0.1.5 but more possible)
137+ - which codes are generic / useful ?
138+ - investigate performance.
139+ - first step made in 0.1.5 but more possible
67140 - add line buffer in write(c) to improve throughput?
68141 - need for flush() with line buffer?
69142 - rewrite functions, replace print() by ** \_ stream->write()** calls? (effect on size?)
143+ - move static strings to PROGMEM? as defines?
144+ roughly ~ 20 bytes progmem for 4 bytes RAM...
145+ - print(char) iso print(string) where possible
146+
147+
148+ #### Wont
149+
70150
0 commit comments