کد:
/****************************************Copyright (c)**************************************************
**
** http://www.powermcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: GLCD.h
** Descriptions: None
**
**------------------------------------------------------------------------------------------------------
** Created by: AVRman
** Created date: 2012-6-20
** Version: 1.0
** Descriptions: The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
** Version:
** Descriptions:
********************************************************************************************************/
#ifndef __GLCD_H
#define __GLCD_H
/* Includes ------------------------------------------------------------------*/
#include "lpc_types.h"
#include "SDRAM_K4S561632C_32M_16BIT.h" //"SDRAM_K4S561632C_32M_16BIT.h"
//#include "SSD1963_CMD.h"
//*************************SSD1963*******************************
/* Private define ------------------------------------------------------------*/
#define USE_16BIT_PMP
#define LCD_REG (*((volatile unsigned short *) 0x6C000000)) /* RS = 0 */
#define LCD_RAM (*((volatile unsigned short *) 0x6C000002)) /* RS = 1 */
/*********************************************************************
* Overview: Horizontal and vertical display resolution
* (from the glass datasheet).
*********************************************************************/
#define DISP_HOR_RESOLUTION 320
#define DISP_VER_RESOLUTION 240
/*********************************************************************
* Overview: Horizontal synchronization timing in pixels
* (from the glass datasheet).
*********************************************************************/
#define DISP_HOR_PULSE_WIDTH 20 /* 20 */
#define DISP_HOR_BACK_PORCH 51 /* 48 */
#define DISP_HOR_FRONT_PORCH 20 /* 20 */
/*********************************************************************
* Overview: Vertical synchronization timing in lines
* (from the glass datasheet).
*********************************************************************/
#define DISP_VER_PULSE_WIDTH 2 /* 2 */
#define DISP_VER_BACK_PORCH 12 /* 16 */
#define DISP_VER_FRONT_PORCH 4 /* 4 */
/*********************************************************************
* Definition for SPI interface for HIMAX 8238-A relevant to hardware
* layout; Hardware dependent!
*********************************************************************/
#define GPIO3 3
#define GPIO2 2
#define GPIO1 1
#define GPIO0 0
#define LCD_RESET (1<<GPIO3) /* LCD Reset signal (Reset for display panel, NOT ssd1963) */
#define LCD_SPENA (1<<GPIO0) /* SPI EN signal */
#define LCD_SPCLK (1<<GPIO1) /* SPI CLK */
#define LCD_SPDAT (1<<GPIO2) /* SPI DATA */
#define RGB565CONVERT(red, green, blue) (int) (((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3))
/* Private function prototypes -----------------------------------------------*/
void LCD_Initializtion(void);
void LCD_SetBacklight(uint8_t intensity);
void LCD_WriteCommand(uint16_t cmd);
void LCD_WriteData(uint16_t data);
uint16_t LCD_ReadData(void);
//*************************SSD1963*******************************
/* Private define ------------------------------------------------------------*/
#define LCD_VRAM_BASE_ADDR 0xA0E18800 //((uint32_t)SDRAM_BASE_ADDR + SDRAM_SIZE - 0x300000) // (1024*600*2)-(800*480*2)) //3MB
#define LCD_CURSOR_BASE_ADDR ((uint32_t)0x20088800)
#define LCD_4_3_TFT 0 /* 4.3 inch TFT LCD */
#define LCD_4_3_TFT_PRO 1 /* 4.3 inch HD TFT LCD */
#define LCD_5_0_TFT 2 /* 5 inch TFT LCD */
#define LCD_7_0_TFT 3 /* 7 inch TFT LCD */
#define LCD_10_1_TFT 3 /* 7 inch TFT LCD */
/* what LCD type do you want to use */
#define USED_LCD LCD_4_3_TFT
//************************************************************************************************
#if (USED_LCD == LCD_4_3_TFT)
#define GLCD_X_SIZE 480 /* LCD Horizontal length */
#define GLCD_Y_SIZE 272 /* LCD Vertical length */
#define PPL GLCD_X_SIZE /* Pixels per line */
#define HSW 20 /* HSYNC pulse width */
#define HFP 2 /* Horizontal front porch */
#define HBP 2 /* Horizontal back porch */
#define LPP GLCD_Y_SIZE /* Lines per panel */
#define VSW 15 /* VSYNC pulse width */
#define VFP 2 /* Vertical front porch */
#define VBP 2 /* Vertical back porch */
#define ACB 1 /* AC bias frequency (not used) */
#define IVS 1 /* ? Invert VSYNC */
#define IHS 1 /* ? Invert HSYNC */
#define IPC 0 /* ? Invert panel clock */
#define CPL PPL /* Clock per line (identical to pixels per line) */
#define BPP 6 /* Bits per pixel b110 = 16 bpp 5:6:5 mode */
#define BGR 1 /* Swap red and blue */
#define LCDTFT 1 /* LCD TFT panel */
#define OPT_CLK (8*1000000) /* Optimal clock rate (Hz) between 1-8.22 MHz */
//************************************************************************************************
#elif (USED_LCD == LCD_7_0_TFT)
#define GLCD_X_SIZE 800 /* LCD Horizontal length */
#define GLCD_Y_SIZE 480 /* LCD Vertical length */
#define PPL GLCD_X_SIZE /* Pixels per line */
#define HSW 1 /* HSYNC pulse width */
#define HFP 40 /* Horizontal front porch */
#define HBP 88 /* Horizontal back porch */
#define LPP GLCD_Y_SIZE /* Lines per panel */
#define VSW 2 /* VSYNC pulse width */
#define VFP 2 /* Vertical front porch */
#define VBP 2 /* Vertical back porch */
#define ACB 1 /* AC bias frequency (not used) */
#define IVS 1 /* ? Invert VSYNC */
#define IHS 1 /* ? Invert HSYNC */
#define IPC 0 /* ? Invert panel clock */
#define CPL PPL /* Clock per line (identical to pixels per line) */
#define BPP 6 /* Bits per pixel b110 = 16 bpp 5:6:5 mode */
#define BGR 1 /* Swap red and blue */
#define LCDTFT 1 /* LCD TFT panel */
#define OPT_CLK (28.5*1000000) /* Optimal clock rate (Hz) between 1-8.22 MHz */
//************************************************************************************************
#elif (USED_LCD == LCD_10_1_TFT)
#define GLCD_X_SIZE 1024 /* LCD Horizontal length */
#define GLCD_Y_SIZE 600 /* LCD Vertical length */
#define PPL GLCD_X_SIZE /* Pixels per line */
#define HSW 1 /* HSYNC pulse width, can be 1-48 */
#define HFP 40 /* Horizontal front porch, MUST be 40 */
#define HBP 40//88 /* Horizontal back porch, MUST be 88 */
#define LPP GLCD_Y_SIZE /* Lines per panel */
#define VSW 1 /* VSYNC pulse width, MSUT be 3 */
#define VFP 1 /* Vertical front porch, 1 or 3 is rational */
#define VBP 1 /* Vertical back porch, 1 or 3 is rational */
#define ACB 1 /* AC bias frequency (not used) */
#define IVS 1 /* ? Invert VSYNC */
#define IHS 1 /* ? Invert HSYNC */
#define IPC 0 /* ? Invert panel clock */
#define CPL PPL /* Clock per line (identical to pixels per line) */
#define BPP 6 /* Bits per pixel b110 = 16 bpp 5:6:5 mode */
#define BGR 1 /* Swap red and blue */
#define LCDTFT 1 /* LCD TFT panel */
#define OPT_CLK (28.5*1000000) /* Optimal clock rate (Hz) between 1-8.22 MHz */
#else
#error "Invalid LCD!"
#endif
//************************************************************************************************
#define BCD_BIT 26 /* Bypass pixel clock divider */
#define GLCD_PWR_ENA_DIS_DLY 10000
/* LCD color */
#define Black 0x0000 /* 0, 0, 0 */
#define Navy 0x000F /* 0, 0, 128 */
#define DarkGreen 0x03E0 /* 0, 128, 0 */
#define DarkCyan 0x03EF /* 0, 128, 128 */
#define Maroon 0x7800 /* 128, 0, 0 */
#define Purple 0x780F /* 128, 0, 128 */
#define Olive 0x7BE0 /* 128, 128, 0 */
#define LightGrey 0xC618 /* 192, 192, 192 */
#define DarkGrey 0x7BEF /* 128, 128, 128 */
#define Blue 0x001F /* 0, 0, 255 */
#define Green 0x07E0 /* 0, 255, 0 */
#define Cyan 0x07FF /* 0, 255, 255 */
#define Red 0xF800 /* 255, 0, 0 */
#define Magenta 0xF81F /* 255, 0, 255 */
#define Yellow 0xFFE0 /* 255, 255, 0 */
#define White 0xFFFF /* 255, 255, 255 */
/* Private function prototypes -----------------------------------------------*/
void GLCD_Cursor_Config(int config);
void GLCD_Cursor_Enable(int cursor);
void GLCD_Cursor_Disable(void);
void GLCD_Move_Cursor(int x, int y);
void GLCD_Copy_Cursor (const uint32_t *pCursor, int cursor, int size);
void GLCD_Init (void);
void GLCD_Clear(uint16_t color);
void GLCD_SetPixel_16bpp (uint16_t Xpos, uint16_t Ypos, uint16_t color);
void GLCD_DrawLine( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1 , uint16_t color );
#endif
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
همونطور که میبینید تنظیمات ال سی دی 4.3 و 7 و 10.1 وجود داره ولی 5 نیست.