| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpc_colors.h
Go to the documentation of this file.
1 /*
2 * @brief SWIM color definitions and palette table setup
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #ifndef __LPC_COLOR_H_
33 #define __LPC_COLOR_H_
34
35 #include "lpc_types.h"
36
37 #if defined(__cplusplus)
38 extern "C"
39 {
40 #endif
41
63 #ifndef COLORS_DEF
64 //#define COLORS_DEF 24 /* 24-bit 888 color mode */
65 #define COLORS_DEF 16 /* 16-bit 565 color mode */
66 // #define COLORS_DEF 15 /* 15-bit 555 color mode */
67 // #define COLORS_DEF 12 /* 12-bit 444 color mode */
68 // #define COLORS_DEF 8 /* 8-bit color mode */
69 #endif
70
71 #if defined(COLORS_DEF)
72 #ifndef COLORS_8_565_MODE
73
75 #define COLORS_8_565_MODE
76 #endif
77 #endif
78
79 #if COLORS_DEF == 24
80 /* Black color, 888 mode */
81 #define BLACK 0x000000
82 /* Light gray color, 888 mode */
83 #define LIGHTGRAY 0x545454
84 /* Dark gray color, 888 mode */
85 #define DARKGRAY 0xA8A8A8
86 /* White color, 888 mode */
87 #define WHITE 0xFFFFFF
88 /* Red color, 888 mode */
89 #define RED 0xFF0000
90 /* Green color, 888 mode */
91 #define GREEN 0x00FF00
92 /* Blue color, 888 mode */
93 #define BLUE 0x0000FF
94
95 /* Light red color, 888 mode */
96 #define LIGHTRED 0x3F0000
97 /* Light green color, 888 mode */
98 #define LIGHTGREEN 0x003F00
99 /* Light blue color, 888 mode */
100 #define LIGHTBLUE 0x00003F
101
102 /* Minimum red color, 888 mode */
103 #define MINRED 0x010000
104 /* Light green color, 888 mode */
105 #define MINGREEN 0x000100
106 /* Light blue color, 888 mode */
107 #define MINBLUE 0x000001
108
109 /* Red color mask, 888 mode */
110 #define REDMASK 0xFF0000
111 /* Red shift value, 888 mode */
112 #define REDSHIFT 16
113 /* Green color mask, 888 mode */
114 #define GREENMASK 0x00FF00
115 /* Green shift value, 888 mode */
116 #define GREENSHIFT 8
117 /* Blue color mask, 888 mode */
118 #define BLUEMASK 0x0000FF
119 /* Blue shift value, 888 mode */
120 #define BLUESHIFT 0
121
122 /* Number of colors in 888 mode */
123 #define NUM_COLORS 16777216
124 /* Number of red colors in 888 mode */
125 #define RED_COLORS 0x100
126 /* Number of green colors in 888 mode */
127 #define GREEN_COLORS 0x100
128 /* Number of blue colors in 888 mode */
129 #define BLUE_COLORS 0x100
130
131 /* Color type is a 16-bit value */
132 typedef uint32_t COLOR_T;
133 #endif
134
135 #if COLORS_DEF == 16
136 /* Black color, 565 mode */
137 #define BLACK 0x0000
138 /* Light gray color, 565 mode */
139 #define LIGHTGRAY 0X7BEF
140 /* Dark gray color, 565 mode */
141 #define DARKGRAY 0x39E7
142 /* White color, 565 mode */
143 #define WHITE 0xffff
144 /* Red color, 565 mode */
145 #define RED 0xF800
146 /* Green color, 565 mode */
147 #define GREEN 0x07E0
148 /* Blue color, 565 mode */
149 #define BLUE 0x001F
150
151 /* Light red color, 565 mode */
152 #define LIGHTRED 0x7800
153 /* Light green color, 565 mode */
154 #define LIGHTGREEN 0x03E0
155 /* Light blue color, 565 mode */
156 #define LIGHTBLUE 0x000F
157
158 /* Minimum red color, 565 mode */
159 #define MINRED 0x0800
160 /* Light green color, 565 mode */
161 #define MINGREEN 0x0020
162 /* Light blue color, 565 mode */
163 #define MINBLUE 0x0001
164
165 /* Red color mask, 565 mode */
166 #define REDMASK 0xF800
167 /* Red shift value, 565 mode */
168 #define REDSHIFT 11
169 /* Green color mask, 565 mode */
170 #define GREENMASK 0x07E0
171 /* Green shift value, 565 mode */
172 #define GREENSHIFT 5
173 /* Blue color mask, 565 mode */
174 #define BLUEMASK 0x001F
175 /* Blue shift value, 565 mode */
176 #define BLUESHIFT 0
177
178 /* Number of colors in 565 mode */
179 #define NUM_COLORS 65536
180 /* Number of red colors in 565 mode */
181 #define RED_COLORS 0x20
182 /* Number of green colors in 565 mode */
183 #define GREEN_COLORS 0x40
184 /* Number of blue colors in 565 mode */
185 #define BLUE_COLORS 0x20
186
187 /* Color type is a 16-bit value */
188 typedef uint16_t COLOR_T;
189 #endif
190
191 #if COLORS_DEF == 15
192 /* Black color, 555 mode */
193 #define BLACK 0x0000
194 /* Llight gray color, 555 mode */
195 #define LIGHTGRAY 0x3DEF
196 /* Drak gray color, 555 mode */
197 #define DARKGRAY 0x1CE7
198 /* White color, 555 mode */
199 #define WHITE 0xffff
200 /* Red color, 555 mode */
201 #define RED 0x7C00
202 /* Green color, 555 mode */
203 #define GREEN 0x03E0
204 /* Blue color, 555 mode */
205 #define BLUE 0x001F
206 /* Magenta color, 555 mode */
207 #define MAGENTA (RED | BLUE)
208 /* Cyan color, 555 mode */
209 #define CYAN (GREEN | BLUE)
210 /* Yellow color, 555 mode */
211 #define YELLOW (RED | GREEN)
212 /* Light red color, 555 mode */
213 #define LIGHTRED 0x3C00
214 /* Light green color, 555 mode */
215 #define LIGHTGREEN 0x01E0
216 /* Light blue color, 555 mode */
217 #define LIGHTBLUE 0x000F
218 /* Light magenta color, 555 mode */
219 #define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE)
220 /* Light cyan color, 555 mode */
221 #define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE)
222 /* Light yellow color, 555 mode */
223 #define LIGHTYELLOW (LIGHTRED | LIGHTGREEN)
224
225 /* Red color mask, 555 mode */
226 #define REDMASK 0x7C00
227 /* Red shift value, 555 mode */
228 #define REDSHIFT 10
229 /* Green color mask, 555 mode */
230 #define GREENMASK 0x03E0
231 /* Green shift value, 555 mode */
232 #define GREENSHIFT 5
233 /* Blue color mask, 555 mode */
234 #define BLUEMASK 0x001F
235 /* Blue shift value, 555 mode */
236 #define BLUESHIFT 0
237
238 /* Number of colors in 555 mode */
239 #define NUM_COLORS 32768
240 /* Number of red colors in 555 mode */
241 #define RED_COLORS 0x20
242 /* Number of green colors in 555 mode */
243 #define GREEN_COLORS 0x20
244 /* Number of blue colors in 555 mode */
245 #define BLUE_COLORS 0x20
246
247 /* Color type is a 16-bit value */
248 typedef uint16_t COLOR_T;
249 #endif
250
251 #if COLORS_DEF == 12
252 /* Black color, 444 mode */
253 #define BLACK 0x0000
254 /* Llight gray color, 444 mode */
255 #define LIGHTGRAY 0x3DEF
256 /* Drak gray color, 444 mode */
257 #define DARKGRAY 0x1CE7
258 /* White color, 444 mode */
259 #define WHITE 0x7fff
260 /* Red color, 444 mode */
261 #define RED 0x3C00
262 /* Green color, 444 mode */
263 #define GREEN 0x01E0
264 /* Blue color, 444 mode */
265 #define BLUE 0x000F
266 /* Magenta color, 444 mode */
267 #define MAGENTA (RED | BLUE)
268 /* Cyan color, 444 mode */
269 #define CYAN (GREEN | BLUE)
270 /* Yellow color, 444 mode */
271 #define YELLOW (RED | GREEN)
272 /* Light red color, 444 mode */
273 #define LIGHTRED 0x3C00
274 /* Light green color, 444 mode */
275 #define LIGHTGREEN 0x01E0
276 /* Light blue color, 444 mode */
277 #define LIGHTBLUE 0x000F
278 /* Light magenta color, 444 mode */
279 #define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE)
280 /* Light cyan color, 444 mode */
281 #define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE)
282 /* Light yellow color, 444 mode */
283 #define LIGHTYELLOW (LIGHTRED | LIGHTGREEN)
284
285 /* Red color mask, 444 mode */
286 #define REDMASK 0x3C00
287 /* Red shift value, 444 mode */
288 #define REDSHIFT 10
289 /* Green color mask, 444 mode */
290 #define GREENMASK 0x01E0
291 /* Green shift value, 444 mode */
292 #define GREENSHIFT 5
293 /* Blue color mask, 444 mode */
294 #define BLUEMASK 0x000F
295 /* Blue shift value, 444 mode */
296 #define BLUESHIFT 0
297
298 /* Number of colors in 444 mode */
299 #define NUM_COLORS 4096
300 /* Number of red colors in 444 mode */
301 #define RED_COLORS 0x10
302 /* Number of green colors in 444 mode */
303 #define GREEN_COLORS 0x10
304 /* Number of blue colors in 444 mode */
305 #define BLUE_COLORS 0x10
306
307 /* Color type is a 16-bit value */
308 typedef uint16_t COLOR_T;
309 #endif
310
311 #if COLORS_DEF == 8
312 /* Black color, 323 mode */
313 #define BLACK 0x00
314 /* Light gray color, 323 mode */
315 #define LIGHTGRAY 0x6E
316 /* Dark gray color, 323 mode */
317 #define DARKGRAY 0x25
318 /* White color, 323 mode */
319 #define WHITE 0xFF
320 /* Red color, 323 mode */
321 #define RED 0xE0
322 /* Green color, 323 mode */
323 #define GREEN 0x1C
324 /* Blue color, 323 mode */
325 #define BLUE 0x03
326 /* Magenta color, 323 mode */
327 #define MAGENTA (RED | BLUE)
328 /* Cyan color, 323 mode */
329 #define CYAN (GREEN | BLUE)
330 /* Yellow color, 323 mode */
331 #define YELLOW (RED | GREEN)
332 /* Light red color, 323 mode */
333 #define LIGHTRED 0x60
334 /* Light green color, 323 mode */
335 #define LIGHTGREEN 0x0C
336 /* Light blue color, 323 mode */
337 #define LIGHTBLUE 0x01
338 /* Light magenta color, 323 mode */
339 #define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE)
340 /* Light cyan color, 323 mode */
341 #define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE)
342 /* Light yellow color, 323 mode */
343 #define LIGHTYELLOW (LIGHTRED | LIGHTGREEN)
344
345 /* Red color mask, 323 mode */
346 #define REDMASK 0xE0
347 /* Red shift value, 323 mode */
348 #define REDSHIFT 5
349 /* Green color mask, 323 mode */
350 #define GREENMASK 0x1C
351 /* Green shift value, 323 mode */
352 #define GREENSHIFT 2
353 /* Blue color mask, 323 mode */
354 #define BLUEMASK 0x3
355 /* Blue shift value, 323 mode */
356 #define BLUESHIFT 0
357
358 /* Number of colors in 332 mode */
359 #define NUM_COLORS 256
360 /* Number of red colors in 332 mode */
361 #define RED_COLORS 0x08
362 /* Number of green colors in 332 mode */
363 #define GREEN_COLORS 0x08
364 /* Number of blue colors in 332 mode */
365 #define BLUE_COLORS 0x08
366
367 /* Color type is a 8-bit value */
368 typedef uint8_t COLOR_T;
369 #endif
370
382 void lpc_colors_set_palette(uint16_t *palette_table);
383
388 #if defined(__cplusplus)
389 }
390 #endif /*__cplusplus */
391
392 #endif /* __LPC_COLOR_H_ */