From 34a9286f696e769fbea04889161632f452c075d7 Mon Sep 17 00:00:00 2001 From: wuyangyong Date: Thu, 11 Mar 2010 10:49:24 +0000 Subject: [PATCH] add LCD devicecode check git-svn-id: https://rt-thread.googlecode.com/svn/trunk@478 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/stm32_radio/ili9325/ili9325.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bsp/stm32_radio/ili9325/ili9325.c b/bsp/stm32_radio/ili9325/ili9325.c index c487bc9e7f..48a73e0264 100644 --- a/bsp/stm32_radio/ili9325/ili9325.c +++ b/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 -- GitLab