Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.

Dependents:   Brew

Revision:
30:87855d03d91a
Parent:
21:ae0a4eedfc90
--- a/Inits/ILI932x.cpp	Sat Nov 28 18:37:19 2015 +0000
+++ b/Inits/ILI932x.cpp	Sun Nov 29 19:58:47 2015 +0000
@@ -18,6 +18,7 @@
     BusEnable(true);  //set CS low, will stay low untill manually set high with BusEnable(false);
     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. 
@@ -31,6 +32,7 @@
     BusEnable(true);  //set CS low, will stay low untill manually set high with BusEnable(false);
     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. 
@@ -44,6 +46,7 @@
     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. 
@@ -56,6 +59,8 @@
 {
     /* Example for ILI9325 ----------------------------------------------------*/
 
+ flipped=FLIP_NONE; // FLIP_NONE, FLIP_X, FLIP_Y, FLIP_X|FLIP_Y
+ 
  reg_write(0x0001,0x0100); 
  reg_write(0x0002,0x0700); 
  reg_write(0x0003,0x1030); 
@@ -123,4 +128,80 @@
  
  reg_write(0x0007,0x0133); // display on
 
+}
+void ILI932x::init9320()
+{
+    /* Example for ILI9320 ----------------------------------------------------*/
+
+ flipped=FLIP_X; // FLIP_NONE, FLIP_X, FLIP_Y, FLIP_X|FLIP_Y
+ 
+ reg_write(0x0001,0x0100); 
+ reg_write(0x0002,0x0700); 
+ reg_write(0x0003,0x1030); 
+ reg_write(0x0004,0x0000); 
+ reg_write(0x0008,0x0202);  
+ reg_write(0x0009,0x0000);
+ reg_write(0x000A,0x0000); 
+ reg_write(0x000C,0x0000); 
+ reg_write(0x000D,0x0000);
+ reg_write(0x000F,0x0000);
+//power on sequence
+ reg_write(0x0010,0x0000);   
+ reg_write(0x0011,0x0007);  
+ reg_write(0x0012,0x0000);  
+ reg_write(0x0013,0x0000); 
+ reg_write(0x0007,0x0001);
+wait_ms(200);
+
+ reg_write(0x0010,0x10C0);   
+ reg_write(0x0011,0x0007);
+wait_ms(50);
+
+ reg_write(0x0012,0x0110);
+ wait_ms(50);
+
+ reg_write(0x0013,0x0b00);
+ wait_ms(50); 
+
+ reg_write(0x0029,0x0000); 
+ reg_write(0x002B,0x4010); // bit 14???
+wait_ms(50);
+//gamma
+/*
+ reg_write(0x0030,0x0004);
+ reg_write(0x0031,0x0307);
+ reg_write(0x0032,0x0002);// 0006
+ reg_write(0x0035,0x0206);
+ reg_write(0x0036,0x0408);
+ reg_write(0x0037,0x0507); 
+ reg_write(0x0038,0x0204);//0200
+ reg_write(0x0039,0x0707); 
+ reg_write(0x003C,0x0405);// 0504
+ reg_write(0x003D,0x0F02);
+ */
+ //ram
+ reg_write(0x0050,0x0000); 
+ reg_write(0x0051,0x00EF);
+ reg_write(0x0052,0x0000); 
+ reg_write(0x0053,0x013F);  
+ reg_write(0x0060,0x2700); 
+ reg_write(0x0061,0x0001); 
+ reg_write(0x006A,0x0000); 
+ //
+ reg_write(0x0080,0x0000); 
+ reg_write(0x0081,0x0000); 
+ reg_write(0x0082,0x0000); 
+ reg_write(0x0083,0x0000); 
+ reg_write(0x0084,0x0000); 
+ reg_write(0x0085,0x0000); 
+ //
+ reg_write(0x0090,0x0000); 
+ reg_write(0x0092,0x0000); 
+ reg_write(0x0093,0x0001); 
+ reg_write(0x0095,0x0110); 
+ reg_write(0x0097,0x0000); 
+ reg_write(0x0098,0x0000);
+ 
+ reg_write(0x0007,0x0133); // display on
+
 }
\ No newline at end of file