My controller identifies as an ILI9328, but only works if initialised as an ILI9325. This fork includes a fix to force 9325 initialization when a 9328 is detected.

Dependents:   TouchScreenCalibrate TouchScreenGUIDemo

Fork of UniGraphic by GraphicsDisplay

Revision:
34:091b954c3205
Parent:
31:4d15eb940be7
--- a/Inits/ILI932x.cpp	Mon Apr 11 16:54:35 2016 +0000
+++ b/Inits/ILI932x.cpp	Sun Jun 21 15:23:02 2020 +0100
@@ -17,7 +17,7 @@
     hw_reset();
     BusEnable(true);  //set CS low, will stay low untill manually set high with BusEnable(false);
     identify(); // will collect tftID
-    if(tftID==0x9325 || tftID==0x9328) init9325();
+    if(tftID==0x9325) init9325();
     else if(tftID==0x9320) init9320();
     auto_gram_read_format();// try to get read gram pixel format, could be 16bit or 18bit, RGB or BGR. Will set flags accordingly
     set_orientation(0);
@@ -53,6 +53,22 @@
     cls();
     locate(0,0); 
 }
+
+ILI932x::ILI932x(const char *name)
+    : TFT932x(name)
+{
+    hw_reset(); //TFT class forwards to Protocol class
+    BusEnable(true); //set CS low, TFT932x class will toggle CS every transfer
+    identify(); // will collect tftID
+    if(tftID==0x9325) init9325();
+    else if(tftID==0x9320) init9320();
+    auto_gram_read_format();// try to get read gram pixel format, could be 16bit or 18bit, RGB or BGR. Will set flags accordingly
+    set_orientation(0); 
+    FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. 
+    cls();
+    locate(0,0); 
+}
+
 // reset and init the lcd controller
 
 void ILI932x::init9325()
@@ -77,21 +93,21 @@
  reg_write(0x0012,0x0000);  
  reg_write(0x0013,0x0000); 
  reg_write(0x0007,0x0001);
-wait_ms(200);
+ThisThread::sleep_for(200ms);
 //vgh 
  reg_write(0x0010,0x1290);   
  reg_write(0x0011,0x0227);
-wait_ms(50);
+ThisThread::sleep_for(50ms);
  //vregiout 
  reg_write(0x0012,0x001d); //0x001b
- wait_ms(50);
+ ThisThread::sleep_for(50ms);
  //vom amplitude
  reg_write(0x0013,0x1500);
- wait_ms(50); 
+ ThisThread::sleep_for(50ms); 
  //vom H
  reg_write(0x0029,0x0018); 
  reg_write(0x002B,0x000D); 
-wait_ms(50);
+ThisThread::sleep_for(50ms);
 //gamma
  reg_write(0x0030,0x0004);
  reg_write(0x0031,0x0307);
@@ -151,21 +167,21 @@
  reg_write(0x0012,0x0000);  
  reg_write(0x0013,0x0000); 
  reg_write(0x0007,0x0001);
-wait_ms(200);
+ThisThread::sleep_for(200ms);
 
  reg_write(0x0010,0x10C0);   
  reg_write(0x0011,0x0007);
-wait_ms(50);
+ThisThread::sleep_for(50ms);
 
  reg_write(0x0012,0x0110);
- wait_ms(50);
+ ThisThread::sleep_for(50ms);
 
  reg_write(0x0013,0x0b00);
- wait_ms(50); 
+ ThisThread::sleep_for(50ms); 
 
  reg_write(0x0029,0x0000); 
  reg_write(0x002B,0x4010); // bit 14???
-wait_ms(50);
+ThisThread::sleep_for(50ms);
 //gamma
 /*
  reg_write(0x0030,0x0004);