Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / LUFA / Drivers / Misc / TerminalCodes.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * ANSI terminal compatible escape sequences. These escape sequences are designed to be concatenated with existing
34 * strings to modify their display on a compatible terminal application.
35 *
36 * \note If desired, the macro DISABLE_TERMINAL_CODES can be defined in the project makefile and passed to the GCC
37 * compiler via the -D switch to disable the terminal codes without modifying the source, for use with non
38 * compatible terminals (any terminal code then equate to empty strings).
39 *
40 * Example Usage:
41 * \code
42 * printf("Some String, " ESC_BOLD_ON " Some bold string");
43 * \endcode
44 */
45
46 /** \ingroup Group_MiscDrivers
47 * @defgroup Group_Terminal ANSI Terminal Escape Codes - LUFA/Drivers/Misc/TerminalCodes.h
48 *
49 * Escape code macros for ANSI compliant text terminals.
50 *
51 * @{
52 */
53
54 #ifndef __TERMINALCODES_H__
55 #define __TERMINALCODES_H__
56
57 /* Public Interface - May be used in end-application: */
58 /* Macros: */
59 #if !defined(DISABLE_TERMINAL_CODES)
60 /** Creates an ANSII escape sequence with the payload specified by "c". */
61 #define ANSI_ESCAPE_SEQUENCE(c) "\33[" c
62 #else
63 #define ANSI_ESCAPE_SEQUENCE(c)
64 #endif
65
66 /** Resets any escape sequence modifiers back to their defaults. */
67 #define ESC_RESET ANSI_ESCAPE_SEQUENCE("0m")
68
69 /** Turns on bold so that any following text is printed to the terminal in bold. */
70 #define ESC_BOLD_ON ANSI_ESCAPE_SEQUENCE("1m")
71
72 /** Turns on italics so that any following text is printed to the terminal in italics. */
73 #define ESC_ITALICS_ON ANSI_ESCAPE_SEQUENCE("3m")
74
75 /** Turns on underline so that any following text is printed to the terminal underlined. */
76 #define ESC_UNDERLINE_ON ANSI_ESCAPE_SEQUENCE("4m")
77
78 /** Turns on inverse so that any following text is printed to the terminal in inverted colours. */
79 #define ESC_INVERSE_ON ANSI_ESCAPE_SEQUENCE("7m")
80
81 /** Turns on strikethrough so that any following text is printed to the terminal with a line through the
82 * center.
83 */
84 #define ESC_STRIKETHROUGH_ON ANSI_ESCAPE_SEQUENCE("9m")
85
86 /** Turns off bold so that any following text is printed to the terminal in non bold. */
87 #define ESC_BOLD_OFF ANSI_ESCAPE_SEQUENCE("22m")
88
89 /** Turns off italics so that any following text is printed to the terminal in non italics. */
90 #define ESC_ITALICS_OFF ANSI_ESCAPE_SEQUENCE("23m")
91
92 /** Turns off underline so that any following text is printed to the terminal non underlined. */
93 #define ESC_UNDERLINE_OFF ANSI_ESCAPE_SEQUENCE("24m")
94
95 /** Turns off inverse so that any following text is printed to the terminal in non inverted colours. */
96 #define ESC_INVERSE_OFF ANSI_ESCAPE_SEQUENCE("27m")
97
98 /** Turns off strikethrough so that any following text is printed to the terminal without a line through
99 * the center.
100 */
101 #define ESC_STRIKETHROUGH_OFF ANSI_ESCAPE_SEQUENCE("29m")
102
103 /** Sets the foreground (text) colour to black. */
104 #define ESC_FG_BLACK ANSI_ESCAPE_SEQUENCE("30m")
105
106 /** Sets the foreground (text) colour to red. */
107 #define ESC_FG_RED ANSI_ESCAPE_SEQUENCE("31m")
108
109 /** Sets the foreground (text) colour to green. */
110 #define ESC_FG_GREEN ANSI_ESCAPE_SEQUENCE("32m")
111
112 /** Sets the foreground (text) colour to yellow. */
113 #define ESC_FG_YELLOW ANSI_ESCAPE_SEQUENCE("33m")
114
115 /** Sets the foreground (text) colour to blue. */
116 #define ESC_FG_BLUE ANSI_ESCAPE_SEQUENCE("34m")
117
118 /** Sets the foreground (text) colour to magenta. */
119 #define ESC_FG_MAGENTA ANSI_ESCAPE_SEQUENCE("35m")
120
121 /** Sets the foreground (text) colour to cyan. */
122 #define ESC_FG_CYAN ANSI_ESCAPE_SEQUENCE("36m")
123
124 /** Sets the foreground (text) colour to white. */
125 #define ESC_FG_WHITE ANSI_ESCAPE_SEQUENCE("37m")
126
127 /** Sets the foreground (text) colour to the terminal's default. */
128 #define ESC_FG_DEFAULT ANSI_ESCAPE_SEQUENCE("39m")
129
130 /** Sets the text background colour to black. */
131 #define ESC_BG_BLACK ANSI_ESCAPE_SEQUENCE("40m")
132
133 /** Sets the text background colour to red. */
134 #define ESC_BG_RED ANSI_ESCAPE_SEQUENCE("41m")
135
136 /** Sets the text background colour to green. */
137 #define ESC_BG_GREEN ANSI_ESCAPE_SEQUENCE("42m")
138
139 /** Sets the text background colour to yellow. */
140 #define ESC_BG_YELLOW ANSI_ESCAPE_SEQUENCE("43m")
141
142 /** Sets the text background colour to blue. */
143 #define ESC_BG_BLUE ANSI_ESCAPE_SEQUENCE("44m")
144
145 /** Sets the text background colour to magenta. */
146 #define ESC_BG_MAGENTA ANSI_ESCAPE_SEQUENCE("45m")
147
148 /** Sets the text background colour to cyan. */
149 #define ESC_BG_CYAN ANSI_ESCAPE_SEQUENCE("46m")
150
151 /** Sets the text background colour to white. */
152 #define ESC_BG_WHITE ANSI_ESCAPE_SEQUENCE("47m")
153
154 /** Sets the text background colour to the terminal's default. */
155 #define ESC_BG_DEFAULT ANSI_ESCAPE_SEQUENCE("49m")
156
157 /** Sets the cursor position to the given line and column. */
158 #define ESC_CURSOR_POS(L, C) ANSI_ESCAPE_SEQUENCE(#L ";" #C "H")
159
160 /** Moves the cursor up the given number of lines. */
161 #define ESC_CURSOR_UP(L) ANSI_ESCAPE_SEQUENCE(#L "A")
162
163 /** Moves the cursor down the given number of lines. */
164 #define ESC_CURSOR_DOWN(L) ANSI_ESCAPE_SEQUENCE(#L "B")
165
166 /** Moves the cursor to the right the given number of columns. */
167 #define ESC_CURSOR_FORWARD(C) ANSI_ESCAPE_SEQUENCE(#C "C")
168
169 /** Moves the cursor to the left the given number of columns. */
170 #define ESC_CURSOR_BACKWARD(C) ANSI_ESCAPE_SEQUENCE(#C "D")
171
172 /** Saves the current cursor position so that it may be restored with ESC_CURSOR_POS_RESTORE. */
173 #define ESC_CURSOR_POS_SAVE ANSI_ESCAPE_SEQUENCE("s")
174
175 /** Restores the cursor position to the last position saved with ESC_CURSOR_POS_SAVE. */
176 #define ESC_CURSOR_POS_RESTORE ANSI_ESCAPE_SEQUENCE("u")
177
178 /** Erases the entire display, returning the cursor to the top left. */
179 #define ESC_ERASE_DISPLAY ANSI_ESCAPE_SEQUENCE("2J")
180
181 /** Erases the current line, returning the cursor to the far left. */
182 #define ESC_ERASE_LINE ANSI_ESCAPE_SEQUENCE("K")
183
184 #endif
185
186 /** @} */