GLCD Library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GLCD.h Source File

GLCD.h

00001 /****************************************Copyright (c)**************************************************                         
00002 **
00003 **                                 http://www.powermcu.com
00004 **
00005 **--------------File Info-------------------------------------------------------------------------------
00006 ** File name:           GLCD.h
00007 ** Descriptions:        Has been tested SSD1289��ILI9320��R61505U��SSD1298��ST7781��SPFD5408B��ILI9325��ILI9328��
00008 **                      HX8346A��HX8347A
00009 **------------------------------------------------------------------------------------------------------
00010 ** Created by:          AVRman
00011 ** Created date:        2012-3-10
00012 ** Version:             1.3
00013 ** Descriptions:        The original version
00014 **
00015 **------------------------------------------------------------------------------------------------------
00016 ** Modified by:         
00017 ** Modified date:   
00018 ** Version:
00019 ** Descriptions:        
00020 ********************************************************************************************************/
00021 
00022 #ifndef __GLCD_H 
00023 #define __GLCD_H
00024 
00025 /* Includes ------------------------------------------------------------------*/
00026 #include "LPC17xx.h"
00027 
00028 /* Private define ------------------------------------------------------------*/
00029 
00030 /* LCD Interface */
00031 #define PIN_EN      (1 << 19)
00032 #define PIN_LE      (1 << 20)
00033 #define PIN_DIR     (1 << 21)
00034 #define PIN_CS      (1 << 22)
00035 #define PIN_RS      (1 << 23)
00036 #define PIN_WR      (1 << 24)
00037 #define PIN_RD      (1 << 25)   
00038 
00039 #define LCD_EN(x)   ((x) ? (LPC_GPIO0->FIOSET = PIN_EN) : (LPC_GPIO0->FIOCLR = PIN_EN));
00040 #define LCD_LE(x)   ((x) ? (LPC_GPIO0->FIOSET = PIN_LE) : (LPC_GPIO0->FIOCLR = PIN_LE));
00041 #define LCD_DIR(x)  ((x) ? (LPC_GPIO0->FIOSET = PIN_DIR) : (LPC_GPIO0->FIOCLR = PIN_DIR));
00042 #define LCD_CS(x)   ((x) ? (LPC_GPIO0->FIOSET = PIN_CS) : (LPC_GPIO0->FIOCLR = PIN_CS));
00043 #define LCD_RS(x)   ((x) ? (LPC_GPIO0->FIOSET = PIN_RS) : (LPC_GPIO0->FIOCLR = PIN_RS));
00044 #define LCD_WR(x)   ((x) ? (LPC_GPIO0->FIOSET = PIN_WR) : (LPC_GPIO0->FIOCLR = PIN_WR));
00045 #define LCD_RD(x)   ((x) ? (LPC_GPIO0->FIOSET = PIN_RD) : (LPC_GPIO0->FIOCLR = PIN_RD));
00046 
00047 /* Private define ------------------------------------------------------------*/
00048 #define DISP_ORIENTATION  0  /* angle 0 90 */ 
00049 
00050 #if  ( DISP_ORIENTATION == 90 ) || ( DISP_ORIENTATION == 270 )
00051 
00052 #define  MAX_X  320
00053 #define  MAX_Y  240   
00054 
00055 #elif  ( DISP_ORIENTATION == 0 ) || ( DISP_ORIENTATION == 180 )
00056 
00057 #define  MAX_X  240
00058 #define  MAX_Y  320   
00059 
00060 #endif
00061 
00062 /* LCD color */
00063 #define White          0xFFFF
00064 #define Black          0x0000
00065 #define Grey           0xF7DE
00066 #define Blue           0x001F
00067 #define Blue2          0x051F
00068 #define Red            0xF800
00069 #define Magenta        0xF81F
00070 #define Green          0x07E0
00071 #define Green2         0x1641
00072 #define Cyan           0x7FFF
00073 #define Yellow         0xFFE0
00074 
00075 /******************************************************************************
00076 * Function Name  : RGB565CONVERT
00077 * Description    : 24λת��16λ
00078 * Input          : - red: R
00079 *                  - green: G 
00080 *                  - blue: B
00081 * Output         : None
00082 * Return         : RGB ��ɫֵ
00083 * Attention      : None
00084 *******************************************************************************/
00085 #define RGB565CONVERT(red, green, blue)\
00086 (uint16_t)( (( red   >> 3 ) << 11 ) | \
00087 (( green >> 2 ) << 5  ) | \
00088 ( blue  >> 3 ))
00089 
00090 /* Private function prototypes -----------------------------------------------*/
00091 void LCD_Initialization(void);
00092 void LCD_Clear(uint16_t Color);
00093 uint16_t LCD_GetPoint(uint16_t Xpos,uint16_t Ypos);
00094 void LCD_SetPoint(uint16_t Xpos,uint16_t Ypos,uint16_t point);
00095 void LCD_DrawLine( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1 , uint16_t color );
00096 void PutChar( uint16_t Xpos, uint16_t Ypos, uint8_t ASCI, uint16_t charColor, uint16_t bkColor, int size ); //scrivo un carattere
00097 void GUI_Text(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor, int size); //scrivo una stringa
00098 void PutChinese(uint16_t Xpos,uint16_t Ypos,uint8_t *str,uint16_t Color,uint16_t bkColor);
00099 void GUI_Chinese(uint16_t Xpos, uint16_t Ypos, uint8_t *str,uint16_t Color, uint16_t bkColor);
00100 
00101 #endif 
00102 
00103 /*********************************************************************************************************
00104       END FILE
00105 *********************************************************************************************************/
00106