#include "ili9325.h"
//#include "TargetLib.h"
//------------------------------------------------------------------
// 函数名 : void LCD_Delay(INT32U time)
// 输入 : 延时time*100us
// 输出 : Null
// 全局变量: Null
// 功能描述: 延时
//------------------------------------------------------------------
void LCD_Delay(U32 time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<100;j++);
}
void LCD_Write_COM(U8 VH,U8 VL) //发送命令
{
LCD_RS_L;
rPDATC = (VH<<8) | (VL);
LCD_WR_L;
LCD_WR_H;
}
void LCD_Write_DATA(U8 VH,U8 VL) //发送数据
{
LCD_RS_H;
rPDATC = (VH<<8) | (VL);
LCD_WR_L;
LCD_WR_H;
}
U16 LCD_Read_DATA(void)
{
LCD_RS_H;
LCD_RD_H;
LCD_RD_L;
return rPDATC;
}
void LCD_Window(U16 x1,U16 y1,U16 x2,U16 y2)
{
LCD_Write_COM(0x00,0x20);LCD_Write_DATA(x1>>8,x1); //设置X坐标位置
LCD_Write_COM(0x00,0x21);LCD_Write_DATA(y1>>8,y1); //设置Y坐标位置
LCD_Write_COM(0x00,0x50);LCD_Write_DATA(x1>>8,x1); //开始X
LCD_Write_COM(0x00,0x52);LCD_Write_DATA(y1>>8,y1); //开始Y
LCD_Write_COM(0x00,0x51);LCD_Write_DATA(x2>>8,x2); //结束X
LCD_Write_COM(0x00,0x53);LCD_Write_DATA(y2>>8,y2); //结束Y
LCD_Write_COM(0x00,0x22);
}
void LCD_Init9325(void)
{
LCD_REST_H;
LCD_Delay(5);
LCD_REST_L;
LCD_Delay(15);
LCD_REST_H;