A basic graphics package for the LPC4088 Display Module.
Dependents: lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more
Fork of DMBasicGUI by
lpc_colors.h
00001 /* 00002 * @brief SWIM color definitions and palette table setup 00003 * 00004 * @note 00005 * Copyright(C) NXP Semiconductors, 2012 00006 * All rights reserved. 00007 * 00008 * @par 00009 * Software that is described herein is for illustrative purposes only 00010 * which provides customers with programming information regarding the 00011 * LPC products. This software is supplied "AS IS" without any warranties of 00012 * any kind, and NXP Semiconductors and its licensor disclaim any and 00013 * all warranties, express or implied, including all implied warranties of 00014 * merchantability, fitness for a particular purpose and non-infringement of 00015 * intellectual property rights. NXP Semiconductors assumes no responsibility 00016 * or liability for the use of the software, conveys no license or rights under any 00017 * patent, copyright, mask work right, or any other intellectual property rights in 00018 * or to any products. NXP Semiconductors reserves the right to make changes 00019 * in the software without notification. NXP Semiconductors also makes no 00020 * representation or warranty that such application will be suitable for the 00021 * specified use without further testing or modification. 00022 * 00023 * @par 00024 * Permission to use, copy, modify, and distribute this software and its 00025 * documentation is hereby granted, under NXP Semiconductors' and its 00026 * licensor's relevant copyrights in the software, without fee, provided that it 00027 * is used in conjunction with NXP Semiconductors microcontrollers. This 00028 * copyright, permission, and disclaimer notice must appear in all copies of 00029 * this code. 00030 */ 00031 00032 #ifndef __LPC_COLOR_H_ 00033 #define __LPC_COLOR_H_ 00034 00035 #include "lpc_types.h" 00036 00037 #if defined(__cplusplus) 00038 extern "C" 00039 { 00040 #endif 00041 00042 /** @defgroup GUI_SWIM_COLORS SWIM color definitions 00043 * @ingroup GUI_SWIM 00044 * The Simple Windows Interface manager (SWIM) supports 8-bit RGB332, 00045 * 12-bit RGB 444 (in a 16-bit field), 15-bit RGB555, 16-bit RGB565, 00046 * and 24-bit RGB888 (in a 32-bit field) color. 00047 * 00048 * SWIM is configured for the color type at build-time based on the 00049 * the COLORS_DEF definitions. Select one of the following values to 00050 * configure SWIM. 00051 * 8-bit RGB332 : COLORS_DEF = 8 00052 * 12-bit RGB444: COLORS_DEF = 12 00053 * 15-bit RGB555: COLORS_DEF = 15 00054 * 16-bit RGB565: COLORS_DEF = 16 00055 * 24-bit RGB888: COLORS_DEF = 24 00056 * @{ 00057 */ 00058 00059 /** 00060 * Default configuration values 00061 */ 00062 00063 #ifndef COLORS_DEF 00064 //#define COLORS_DEF 24 /* 24-bit 888 color mode */ 00065 #define COLORS_DEF 16 /* 16-bit 565 color mode */ 00066 // #define COLORS_DEF 15 /* 15-bit 555 color mode */ 00067 // #define COLORS_DEF 12 /* 12-bit 444 color mode */ 00068 // #define COLORS_DEF 8 /* 8-bit color mode */ 00069 #endif 00070 00071 #if defined(COLORS_DEF) 00072 #ifndef COLORS_8_565_MODE 00073 /** Setup the palette table for RGB565 mode if COLORS_8_565_MODE 00074 is defined, other use RGB555 mode if not defined. */ 00075 #define COLORS_8_565_MODE 00076 #endif 00077 #endif 00078 00079 #if COLORS_DEF == 24 00080 /* Black color, 888 mode */ 00081 #define BLACK 0x000000 00082 /* Light gray color, 888 mode */ 00083 #define LIGHTGRAY 0x545454 00084 /* Dark gray color, 888 mode */ 00085 #define DARKGRAY 0xA8A8A8 00086 /* White color, 888 mode */ 00087 #define WHITE 0xFFFFFF 00088 /* Red color, 888 mode */ 00089 #define RED 0xFF0000 00090 /* Green color, 888 mode */ 00091 #define GREEN 0x00FF00 00092 /* Blue color, 888 mode */ 00093 #define BLUE 0x0000FF 00094 00095 /* Light red color, 888 mode */ 00096 #define LIGHTRED 0x3F0000 00097 /* Light green color, 888 mode */ 00098 #define LIGHTGREEN 0x003F00 00099 /* Light blue color, 888 mode */ 00100 #define LIGHTBLUE 0x00003F 00101 00102 /* Minimum red color, 888 mode */ 00103 #define MINRED 0x010000 00104 /* Light green color, 888 mode */ 00105 #define MINGREEN 0x000100 00106 /* Light blue color, 888 mode */ 00107 #define MINBLUE 0x000001 00108 00109 /* Red color mask, 888 mode */ 00110 #define REDMASK 0xFF0000 00111 /* Red shift value, 888 mode */ 00112 #define REDSHIFT 16 00113 /* Green color mask, 888 mode */ 00114 #define GREENMASK 0x00FF00 00115 /* Green shift value, 888 mode */ 00116 #define GREENSHIFT 8 00117 /* Blue color mask, 888 mode */ 00118 #define BLUEMASK 0x0000FF 00119 /* Blue shift value, 888 mode */ 00120 #define BLUESHIFT 0 00121 00122 /* Number of colors in 888 mode */ 00123 #define NUM_COLORS 16777216 00124 /* Number of red colors in 888 mode */ 00125 #define RED_COLORS 0x100 00126 /* Number of green colors in 888 mode */ 00127 #define GREEN_COLORS 0x100 00128 /* Number of blue colors in 888 mode */ 00129 #define BLUE_COLORS 0x100 00130 00131 /* Color type is a 16-bit value */ 00132 typedef uint32_t COLOR_T; 00133 #endif 00134 00135 #if COLORS_DEF == 16 00136 /* Black color, 565 mode */ 00137 #define BLACK 0x0000 00138 /* Light gray color, 565 mode */ 00139 #define LIGHTGRAY 0X7BEF 00140 /* Dark gray color, 565 mode */ 00141 #define DARKGRAY 0x39E7 00142 /* White color, 565 mode */ 00143 #define WHITE 0xffff 00144 /* Red color, 565 mode */ 00145 #define RED 0xF800 00146 /* Green color, 565 mode */ 00147 #define GREEN 0x07E0 00148 /* Blue color, 565 mode */ 00149 #define BLUE 0x001F 00150 00151 /* Magenta color, 565 mode */ 00152 #define MAGENTA (RED | BLUE) 00153 /* Cyan color, 565 mode */ 00154 #define CYAN (GREEN | BLUE) 00155 /* Yellow color, 565 mode */ 00156 #define YELLOW (RED | GREEN) 00157 00158 /* Light red color, 565 mode */ 00159 #define LIGHTRED 0x7800 00160 /* Light green color, 565 mode */ 00161 #define LIGHTGREEN 0x03E0 00162 /* Light blue color, 565 mode */ 00163 #define LIGHTBLUE 0x000F 00164 00165 /* Minimum red color, 565 mode */ 00166 #define MINRED 0x0800 00167 /* Light green color, 565 mode */ 00168 #define MINGREEN 0x0020 00169 /* Light blue color, 565 mode */ 00170 #define MINBLUE 0x0001 00171 00172 /* Red color mask, 565 mode */ 00173 #define REDMASK 0xF800 00174 /* Red shift value, 565 mode */ 00175 #define REDSHIFT 11 00176 /* Green color mask, 565 mode */ 00177 #define GREENMASK 0x07E0 00178 /* Green shift value, 565 mode */ 00179 #define GREENSHIFT 5 00180 /* Blue color mask, 565 mode */ 00181 #define BLUEMASK 0x001F 00182 /* Blue shift value, 565 mode */ 00183 #define BLUESHIFT 0 00184 00185 /* Number of colors in 565 mode */ 00186 #define NUM_COLORS 65536 00187 /* Number of red colors in 565 mode */ 00188 #define RED_COLORS 0x20 00189 /* Number of green colors in 565 mode */ 00190 #define GREEN_COLORS 0x40 00191 /* Number of blue colors in 565 mode */ 00192 #define BLUE_COLORS 0x20 00193 00194 /* Color type is a 16-bit value */ 00195 typedef uint16_t COLOR_T; 00196 #endif 00197 00198 #if COLORS_DEF == 15 00199 /* Black color, 555 mode */ 00200 #define BLACK 0x0000 00201 /* Llight gray color, 555 mode */ 00202 #define LIGHTGRAY 0x3DEF 00203 /* Drak gray color, 555 mode */ 00204 #define DARKGRAY 0x1CE7 00205 /* White color, 555 mode */ 00206 #define WHITE 0xffff 00207 /* Red color, 555 mode */ 00208 #define RED 0x7C00 00209 /* Green color, 555 mode */ 00210 #define GREEN 0x03E0 00211 /* Blue color, 555 mode */ 00212 #define BLUE 0x001F 00213 /* Magenta color, 555 mode */ 00214 #define MAGENTA (RED | BLUE) 00215 /* Cyan color, 555 mode */ 00216 #define CYAN (GREEN | BLUE) 00217 /* Yellow color, 555 mode */ 00218 #define YELLOW (RED | GREEN) 00219 /* Light red color, 555 mode */ 00220 #define LIGHTRED 0x3C00 00221 /* Light green color, 555 mode */ 00222 #define LIGHTGREEN 0x01E0 00223 /* Light blue color, 555 mode */ 00224 #define LIGHTBLUE 0x000F 00225 /* Light magenta color, 555 mode */ 00226 #define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE) 00227 /* Light cyan color, 555 mode */ 00228 #define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE) 00229 /* Light yellow color, 555 mode */ 00230 #define LIGHTYELLOW (LIGHTRED | LIGHTGREEN) 00231 00232 /* Red color mask, 555 mode */ 00233 #define REDMASK 0x7C00 00234 /* Red shift value, 555 mode */ 00235 #define REDSHIFT 10 00236 /* Green color mask, 555 mode */ 00237 #define GREENMASK 0x03E0 00238 /* Green shift value, 555 mode */ 00239 #define GREENSHIFT 5 00240 /* Blue color mask, 555 mode */ 00241 #define BLUEMASK 0x001F 00242 /* Blue shift value, 555 mode */ 00243 #define BLUESHIFT 0 00244 00245 /* Number of colors in 555 mode */ 00246 #define NUM_COLORS 32768 00247 /* Number of red colors in 555 mode */ 00248 #define RED_COLORS 0x20 00249 /* Number of green colors in 555 mode */ 00250 #define GREEN_COLORS 0x20 00251 /* Number of blue colors in 555 mode */ 00252 #define BLUE_COLORS 0x20 00253 00254 /* Color type is a 16-bit value */ 00255 typedef uint16_t COLOR_T; 00256 #endif 00257 00258 #if COLORS_DEF == 12 00259 /* Black color, 444 mode */ 00260 #define BLACK 0x0000 00261 /* Llight gray color, 444 mode */ 00262 #define LIGHTGRAY 0x3DEF 00263 /* Drak gray color, 444 mode */ 00264 #define DARKGRAY 0x1CE7 00265 /* White color, 444 mode */ 00266 #define WHITE 0x7fff 00267 /* Red color, 444 mode */ 00268 #define RED 0x3C00 00269 /* Green color, 444 mode */ 00270 #define GREEN 0x01E0 00271 /* Blue color, 444 mode */ 00272 #define BLUE 0x000F 00273 /* Magenta color, 444 mode */ 00274 #define MAGENTA (RED | BLUE) 00275 /* Cyan color, 444 mode */ 00276 #define CYAN (GREEN | BLUE) 00277 /* Yellow color, 444 mode */ 00278 #define YELLOW (RED | GREEN) 00279 /* Light red color, 444 mode */ 00280 #define LIGHTRED 0x3C00 00281 /* Light green color, 444 mode */ 00282 #define LIGHTGREEN 0x01E0 00283 /* Light blue color, 444 mode */ 00284 #define LIGHTBLUE 0x000F 00285 /* Light magenta color, 444 mode */ 00286 #define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE) 00287 /* Light cyan color, 444 mode */ 00288 #define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE) 00289 /* Light yellow color, 444 mode */ 00290 #define LIGHTYELLOW (LIGHTRED | LIGHTGREEN) 00291 00292 /* Red color mask, 444 mode */ 00293 #define REDMASK 0x3C00 00294 /* Red shift value, 444 mode */ 00295 #define REDSHIFT 10 00296 /* Green color mask, 444 mode */ 00297 #define GREENMASK 0x01E0 00298 /* Green shift value, 444 mode */ 00299 #define GREENSHIFT 5 00300 /* Blue color mask, 444 mode */ 00301 #define BLUEMASK 0x000F 00302 /* Blue shift value, 444 mode */ 00303 #define BLUESHIFT 0 00304 00305 /* Number of colors in 444 mode */ 00306 #define NUM_COLORS 4096 00307 /* Number of red colors in 444 mode */ 00308 #define RED_COLORS 0x10 00309 /* Number of green colors in 444 mode */ 00310 #define GREEN_COLORS 0x10 00311 /* Number of blue colors in 444 mode */ 00312 #define BLUE_COLORS 0x10 00313 00314 /* Color type is a 16-bit value */ 00315 typedef uint16_t COLOR_T; 00316 #endif 00317 00318 #if COLORS_DEF == 8 00319 /* Black color, 332 mode */ 00320 #define BLACK 0x00 00321 /* Light gray color, 332 mode */ 00322 #define LIGHTGRAY 0x6E 00323 /* Dark gray color, 332 mode */ 00324 #define DARKGRAY 0x25 00325 /* White color, 332 mode */ 00326 #define WHITE 0xFF 00327 /* Red color, 332 mode */ 00328 #define RED 0xE0 00329 /* Green color, 332 mode */ 00330 #define GREEN 0x1C 00331 /* Blue color, 332 mode */ 00332 #define BLUE 0x03 00333 /* Magenta color, 332 mode */ 00334 #define MAGENTA (RED | BLUE) 00335 /* Cyan color, 332 mode */ 00336 #define CYAN (GREEN | BLUE) 00337 /* Yellow color, 332 mode */ 00338 #define YELLOW (RED | GREEN) 00339 /* Light red color, 332 mode */ 00340 #define LIGHTRED 0x60 00341 /* Light green color, 332 mode */ 00342 #define LIGHTGREEN 0x0C 00343 /* Light blue color, 332 mode */ 00344 #define LIGHTBLUE 0x01 00345 /* Light magenta color, 332 mode */ 00346 #define LIGHTMAGENTA (LIGHTRED | LIGHTBLUE) 00347 /* Light cyan color, 332 mode */ 00348 #define LIGHTCYAN (LIGHTGREEN | LIGHTBLUE) 00349 /* Light yellow color, 332 mode */ 00350 #define LIGHTYELLOW (LIGHTRED | LIGHTGREEN) 00351 00352 /* Red color mask, 332 mode */ 00353 #define REDMASK 0xE0 00354 /* Red shift value, 332 mode */ 00355 #define REDSHIFT 5 00356 /* Green color mask, 332 mode */ 00357 #define GREENMASK 0x1C 00358 /* Green shift value, 332 mode */ 00359 #define GREENSHIFT 2 00360 /* Blue color mask, 332 mode */ 00361 #define BLUEMASK 0x3 00362 /* Blue shift value, 332 mode */ 00363 #define BLUESHIFT 0 00364 00365 /* Number of colors in 332 mode */ 00366 #define NUM_COLORS 256 00367 /* Number of red colors in 332 mode */ 00368 #define RED_COLORS 0x08 00369 /* Number of green colors in 332 mode */ 00370 #define GREEN_COLORS 0x06 00371 /* Number of blue colors in 332 mode */ 00372 #define BLUE_COLORS 0x04 00373 00374 /* Color type is a 8-bit value */ 00375 typedef uint8_t COLOR_T; 00376 #endif 00377 00378 /** 00379 * @brief Generate a palette table (only in 8-bit mode) 00380 * @param palette_table : Pointer to palette table (256 entries) 00381 * @return Nothing 00382 * @note Depending on the target LCD color mapping (either 555 or 565), a 00383 * palette table will be generated to convert colors stored in 233 00384 * format to either 555 or 565 format through a lookup table. 00385 * If compiled in 16-bit color mode, this will be a NULL function. 00386 * Select the appropriate define in this function for 555 or 565 00387 * color mode displays when using an 256 color frame buffer. 00388 */ 00389 void lpc_colors_set_palette(uint16_t *palette_table); 00390 00391 /** 00392 * @} 00393 */ 00394 00395 #if defined(__cplusplus) 00396 } 00397 #endif /*__cplusplus */ 00398 00399 #endif /* __LPC_COLOR_H_ */ 00400
Generated on Tue Jul 12 2022 21:27:04 by 1.7.2