mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-28 16:14:20 +08:00
fix ili9325 driver
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@440 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -7,22 +7,14 @@ extern void ili9325_Clear(u16 Color);
|
||||
|
||||
extern unsigned short ili9325_BGR2RGB(unsigned short c);
|
||||
|
||||
extern void LCD_WriteRAM_Prepare(void);
|
||||
extern void LCD_WriteRAM(u16 RGB_Code);
|
||||
extern void ili9325_WriteRAM_Prepare(void);
|
||||
extern void ili9325_WriteRAM(u16 RGB_Code);
|
||||
extern unsigned short ili9325_ReadGRAM(unsigned short x,unsigned short y);
|
||||
extern void LCD_WriteReg(u8 LCD_Reg,u16 LCD_RegValue);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vu16 LCD_REG; /* 0x00 */
|
||||
vu16 reserve1; /* 0x02 */
|
||||
vu16 reserve2; /* 0x04 */
|
||||
vu16 reserve3; /* 0x06 */
|
||||
vu16 LCD_RAM; /* 0x08 */
|
||||
} LCD_ili9325_TypeDef;
|
||||
extern void ili9325_WriteReg(u8 LCD_Reg,u16 LCD_RegValue);
|
||||
|
||||
/* LCD is connected to the FSMC_Bank1_NOR/SRAM2 and NE2 is used as ship select signal */
|
||||
#define LCD_ili9325_BASE ((u32)(0x60000000 | 0x04000000))
|
||||
#define LCD ((LCD_ili9325_TypeDef *) LCD_ili9325_BASE)
|
||||
/* RS <==> A2 */
|
||||
#define ili9325_REG (*((volatile unsigned short *) 0x64000000)) /* RS = 0 */
|
||||
#define ili9325_RAM (*((volatile unsigned short *) 0x64000008)) /* RS = 1 */
|
||||
|
||||
#endif
|
||||
|
||||
+17
-24
@@ -314,8 +314,8 @@ void rt_hw_lcd_set_pixel(rtgui_color_t *c, rt_base_t x, rt_base_t y)
|
||||
p = rtgui_color_to_565p(*c);
|
||||
ili9325_SetCursor(x,y);
|
||||
|
||||
LCD_WriteRAM_Prepare();
|
||||
LCD_WriteRAM(p);
|
||||
ili9325_WriteRAM_Prepare();
|
||||
ili9325_WriteRAM(p);
|
||||
}
|
||||
|
||||
/* 获取像素点颜色 */
|
||||
@@ -335,16 +335,14 @@ void rt_hw_lcd_draw_hline(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_
|
||||
p = rtgui_color_to_565p(*c);
|
||||
|
||||
/* [5:4]-ID~ID0 [3]-AM-1垂直-0水平 */
|
||||
LCD_WriteReg(0x0003,(1<<12)|(1<<5)|(1<<4) | (0<<3) );
|
||||
ili9325_WriteReg(0x0003,(1<<12)|(1<<5)|(1<<4) | (0<<3) );
|
||||
|
||||
ili9325_SetCursor(x1, y);
|
||||
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
ili9325_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
while (x1 < x2)
|
||||
{
|
||||
//LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
LCD_WriteRAM(p);
|
||||
ili9325_WriteRAM(p);
|
||||
x1++;
|
||||
//ili9320_SetCursor(x1, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,16 +355,14 @@ void rt_hw_lcd_draw_vline(rtgui_color_t *c, rt_base_t x, rt_base_t y1, rt_base_t
|
||||
p = rtgui_color_to_565p(*c);
|
||||
|
||||
/* [5:4]-ID~ID0 [3]-AM-1垂直-0水平 */
|
||||
LCD_WriteReg(0x0003,(1<<12)|(1<<5)|(0<<4) | (1<<3) );
|
||||
ili9325_WriteReg(0x0003,(1<<12)|(1<<5)|(0<<4) | (1<<3) );
|
||||
|
||||
ili9325_SetCursor(x, y1);
|
||||
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
ili9325_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
while (y1 < y2)
|
||||
{
|
||||
//LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
LCD_WriteRAM(p);
|
||||
ili9325_WriteRAM(p);
|
||||
y1++;
|
||||
//ili9320_SetCursor(x, y1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,17 +375,15 @@ void rt_hw_lcd_draw_raw_hline(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt
|
||||
ptr = (rt_uint16_t*) pixels;
|
||||
|
||||
/* [5:4]-ID~ID0 [3]-AM-1垂直-0水平 */
|
||||
LCD_WriteReg(0x0003,(1<<12)|(1<<5)|(1<<4) | (0<<3) );
|
||||
ili9325_WriteReg(0x0003,(1<<12)|(1<<5)|(1<<4) | (0<<3) );
|
||||
|
||||
ili9325_SetCursor(x1, y);
|
||||
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
ili9325_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
while (x1 < x2)
|
||||
{
|
||||
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
|
||||
LCD_WriteRAM( *ptr );
|
||||
ili9325_WriteRAM( *ptr );
|
||||
x1 ++;
|
||||
ptr ++;
|
||||
ili9325_SetCursor(x1, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,14 +410,13 @@ rt_err_t rt_hw_lcd_init(void)
|
||||
|
||||
/* write */
|
||||
temp=0;
|
||||
for(test_y=0; test_y<320; test_y++)
|
||||
/* [5:4]-ID~ID0 [3]-AM-1垂直-0水平 */
|
||||
ili9325_WriteReg(0x0003,(1<<12)|(1<<5)|(1<<4) | (0<<3) );
|
||||
ili9325_SetCursor(0,0);
|
||||
ili9325_WriteRAM_Prepare();
|
||||
for(test_y=0; test_y<76800; test_y++)
|
||||
{
|
||||
for(test_x=0; test_x<240; test_x++)
|
||||
{
|
||||
ili9325_SetCursor(test_x,test_y);
|
||||
LCD->LCD_REG = 34;
|
||||
LCD->LCD_RAM = temp++;
|
||||
}
|
||||
ili9325_WriteRAM(temp++);
|
||||
}
|
||||
|
||||
/* read */
|
||||
|
||||
@@ -24,7 +24,8 @@ static void GPIO_Configuration(void)
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOA,&GPIO_InitStructure);
|
||||
|
||||
FLASH_RST_0(); // RESET
|
||||
FLASH_RST_0(); // RESET
|
||||
FLASH_CS_1();
|
||||
FLASH_RST_1();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user