Graphical demo for the LPC4088 Experiment Base Board with one of the Display Expansion Kits. This program displays how to write text in different fonts.

Dependencies:   EALib mbed

Committer:
embeddedartists
Date:
Thu Jun 25 10:30:15 2015 +0000
Revision:
0:5e5e9ec91fc8
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:5e5e9ec91fc8 1 /*
embeddedartists 0:5e5e9ec91fc8 2 * @brief SWIM color definitions and palette table setup
embeddedartists 0:5e5e9ec91fc8 3 *
embeddedartists 0:5e5e9ec91fc8 4 * @note
embeddedartists 0:5e5e9ec91fc8 5 * Copyright(C) NXP Semiconductors, 2012
embeddedartists 0:5e5e9ec91fc8 6 * All rights reserved.
embeddedartists 0:5e5e9ec91fc8 7 *
embeddedartists 0:5e5e9ec91fc8 8 * @par
embeddedartists 0:5e5e9ec91fc8 9 * Software that is described herein is for illustrative purposes only
embeddedartists 0:5e5e9ec91fc8 10 * which provides customers with programming information regarding the
embeddedartists 0:5e5e9ec91fc8 11 * LPC products. This software is supplied "AS IS" without any warranties of
embeddedartists 0:5e5e9ec91fc8 12 * any kind, and NXP Semiconductors and its licensor disclaim any and
embeddedartists 0:5e5e9ec91fc8 13 * all warranties, express or implied, including all implied warranties of
embeddedartists 0:5e5e9ec91fc8 14 * merchantability, fitness for a particular purpose and non-infringement of
embeddedartists 0:5e5e9ec91fc8 15 * intellectual property rights. NXP Semiconductors assumes no responsibility
embeddedartists 0:5e5e9ec91fc8 16 * or liability for the use of the software, conveys no license or rights under any
embeddedartists 0:5e5e9ec91fc8 17 * patent, copyright, mask work right, or any other intellectual property rights in
embeddedartists 0:5e5e9ec91fc8 18 * or to any products. NXP Semiconductors reserves the right to make changes
embeddedartists 0:5e5e9ec91fc8 19 * in the software without notification. NXP Semiconductors also makes no
embeddedartists 0:5e5e9ec91fc8 20 * representation or warranty that such application will be suitable for the
embeddedartists 0:5e5e9ec91fc8 21 * specified use without further testing or modification.
embeddedartists 0:5e5e9ec91fc8 22 *
embeddedartists 0:5e5e9ec91fc8 23 * @par
embeddedartists 0:5e5e9ec91fc8 24 * Permission to use, copy, modify, and distribute this software and its
embeddedartists 0:5e5e9ec91fc8 25 * documentation is hereby granted, under NXP Semiconductors' and its
embeddedartists 0:5e5e9ec91fc8 26 * licensor's relevant copyrights in the software, without fee, provided that it
embeddedartists 0:5e5e9ec91fc8 27 * is used in conjunction with NXP Semiconductors microcontrollers. This
embeddedartists 0:5e5e9ec91fc8 28 * copyright, permission, and disclaimer notice must appear in all copies of
embeddedartists 0:5e5e9ec91fc8 29 * this code.
embeddedartists 0:5e5e9ec91fc8 30 */
embeddedartists 0:5e5e9ec91fc8 31
embeddedartists 0:5e5e9ec91fc8 32 #include "lpc_colors.h"
embeddedartists 0:5e5e9ec91fc8 33
embeddedartists 0:5e5e9ec91fc8 34 /*****************************************************************************
embeddedartists 0:5e5e9ec91fc8 35 * Private types/enumerations/variables
embeddedartists 0:5e5e9ec91fc8 36 ****************************************************************************/
embeddedartists 0:5e5e9ec91fc8 37
embeddedartists 0:5e5e9ec91fc8 38 /*****************************************************************************
embeddedartists 0:5e5e9ec91fc8 39 * Public types/enumerations/variables
embeddedartists 0:5e5e9ec91fc8 40 ****************************************************************************/
embeddedartists 0:5e5e9ec91fc8 41
embeddedartists 0:5e5e9ec91fc8 42 /*****************************************************************************
embeddedartists 0:5e5e9ec91fc8 43 * Private functions
embeddedartists 0:5e5e9ec91fc8 44 ****************************************************************************/
embeddedartists 0:5e5e9ec91fc8 45
embeddedartists 0:5e5e9ec91fc8 46 /*****************************************************************************
embeddedartists 0:5e5e9ec91fc8 47 * Public functions
embeddedartists 0:5e5e9ec91fc8 48 ****************************************************************************/
embeddedartists 0:5e5e9ec91fc8 49
embeddedartists 0:5e5e9ec91fc8 50 /* Generate a palette table (only in 8-bit mode) */
embeddedartists 0:5e5e9ec91fc8 51 void lpc_colors_set_palette(uint16_t *palette_table)
embeddedartists 0:5e5e9ec91fc8 52 {
embeddedartists 0:5e5e9ec91fc8 53 #if COLORS_DEF == 8
embeddedartists 0:5e5e9ec91fc8 54 int32_t idx;
embeddedartists 0:5e5e9ec91fc8 55 uint16_t entry, r, g, b;
embeddedartists 0:5e5e9ec91fc8 56
embeddedartists 0:5e5e9ec91fc8 57 /* 256 entries */
embeddedartists 0:5e5e9ec91fc8 58 for (idx = 0; idx < NUM_COLORS; idx++) {
embeddedartists 0:5e5e9ec91fc8 59 r = ((uint16_t) idx & REDMASK) >> REDSHIFT;
embeddedartists 0:5e5e9ec91fc8 60 g = ((uint16_t) idx & GREENMASK) >> GREENSHIFT;
embeddedartists 0:5e5e9ec91fc8 61 b = ((uint16_t) idx & BLUEMASK) >> BLUESHIFT;
embeddedartists 0:5e5e9ec91fc8 62
embeddedartists 0:5e5e9ec91fc8 63 #ifdef COLORS_8_565_MODE
embeddedartists 0:5e5e9ec91fc8 64 /* Strip out and scale colors */
embeddedartists 0:5e5e9ec91fc8 65 r = r * 0x1F / ((REDMASK >> REDSHIFT) + 1);
embeddedartists 0:5e5e9ec91fc8 66 g = g * 0x3F / ((GREENMASK >> GREENSHIFT) + 1);
embeddedartists 0:5e5e9ec91fc8 67 b = b * 0x1F / ((BLUEMASK >> BLUESHIFT) + 1);
embeddedartists 0:5e5e9ec91fc8 68 entry = b + (g << 5) + (r << 11);
embeddedartists 0:5e5e9ec91fc8 69
embeddedartists 0:5e5e9ec91fc8 70 #else
embeddedartists 0:5e5e9ec91fc8 71 /* Strip out and scale colors */
embeddedartists 0:5e5e9ec91fc8 72 r = r * 0x1F / ((REDMASK >> REDSHIFT) + 1);
embeddedartists 0:5e5e9ec91fc8 73 g = g * 0x1F / ((GREENMASK >> GREENSHIFT) + 1);
embeddedartists 0:5e5e9ec91fc8 74 b = b * 0x1F / ((BLUEMASK >> BLUESHIFT) + 1);
embeddedartists 0:5e5e9ec91fc8 75 entry = b + (g << 5) + (r << 10);
embeddedartists 0:5e5e9ec91fc8 76 #endif
embeddedartists 0:5e5e9ec91fc8 77
embeddedartists 0:5e5e9ec91fc8 78 /* Save palette entry */
embeddedartists 0:5e5e9ec91fc8 79 palette_table[idx] = entry;
embeddedartists 0:5e5e9ec91fc8 80 }
embeddedartists 0:5e5e9ec91fc8 81 #endif /* COLORS_DEF == 8 */
embeddedartists 0:5e5e9ec91fc8 82 }
embeddedartists 0:5e5e9ec91fc8 83