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.c
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 #include "lpc_colors.h" 00033 00034 /***************************************************************************** 00035 * Private types/enumerations/variables 00036 ****************************************************************************/ 00037 00038 /***************************************************************************** 00039 * Public types/enumerations/variables 00040 ****************************************************************************/ 00041 00042 /***************************************************************************** 00043 * Private functions 00044 ****************************************************************************/ 00045 00046 /***************************************************************************** 00047 * Public functions 00048 ****************************************************************************/ 00049 00050 /* Generate a palette table (only in 8-bit mode) */ 00051 void lpc_colors_set_palette(uint16_t *palette_table) 00052 { 00053 #if COLORS_DEF == 8 00054 int32_t idx; 00055 uint16_t entry, r, g, b; 00056 00057 /* 256 entries */ 00058 for (idx = 0; idx < NUM_COLORS; idx++) { 00059 r = ((uint16_t) idx & REDMASK) >> REDSHIFT; 00060 g = ((uint16_t) idx & GREENMASK) >> GREENSHIFT; 00061 b = ((uint16_t) idx & BLUEMASK) >> BLUESHIFT; 00062 00063 #ifdef COLORS_8_565_MODE 00064 /* Strip out and scale colors */ 00065 r = r * 0x1F / ((REDMASK >> REDSHIFT) + 1); 00066 g = g * 0x3F / ((GREENMASK >> GREENSHIFT) + 1); 00067 b = b * 0x1F / ((BLUEMASK >> BLUESHIFT) + 1); 00068 entry = b + (g << 5) + (r << 11); 00069 00070 #else 00071 /* Strip out and scale colors */ 00072 r = r * 0x1F / ((REDMASK >> REDSHIFT) + 1); 00073 g = g * 0x1F / ((GREENMASK >> GREENSHIFT) + 1); 00074 b = b * 0x1F / ((BLUEMASK >> BLUESHIFT) + 1); 00075 entry = b + (g << 5) + (r << 10); 00076 #endif 00077 00078 /* Save palette entry */ 00079 palette_table[idx] = entry; 00080 } 00081 #endif /* COLORS_DEF == 8 */ 00082 } 00083
Generated on Tue Jul 12 2022 21:27:04 by 1.7.2