Kaynağa Gözat

add LCD devicecode check

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@478 bbd45198-f89e-11dd-88c7-29a3b14d5316
wuyangyong 15 yıl önce
ebeveyn
işleme
34a9286f69
1 değiştirilmiş dosya ile 12 ekleme ve 1 silme
  1. 12 1
      bsp/stm32_radio/ili9325/ili9325.c

+ 12 - 1
bsp/stm32_radio/ili9325/ili9325.c

@@ -243,12 +243,23 @@ unsigned short ili9325_ReadGRAM(unsigned short x,unsigned short y)
     return temp;
 }
 
+void rt_kprintf(const char *fmt, ...);
+#define printf   rt_kprintf
 void ili9325_Initializtion(void)
 {
     volatile unsigned int i;
     LCD_FSMCConfig();
 
     DeviceCode = LCD_ReadReg(0x0000);
+
+    /* DeviceCode check */
+    if( (DeviceCode != 0x9325) && (DeviceCode != 0x9328) && (DeviceCode != 0x7783) )
+    {
+        printf("Invalid LCD ID:%08X\r\n",DeviceCode);
+        printf("Please check you hardware.")
+        while(1);
+    }
+
     if (DeviceCode==0x9325||DeviceCode==0x9328)
     {
         ili9325_WriteReg(0x00e7,0x0010);
@@ -308,7 +319,7 @@ void ili9325_Initializtion(void)
         ili9325_WriteReg(0x0052,0x0000);
         ili9325_WriteReg(0x0053,0x013f);
 #if defined(_ILI_REVERSE_DIRECTION_)
-        ili9325_WriteReg(0x0060,0x2700);       
+        ili9325_WriteReg(0x0060,0x2700);
 #else
         ili9325_WriteReg(0x0060,0xA700);
 #endif