Browse Source

add ili9325 dirction option

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@461 bbd45198-f89e-11dd-88c7-29a3b14d5316
wuyangyong 15 years ago
parent
commit
3a8f591e51
2 changed files with 13 additions and 2 deletions
  1. 10 2
      bsp/stm32_radio/ili9325/ili9325.c
  2. 3 0
      bsp/stm32_radio/ili9325/ili9325.h

+ 10 - 2
bsp/stm32_radio/ili9325/ili9325.c

@@ -253,7 +253,11 @@ void ili9325_Initializtion(void)
     {
     {
         ili9325_WriteReg(0x00e7,0x0010);
         ili9325_WriteReg(0x00e7,0x0010);
         ili9325_WriteReg(0x0000,0x0001);  			        //start internal osc
         ili9325_WriteReg(0x0000,0x0001);  			        //start internal osc
-        ili9325_WriteReg(0x0001,0x0100);
+#if defined(_ILI_REVERSE_DIRECTION_)
+        ili9325_WriteReg(0x0001,0x0000);                    //Reverse Display
+#else
+        ili9325_WriteReg(0x0001,0x0100);                    //
+#endif
         ili9325_WriteReg(0x0002,0x0700); 				    //power on sequence
         ili9325_WriteReg(0x0002,0x0700); 				    //power on sequence
         /* [5:4]-ID1~ID0 [3]-AM-1´¹Ö±-0ˮƽ */
         /* [5:4]-ID1~ID0 [3]-AM-1´¹Ö±-0ˮƽ */
         ili9325_WriteReg(0x0003,(1<<12)|(1<<5)|(0<<4) | (1<<3) );
         ili9325_WriteReg(0x0003,(1<<12)|(1<<5)|(0<<4) | (1<<3) );
@@ -303,7 +307,11 @@ void ili9325_Initializtion(void)
         ili9325_WriteReg(0x0051,0x00ef);
         ili9325_WriteReg(0x0051,0x00ef);
         ili9325_WriteReg(0x0052,0x0000);
         ili9325_WriteReg(0x0052,0x0000);
         ili9325_WriteReg(0x0053,0x013f);
         ili9325_WriteReg(0x0053,0x013f);
-        ili9325_WriteReg(0x0060,0xa700);
+#if defined(_ILI_REVERSE_DIRECTION_)
+        ili9325_WriteReg(0x0060,0x2700);       
+#else
+        ili9325_WriteReg(0x0060,0xA700);
+#endif
         ili9325_WriteReg(0x0061,0x0001);
         ili9325_WriteReg(0x0061,0x0001);
         ili9325_WriteReg(0x006a,0x0000);
         ili9325_WriteReg(0x006a,0x0000);
         ili9325_WriteReg(0x0080,0x0000);
         ili9325_WriteReg(0x0080,0x0000);

+ 3 - 0
bsp/stm32_radio/ili9325/ili9325.h

@@ -12,6 +12,9 @@ extern void ili9325_WriteRAM(u16 RGB_Code);
 extern unsigned short ili9325_ReadGRAM(unsigned short x,unsigned short y);
 extern unsigned short ili9325_ReadGRAM(unsigned short x,unsigned short y);
 extern void ili9325_WriteReg(u8 LCD_Reg,u16 LCD_RegValue);
 extern void ili9325_WriteReg(u8 LCD_Reg,u16 LCD_RegValue);
 
 
+/* If LCD Display in wrong dirction uncomment this option*/
+#define _ILI_REVERSE_DIRECTION_
+
 /* LCD is connected to the FSMC_Bank1_NOR/SRAM2 and NE2 is used as ship select signal */
 /* LCD is connected to the FSMC_Bank1_NOR/SRAM2 and NE2 is used as ship select signal */
 /* RS <==> A2 */
 /* RS <==> A2 */
 #define ili9325_REG              (*((volatile unsigned short *) 0x64000000)) /* RS = 0 */
 #define ili9325_REG              (*((volatile unsigned short *) 0x64000000)) /* RS = 0 */