LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lcd_18xx_43xx.c
Go to the documentation of this file.
1 /*
2  * @brief LPC18xx/43xx LCD chip driver
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 #include "lcd_18xx_43xx.h"
33 
34 /*****************************************************************************
35  * Private types/enumerations/variables
36  ****************************************************************************/
37 
39 
40 /*****************************************************************************
41  * Public types/enumerations/variables
42  ****************************************************************************/
43 
44 /*****************************************************************************
45  * Private functions
46  ****************************************************************************/
47 
48 /*****************************************************************************
49  * Public functions
50  ****************************************************************************/
51 
52 /* Configure Cursor */
53 void Chip_LCD_Cursor_Config(LCD_CURSOR_SIZE_OPT cursor_size, bool sync)
54 {
55  LCD_Cursor_Size = cursor_size;
56  IP_LCD_Cursor_Config(LPC_LCD, cursor_size, sync);
57 }
58 
59 /* Write Cursor Image into Internal Cursor Image Buffer */
60 void Chip_LCD_Cursor_WriteImage(uint8_t cursor_num, void *Image)
61 {
62  int i, j;
63  uint32_t *fifoptr, *crsr_ptr = (uint32_t *) Image;
64 
65  /* Check if Cursor Size was configured as 32x32 or 64x64*/
67  i = cursor_num * 64;
68  j = i + 64;
69  }
70  else {
71  i = 0;
72  j = 256;
73  }
75 
76  /* Copy Cursor Image content to FIFO */
77  for (; i < j; i++) {
78 
79  *fifoptr = *crsr_ptr;
80  crsr_ptr++;
81  fifoptr++;
82  }
83 }
84 
85 /* Load LCD Palette */
86 void Chip_LCD_LoadPalette(void *palette) {
87  LCD_PALETTE_ENTRY_Type pal_entry, *ptr_pal_entry;
88  uint8_t i, *pal_ptr;
89  /* This function supports loading of the color palette from
90  the C file generated by the bmp2c utility. It expects the
91  palette to be passed as an array of 32-bit BGR entries having
92  the following format:
93  2:0 - Not used
94  7:3 - Blue
95  10:8 - Not used
96  15:11 - Green
97  18:16 - Not used
98  23:19 - Red
99  31:24 - Not used
100  arg = pointer to input palette table address */
101  ptr_pal_entry = &pal_entry;
102  pal_ptr = (uint8_t *) palette;
103 
104  /* 256 entry in the palette table */
105  for (i = 0; i < 256 / 2; i++) {
106  pal_entry.Bl = (*pal_ptr++) >> 3; /* blue first */
107  pal_entry.Gl = (*pal_ptr++) >> 3; /* get green */
108  pal_entry.Rl = (*pal_ptr++) >> 3; /* get red */
109  pal_ptr++; /* skip over the unused byte */
110  /* do the most significant halfword of the palette */
111  pal_entry.Bu = (*pal_ptr++) >> 3; /* blue first */
112  pal_entry.Gu = (*pal_ptr++) >> 3; /* get green */
113  pal_entry.Ru = (*pal_ptr++) >> 3; /* get red */
114  pal_ptr++; /* skip over the unused byte */
115 
116  IP_LCD_Color_LoadPalette(LPC_LCD, (uint32_t *) &ptr_pal_entry, i);
117  }
118 }