1 /*************************************************************************
2  *
3 *    Used with ICCARM and AARM.
4  *
5  *    (c) Copyright IAR Systems 2008
6  *
7  *    File name   : drv_glcd.h
8  *    Description : Graphical LCD driver include file
9  *
10  *    History :
11  *    1. Date        : 6, March 2008
12  *       Author      : Stanimir Bonev
13  *       Description : Create
14  *
15  *
16  *    $Revision: 24636 $
17  *
18  *    @Modify: NXP MCU Application Team - NguyenCao
19  *    @Date: 04. March. 2011
20  **************************************************************************/
21 #include "lpc_types.h"
22 
23 #ifndef __GLCD_DRV_H
24 #define __GLCD_DRV_H
25 
26 #ifndef EOF
27 #define EOF (-1)
28 #endif
29 
30 typedef unsigned long U32;
31 typedef unsigned char U8;
32 typedef unsigned long Boolean;
33 /**
34  * @brief A struct for Bitmap on LCD screen
35  */
36 typedef struct _Bmp_t
37 {
38   U32  H_Size;
39   U32  V_Size;
40   U32  BitsPP;
41   U32  BytesPP;
42   U32 *pPalette;
43   U32 *pPicStream;
44   U8 *pPicDesc;
45 } Bmp_t, *pBmp_t;
46 
47 /**
48  * @brief A struct for Font Type on LCD screen
49  */
50 
51 typedef struct _FontType_t
52 {
53   U32 H_Size;
54   U32 V_Size;
55   U32 CharacterOffset;
56   U32 CharactersNuber;
57   U8 *pFontStream;
58   U8 *pFontDesc;
59 } FontType_t, *pFontType_t;
60 
61 typedef U32 LdcPixel_t, *pLdcPixel_t;
62 
63 #define C_GLCD_REFRESH_FREQ     (60HZ)
64 #define C_GLCD_H_SIZE           480
65 #define C_GLCD_H_PULSE          2   //
66 #define C_GLCD_H_FRONT_PORCH    5   //
67 #define C_GLCD_H_BACK_PORCH     40  //
68 #define C_GLCD_V_SIZE           272
69 #define C_GLCD_V_PULSE          2
70 #define C_GLCD_V_FRONT_PORCH    8
71 #define C_GLCD_V_BACK_PORCH     8
72 
73 #define C_GLCD_PWR_ENA_DIS_DLY  10000
74 #define C_GLCD_ENA_DIS_DLY      10000
75 
76 //Cursor 64x64 pixels
77 #define CURSOR_H_SIZE 64
78 #define CURSOR_V_SIZE 64
79 //
80 #define CIRCLE_R  18
81 
82 
83 #define CRSR_PIX_32     0
84 #define CRSR_PIX_64     1
85 #define CRSR_ASYNC      0
86 #define CRSR_FRAME_SYNC 2
87 
88 #define TEXT_DEF_TAB_SIZE 5
89 
90 #define TEXT_BEL1_FUNC()
91 
92 void GLCD_Init (void* VRAMBase);
93 void GLCD_SetPallet (const U32 * pPallete);
94 void GLCD_Ctrl (Bool bEna);
95 void GLCD_Cursor_Cfg(int Cfg);
96 void GLCD_Cursor_En(int cursor);
97 void GLCD_Cursor_Dis(int cursor);
98 void GLCD_Move_Cursor(int x, int y);
99 void GLCD_Copy_Cursor (const U32 *pCursor, int cursor, int size);
100 void GLCD_SetFont(pFontType_t pFont, LdcPixel_t Color, LdcPixel_t BackgndColor);
101 void GLCD_SetWindow(U32 X_Left, U32 Y_Up,
102                     U32 X_Right, U32 Y_Down);
103 void GLCD_TextSetPos(U32 X, U32 Y);
104 void GLCD_TextSetTabSize(U32 Size);
105 static void LCD_SET_WINDOW (U32 X_Left, U32 X_Right,
106                             U32 Y_Up, U32 Y_Down);
107 static void LCD_WRITE_PIXEL (U32 Pixel);
108 static Bool GLCD_TextCalcWindow (U32 * pXL, U32 * pXR,
109                                     U32 * pYU, U32 * pYD,
110                                     U32 * pH_Size, U32 * pV_Size);
111 void GLCD_LoadPic (U32 X_Left, U32 Y_Up, Bmp_t * pBmp, U32 Mask);
112 int _putchar (int c);
113 
114 
115 #endif // __GLCD_DRV_H
116