mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-01 03:34:43 +02:00
Fix #1767 and update ILI9481 init code option 8
This commit is contained in:
@@ -317,6 +317,13 @@ SPI3_HOST = 2
|
||||
#define TFT_SCLK 18
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#if (TFT_MISO == -1)
|
||||
#undef TFT_MISO
|
||||
#define TFT_MISO TFT_MOSI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -11,6 +11,8 @@
|
||||
//#define ILI9481_INIT_4 // AUO317
|
||||
//#define ILI9481_INIT_5 // CMO35 *****
|
||||
//#define ILI9481_INIT_6 // RGB
|
||||
//#define ILI9481_INIT_7 // From #1774
|
||||
//#define ILI9481_INIT_8 // From #1774
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef ILI9481_INIT_1
|
||||
@@ -61,13 +63,13 @@
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#ifndef TFT_PARALLEL_8_BIT
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
@@ -150,13 +152,13 @@
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#ifndef TFT_PARALLEL_8_BIT
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
@@ -239,13 +241,13 @@
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#ifndef TFT_PARALLEL_8_BIT
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
@@ -324,13 +326,13 @@
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#ifndef TFT_PARALLEL_8_BIT
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
@@ -412,13 +414,13 @@
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#ifndef TFT_PARALLEL_8_BIT
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
@@ -524,13 +526,13 @@
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#ifndef TFT_PARALLEL_8_BIT
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
@@ -552,4 +554,183 @@
|
||||
delay(25);
|
||||
// End of ILI9481 display configuration
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// From #1774
|
||||
#elif defined (ILI9481_INIT_7)
|
||||
///ili9481+cmi3.5ips //效果不好
|
||||
//************* Start Initial Sequence **********//
|
||||
writecommand(0x11);
|
||||
delay(20);
|
||||
writecommand(0xD0);
|
||||
writedata(0x07);
|
||||
writedata(0x42);
|
||||
writedata(0x1B);
|
||||
|
||||
writecommand(0xD1);
|
||||
writedata(0x00);
|
||||
writedata(0x14);
|
||||
writedata(0x1B);
|
||||
|
||||
writecommand(0xD2);
|
||||
writedata(0x01);
|
||||
writedata(0x12);
|
||||
|
||||
writecommand(0xC0);
|
||||
writedata(0x10);
|
||||
writedata(0x3B);
|
||||
writedata(0x00);
|
||||
writedata(0x02);
|
||||
writedata(0x01);
|
||||
|
||||
writecommand(0xC5);
|
||||
writedata(0x03);
|
||||
|
||||
writecommand(0xC8);
|
||||
writedata(0x00);
|
||||
writedata(0x46);
|
||||
writedata(0x44);
|
||||
writedata(0x50);
|
||||
writedata(0x04);
|
||||
writedata(0x16);
|
||||
writedata(0x33);
|
||||
writedata(0x13);
|
||||
writedata(0x77);
|
||||
writedata(0x05);
|
||||
writedata(0x0F);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(0x36);
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
writecommand(0x22);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0x3F);
|
||||
|
||||
writecommand(0x2B);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0xE0);
|
||||
delay(120);
|
||||
writecommand(0x29);
|
||||
|
||||
#elif defined (ILI9481_INIT_8)
|
||||
|
||||
//3.5IPS ILI9481+CMI
|
||||
writecommand(0x01); //Soft_rese
|
||||
delay(220);
|
||||
|
||||
writecommand(0x11);
|
||||
delay(280);
|
||||
|
||||
writecommand(0xd0); //Power_Setting
|
||||
writedata(0x07);//07 VC[2:0] Sets the ratio factor of Vci to generate the reference voltages Vci1
|
||||
writedata(0x44);//41 BT[2:0] Sets the Step up factor and output voltage level from the reference voltages Vci1
|
||||
writedata(0x1E);//1f 17 1C VRH[3:0]: Sets the factor to generate VREG1OUT from VCILVL
|
||||
delay(220);
|
||||
|
||||
writecommand(0xd1); //VCOM Control
|
||||
writedata(0x00);//00
|
||||
writedata(0x0C);//1A VCM [6:0] is used to set factor to generate VCOMH voltage from the reference voltage VREG1OUT 15 09
|
||||
writedata(0x1A);//1F VDV[4:0] is used to set the VCOM alternating amplitude in the range of VREG1OUT x 0.70 to VREG1OUT 1F 18
|
||||
|
||||
writecommand(0xC5); //Frame Rate
|
||||
writedata(0x03); // 03 02
|
||||
|
||||
writecommand(0xd2); //Power_Setting for Normal Mode
|
||||
writedata(0x01); //01
|
||||
writedata(0x11); //11
|
||||
|
||||
writecommand(0xE4); //?
|
||||
writedata(0xa0);
|
||||
writecommand(0xf3);
|
||||
writedata(0x00);
|
||||
writedata(0x2a);
|
||||
|
||||
//1 OK
|
||||
writecommand(0xc8);
|
||||
writedata(0x00);
|
||||
writedata(0x26);
|
||||
writedata(0x21);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x1f);
|
||||
writedata(0x65);
|
||||
writedata(0x23);
|
||||
writedata(0x77);
|
||||
writedata(0x00);
|
||||
writedata(0x0f);
|
||||
writedata(0x00);
|
||||
//GAMMA SETTING
|
||||
|
||||
writecommand(0xC0); //Panel Driving Setting
|
||||
writedata(0x00); //1//00 REV SM GS
|
||||
writedata(0x3B); //2//NL[5:0]: Sets the number of lines to drive the LCD at an interval of 8 lines.
|
||||
writedata(0x00); //3//SCN[6:0]
|
||||
writedata(0x02); //4//PTV: Sets the Vcom output in non-display area drive period
|
||||
writedata(0x11); //5//NDL: Sets the source output level in non-display area. PTG: Sets the scan mode in non-display area.
|
||||
|
||||
writecommand(0xc6); //Interface Control
|
||||
writedata(0x83);
|
||||
//GAMMA SETTING
|
||||
|
||||
writecommand(0xf0); //?
|
||||
writedata(0x01);
|
||||
|
||||
writecommand(0xE4);//?
|
||||
writedata(0xa0);
|
||||
|
||||
//////倒装设置 NG
|
||||
writecommand(0x36);
|
||||
writedata(0x0A); // 8C:出来两行 CA:出来一个点
|
||||
|
||||
writecommand(0x3a);
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT) || defined (RPI_DISPLAY_TYPE)
|
||||
writedata(0x55); // 16 bit colour interface
|
||||
#else
|
||||
writedata(0x66); // 18 bit colour interface
|
||||
#endif
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT) || defined (TFT_PARALLEL_16_BIT)
|
||||
writecommand(TFT_INVON);
|
||||
#endif
|
||||
|
||||
writecommand(0xb4);//Display Mode and Frame Memory Write Mode Setting
|
||||
writedata(0x02);
|
||||
writedata(0x00); //?
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
|
||||
delay(280);
|
||||
|
||||
writecommand(0x2a);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0x3F); //3F
|
||||
|
||||
writecommand(0x2b);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0xDf); //DF
|
||||
|
||||
//writecommand(0x21);
|
||||
writecommand(0x29);
|
||||
writecommand(0x2c);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user