mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-01 19:54:43 +02:00
Add 2nd init sequence for ILI9341, see #1172
Use: #define ILI9341_2_DRIVER in the setup file to invoke new initicode, instead of: #define ILI9341_DRIVER
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write strobe timing setup
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (ILI9341_DRIVER) || defined (ST7796_DRIVER) || defined (ILI9486_DRIVER) // WRX twc spec is <=66ns = 15.15MHz
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ST7796_DRIVER) || defined (ILI9486_DRIVER) // WRX twc spec is <=66ns = 15.15MHz
|
||||
|
||||
// Extra write pulse low time (delay for data setup)
|
||||
#if defined (STM32F1xx)
|
||||
|
@@ -5,6 +5,7 @@
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
#if defined (ILI9341_DRIVER)
|
||||
{
|
||||
writecommand(0xEF);
|
||||
writedata(0x03);
|
||||
@@ -122,3 +123,126 @@
|
||||
writecommand(ILI9341_DISPON); //Display on
|
||||
|
||||
}
|
||||
|
||||
#elif defined (ILI9341_2_DRIVER) // Alternative init sequence, see https://github.com/Bodmer/TFT_eSPI/issues/1172
|
||||
|
||||
{
|
||||
writecommand(0xCF);
|
||||
writedata(0x00);
|
||||
writedata(0XC1);
|
||||
writedata(0X30);
|
||||
|
||||
writecommand(0xED);
|
||||
writedata(0x64);
|
||||
writedata(0x03);
|
||||
writedata(0X12);
|
||||
writedata(0X81);
|
||||
|
||||
writecommand(0xE8);
|
||||
writedata(0x85);
|
||||
writedata(0x00);
|
||||
writedata(0x78);
|
||||
|
||||
writecommand(0xCB);
|
||||
writedata(0x39);
|
||||
writedata(0x2C);
|
||||
writedata(0x00);
|
||||
writedata(0x34);
|
||||
writedata(0x02);
|
||||
|
||||
writecommand(0xF7);
|
||||
writedata(0x20);
|
||||
|
||||
writecommand(0xEA);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(ILI9341_PWCTR1); //Power control
|
||||
writedata(0x10); //VRH[5:0]
|
||||
|
||||
writecommand(ILI9341_PWCTR2); //Power control
|
||||
writedata(0x00); //SAP[2:0];BT[3:0]
|
||||
|
||||
writecommand(ILI9341_VMCTR1); //VCM control
|
||||
writedata(0x30);
|
||||
writedata(0x30);
|
||||
|
||||
writecommand(ILI9341_VMCTR2); //VCM control2
|
||||
writedata(0xB7); //--
|
||||
|
||||
writecommand(ILI9341_PIXFMT);
|
||||
writedata(0x55);
|
||||
|
||||
writecommand(0x36); // Memory Access Control
|
||||
writedata(0x08); // Rotation 0 (portrait mode)
|
||||
|
||||
writecommand(ILI9341_FRMCTR1);
|
||||
writedata(0x00);
|
||||
writedata(0x1A);
|
||||
|
||||
writecommand(ILI9341_DFUNCTR); // Display Function Control
|
||||
writedata(0x08);
|
||||
writedata(0x82);
|
||||
writedata(0x27);
|
||||
|
||||
writecommand(0xF2); // 3Gamma Function Disable
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(0x26); //Gamma curve selected
|
||||
writedata(0x01);
|
||||
|
||||
writecommand(0xE0); //Set Gamma
|
||||
writedata(0x0F);
|
||||
writedata(0x2A);
|
||||
writedata(0x28);
|
||||
writedata(0x08);
|
||||
writedata(0x0E);
|
||||
writedata(0x08);
|
||||
writedata(0x54);
|
||||
writedata(0xA9);
|
||||
writedata(0x43);
|
||||
writedata(0x0A);
|
||||
writedata(0x0F);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(0XE1); //Set Gamma
|
||||
writedata(0x00);
|
||||
writedata(0x15);
|
||||
writedata(0x17);
|
||||
writedata(0x07);
|
||||
writedata(0x11);
|
||||
writedata(0x06);
|
||||
writedata(0x2B);
|
||||
writedata(0x56);
|
||||
writedata(0x3C);
|
||||
writedata(0x05);
|
||||
writedata(0x10);
|
||||
writedata(0x0F);
|
||||
writedata(0x3F);
|
||||
writedata(0x3F);
|
||||
writedata(0x0F);
|
||||
|
||||
writecommand(0x2B);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0x3f);
|
||||
|
||||
writecommand(0x2A);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0xef);
|
||||
|
||||
writecommand(ILI9341_SLPOUT); //Exit Sleep
|
||||
|
||||
end_tft_write();
|
||||
delay(120);
|
||||
begin_tft_write();
|
||||
|
||||
writecommand(ILI9341_DISPON); //Display on
|
||||
}
|
||||
#endif
|
@@ -604,7 +604,7 @@ void TFT_eSPI::init(uint8_t tc)
|
||||
tc = tc; // Supress warning
|
||||
|
||||
// This loads the driver specific initialisation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER)
|
||||
#include "TFT_Drivers/ILI9341_Init.h"
|
||||
|
||||
#elif defined (ST7735_DRIVER)
|
||||
@@ -690,7 +690,7 @@ void TFT_eSPI::setRotation(uint8_t m)
|
||||
begin_tft_write();
|
||||
|
||||
// This loads the driver specific rotation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER)
|
||||
#include "TFT_Drivers/ILI9341_Rotation.h"
|
||||
|
||||
#elif defined (ST7735_DRIVER)
|
||||
@@ -941,7 +941,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
||||
// Fetch the 16 bit BRG pixel
|
||||
//uint16_t rgb = (readByte() << 8) | readByte();
|
||||
|
||||
#if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) | defined (SSD1963_DRIVER)// Read 3 bytes
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9488_DRIVER) || defined (SSD1963_DRIVER)// Read 3 bytes
|
||||
|
||||
// Read window pixel 24 bit RGB values and fill in LS bits
|
||||
uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
|
||||
@@ -1059,7 +1059,7 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
||||
// Set masked pins D0- D7 to input
|
||||
busDir(dir_mask, INPUT);
|
||||
|
||||
#if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) // Read 3 bytes
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9488_DRIVER) // Read 3 bytes
|
||||
// Dummy read to throw away don't care value
|
||||
readByte();
|
||||
|
||||
|
@@ -36,7 +36,8 @@
|
||||
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
#define ILI9341_DRIVER // Generic driver for common displays
|
||||
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
|
||||
//#define ST7735_DRIVER // Define additional parameters below for this display
|
||||
//#define ILI9163_DRIVER // Define additional parameters below for this display
|
||||
//#define S6D02A1_DRIVER
|
||||
|
@@ -131,7 +131,7 @@
|
||||
#endif
|
||||
|
||||
// Load the right driver definition - do not tinker here !
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER)
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
#define TFT_DRIVER 0x9341
|
||||
#elif defined (ST7735_DRIVER)
|
||||
|
Reference in New Issue
Block a user