LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lcd_001.h
Go to the documentation of this file.
1 /*
2  * @brief LCD controller Registers and control functions
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 __LCD_001_H_
33 #define __LCD_001_H_
34 
35 #include "sys_config.h"
36 #include "cmsis.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
50 typedef struct {
51  __IO uint32_t TIMH;
52  __IO uint32_t TIMV;
53  __IO uint32_t POL;
54  __IO uint32_t LE;
57  __IO uint32_t CTRL;
64  __I uint32_t RESERVED0[115];
65  __IO uint16_t PAL[256];
66  __I uint32_t RESERVED1[256];
67  __IO uint32_t CRSR_IMG[256];
74  __I uint32_t RESERVED2[2];
79 } IP_LCD_001_T;
80 
84 typedef struct {
85  uint32_t Rl : 5;
86  uint32_t Gl : 5;
87  uint32_t Bl : 5;
88  uint32_t Il : 1;
89  uint32_t Ru : 5;
90  uint32_t Gu : 5;
91  uint32_t Bu : 5;
92  uint32_t Iu : 1;
94 
98 typedef enum IP_LCD_PANEL_OPT {
99  LCD_TFT = 0x02,
100  LCD_MONO_4 = 0x01,
101  LCD_MONO_8 = 0x05,
102  LCD_CSTN = 0x00
104 
108 typedef enum IP_LCD_COLOR_FORMAT_OPT {
112 
114 #define LCD_INTMSK_FUFIM 0x2
115 #define LCD_INTMSK_LNBUIM 0x4
116 #define LCD_INTMSK_VCOMPIM 0x8
117 #define LCD_INTMSK_BERIM 0x10
119 #define CLCDC_LCDCTRL_ENABLE _BIT(0)
120 #define CLCDC_LCDCTRL_PWR _BIT(11)
125 typedef struct {
126  uint8_t HBP;
127  uint8_t HFP;
128  uint8_t HSW;
129  uint16_t PPL;
130  uint8_t VBP;
131  uint8_t VFP;
132  uint8_t VSW;
133  uint16_t LPP;
134  uint8_t IOE;
135  uint8_t IPC;
136  uint8_t IHS;
137  uint8_t IVS;
138  uint8_t ACB;
139  uint8_t BPP;
142  uint8_t Dual;
143 } LCD_Config_T;
144 
148 typedef enum IP_LCD_CURSOR_SIZE_OPT {
152 
160 {
161  pLCD->INTMSK = ints;
162 }
163 
171 {
172  pLCD->INTMSK = pLCD->INTMSK & ~(ints);
173 }
174 
182 {
183  pLCD->INTCLR = pLCD->INTMSK & (ints);
184 }
185 
192  volatile int i;
193  pLCD->CTRL |= CLCDC_LCDCTRL_PWR;
194  for (i = 0; i < 1000000; i++) {}
195  pLCD->CTRL |= CLCDC_LCDCTRL_ENABLE;
196 }
197 
204  volatile int i;
205  pLCD->CTRL &= ~CLCDC_LCDCTRL_PWR;
206  for (i = 0; i < 1000000; i++) {}
207  pLCD->CTRL &= ~CLCDC_LCDCTRL_ENABLE;
208 }
209 
216  pLCD->CTRL |= CLCDC_LCDCTRL_ENABLE;
217 }
218 
225  pLCD->CTRL &= ~CLCDC_LCDCTRL_ENABLE;
226 }
227 
236 {
237  pLCD->UPBASE = (uint32_t) buffer;
238 }
239 
247 {
248  pLCD->LPBASE = (uint32_t) buffer;
249 }
250 
263 {
264  pLCD->CRSR_CFG = ((sync ? 1 : 0) << 1) | cursor_size;
265 }
266 
275 {
276  return (void *) &(pLCD->CRSR_IMG[cursor_num * 64]);
277 }
278 
286 STATIC INLINE void IP_LCD_Cursor_Enable(IP_LCD_001_T *pLCD, uint8_t cursor_num) {
287  pLCD->CRSR_CTRL = (cursor_num << 4) | 1;
288 }
289 
297 STATIC INLINE void IP_LCD_Cursor_Disable(IP_LCD_001_T *pLCD, uint8_t cursor_num) {
298  pLCD->CRSR_CTRL = (cursor_num << 4);
299 }
300 
308 {
309  /* 7:0 - Red
310  15:8 - Green
311  23:16 - Blue
312  31:24 - Not used*/
313  pLCD->CRSR_PAL0 = (uint32_t) palette_color;
314 }
315 
323 {
324  /* 7:0 - Red
325  15:8 - Green
326  23:16 - Blue
327  31:24 - Not used*/
328  pLCD->CRSR_PAL1 = (uint32_t) palette_color;
329 
330 }
331 
339 STATIC INLINE void IP_LCD_Cursor_SetPos(IP_LCD_001_T *pLCD, uint16_t x, uint16_t y)
340 {
341  pLCD->CRSR_XY = (x & 0x3FF) | ((y & 0x3FF) << 16);
342 }
343 
351 STATIC INLINE void IP_LCD_Cursor_SetClip(IP_LCD_001_T *pLCD, uint16_t x, uint16_t y)
352 {
353  pLCD->CRSR_CLIP = (x & 0x3F) | ((y & 0x3F) << 8);
354 }
355 
364 {
365  pLCD->PAL[index] = *(uint32_t *) palette_addr;
366 }
367 
374 void IP_LCD_Init(IP_LCD_001_T *pLCD, LCD_Config_T *LCD_ConfigStruct);
375 
380 #ifdef __cplusplus
381 }
382 #endif
383 
384 #endif /* __LCD_001_H_ */