?? lcd2478.h
字號:
/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: LCD2478.h
** Last modified Date: 2008-04-07
** Last Version: 1.0
** Descriptions: the lcd controller driver's head
**
**------------------------------------------------------------------------------------------------------
** Created by: Houxiaolong
** Created date: 2008-04-07
** Version: 1.0
** Descriptions: the lcd controller driver's head
**
**------------------------------------------------------------------------------------------------------
** Modified by: Houxiaolong
** Modified date: 2008-07-10
** Version: 1.1
** Descriptions: add the mirror operation macro
**
********************************************************************************************************/
#ifndef _LCD2478_H
#define _LCD2478_H
#define U_LCD_XSIZE 240 /* LCD x size */
#define U_LCD_YSIZE 320 /* LCD y size */
#define LcdPwr 1
#define LcdTFT 1
#define LcdBpp 6
#define LcdEn 1
#define HBP 18 /* Horizontal back porch */
#define HFP 9 /* Horizontal front porch */
#define HSW 11 /* Horizontal pulse width */
#define VBP 1 /* Vertical back porch */
#define VFP 2 /* Vertical front porch */
#define VSW 2 /* Vertical pulse width */
#define PPL (U_LCD_XSIZE / 16) - 1 /* Pixels-per-line */
#define LPP U_LCD_YSIZE - 1 /* Lines-per-panel */
#define CPL U_LCD_XSIZE - 1 /* clock per line */
#define MIRROR_X 1 /* x size mirror */
#define MIRROR_Y 0 /* y size mirror */
#define HWORDMODE 0 /* picture data */
#define LCD_RED 0xf800 /* red color */
#define LCD_GREEN 0x07e0 /* green color */
#define LCD_BLUE 0x001f /* blue color */
#define LCD_BLACK 0x0000 /* black color */
#define LCD_WHITE 0xffff /* white color */
extern __align(8) volatile unsigned short LCD_BUFFER[U_LCD_YSIZE][U_LCD_XSIZE];
/**********************************************************************************************************
** mirror operation
**********************************************************************************************************/
#if (!MIRROR_X && !MIRROR_Y)
#define SECTION_X(x, y) x
#define SECTION_Y(x, y) y
#elif (MIRROR_X && !MIRROR_Y)
#define SECTION_X(x, y) U_LCD_XSIZE - 1 - x
#define SECTION_Y(x, y) y
#elif (!MIRROR_X && MIRROR_Y)
#define SECTION_X(x, y) x
#define SECTION_Y(x, y) U_LCD_YSIZE - 1 - y
#elif (MIRROR_X && MIRROR_Y)
#define SECTION_X(x, y) U_LCD_XSIZE - 1 - x
#define SECTION_Y(x, y) U_LCD_YSIZE - 1 - y
#endif
/*********************************************************************************************************
** Function name : lcd_SetPixel
** Function Description : Draw a pixel with the appointed color
** Input: ix x side coordinate of the pixel
** iy y side coordinate of the pixel
** uicolor the color of the pixel
** Output: none
*********************************************************************************************************/
__inline void lcd_SetPixel (int ix, int iy, unsigned int uicolor)
{
if ((ix < U_LCD_XSIZE) && (iy < U_LCD_YSIZE)) {
LCD_BUFFER[SECTION_Y(ix, iy)][SECTION_X(ix, iy)] = (unsigned short)uicolor;
}
}
/*********************************************************************************************************
** macro definition of lcd_SetPixel
*********************************************************************************************************/
/*
#define lcd_SetPixel(x, y, color) \
do { \
if((x < U_LCD_XSIZE) && (y < U_LCD_YSIZE)) { \
LCD_BUFFER[SECTION_Y(x, y)][SECTION_X(x, y)] = (unsigned short)uicolor; \
} \
} while (0)
*/
/*********************************************************************************************************
** Function name : lcd_Init
** Function Description : Initialize the LCD controler
** Input: none
** Output: none
*********************************************************************************************************/
void lcd_Init(void);
/*********************************************************************************************************
** Function name : lcd_ReadPixel
** Function Description : Get the pixel's color
** Input: ix x side coordinate of the pixel
** iy y side coordinate of the pixel
** Output: succeed return the pixel's color
** fail 0
*********************************************************************************************************/
int lcd_ReadPixel(int ix, int iy);
/*********************************************************************************************************
** Function name : lcd_Clear
** Function Description : Fill the LCD panel with a color
** Input: uicolor LCD display color
** Output: none
*********************************************************************************************************/
void lcd_Clear(unsigned int uicolor);
/*********************************************************************************************************
** Function name : lcd_OnOff
** Function Description : enable or disable the lcd controller
** Input: ix x side coordinate of the pixel
** iy y side coordinate of the pixel
** Output: succeed return the pixel's color
** fail 0
*********************************************************************************************************/
void lcd_OnOff(int iOnOff);
/*********************************************************************************************************
** Function name : lcd_DrawHLine
** Function Description : Draw a horizontal line
** Input: ix0 x side coordinate of the first pixel
** ix1 x side coordinate of the last pixel
** iy y side coordinate of the line
** uicolor the color of the pixel
** Output: none
*********************************************************************************************************/
void lcd_DrawHLine(int ix0, int ix1, int iy, unsigned int uicolor);
/*********************************************************************************************************
** Function name : lcd_DrawVLine
** Function Description : Draw a vertical line
** Input: ix x side coordinate of the line
** iy0 y side coordinate of the first pixel
** iy1 y side coordinate of the last pixel
** uicolor the color of the pixel
** Output: none
*********************************************************************************************************/
void lcd_DrawVLine (int ix, int iy0, int iy1, unsigned int uicolor);
/*********************************************************************************************************
** Function name : lcd_DrawLine
** Function Description : Draw a line
** Input: ix0 x side coordinate of the first pixel
** iy0 y side coordinate of the first pixel
** ix1 x side coordinate of the last pixel
** iy1 y side coordinate of the last pixel
** uicolor the color of the pixel
** Output: none
*********************************************************************************************************/
void lcd_DrawLine(int ix0, int iy0, int ix1, int iy1, unsigned int uicolor);
/*********************************************************************************************************
** Function name : lcd_DrawRect
** Function Description : Draw a rectangle
** Input: ix0 x side coordinate of the first pixel
** iy0 y side coordinate of the first pixel
** ix1 x side coordinate of the last pixel
** iy1 y side coordinate of the last pixel
** uicolor the color of the pixel
** Output: none
*********************************************************************************************************/
void lcd_DrawRect(int ix0, int iy0, int ix1, int iy1, unsigned int uicolor);
/*********************************************************************************************************
** Function name : lcd_FillRect
** Function Description : Fill a rectangle
** Input: ix0 x side coordinate of the first pixel
** iy0 y side coordinate of the first pixel
** ix1 x side coordinate of the last pixel
** iy1 y side coordinate of the last pixel
** uicolor the color of the pixel
** Output: none
*********************************************************************************************************/
void lcd_FillRect(int ix0, int iy0, int ix1, int iy1, unsigned int uicolor);
#if (HWORDMODE == 1)
/*********************************************************************************************************
** Function name : lcd_DrawBmp
** Function Description : Draw a bmp
** Input: ix0 x side coordinate of the first pixel
** iy0 y side coordinate of the first pixel
** iwidth x side width
** ilength y side length
** pucBmp the bmp array pointer
** Output: none
*********************************************************************************************************/
void lcd_DrawBmp(int ix0,
int iy0,
int iwidth,
int ilength,
unsigned short *pucBmp);
#else
/*********************************************************************************************************
** Function name : lcd_DrawBmp
** Function Description : Draw a bmp
** Input: ix0 x side coordinate of the first pixel
** iy0 y side coordinate of the first pixel
** iwidth x side width
** ilength y side length
** pucBmp the bmp array pointer
** Output: none
*********************************************************************************************************/
void lcd_DrawBmp(int ix0,
int iy0,
int iwidth,
int ilength,
unsigned char *pucBmp);
#endif
/*********************************************************************************************************
** Function name : delay_Ns
** Function Description : delay time
** Input: idly the necessary time
** Output: none
*********************************************************************************************************/
void delay_Ns(int idly);
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -