From d6e573c2303165b14560f4f88ee473079b3b80f3 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Wed, 25 Nov 2020 22:54:30 +0000 Subject: [PATCH] Fix SPI ILI9481 ILI9481 with 8 bit parallel worked OK but SPI needs an 18 bit colour interface. --- Processors/TFT_eSPI_ESP32.c | 4 ++-- Processors/TFT_eSPI_ESP32.h | 4 ++-- Processors/TFT_eSPI_ESP8266.c | 2 +- Processors/TFT_eSPI_ESP8266.h | 2 +- Processors/TFT_eSPI_Generic.c | 2 +- Processors/TFT_eSPI_Generic.h | 2 +- Processors/TFT_eSPI_STM32.c | 2 +- Processors/TFT_eSPI_STM32.h | 2 +- TFT_Drivers/ILI9481_Init.h | 10 +++++++++- TFT_eSPI.h | 2 +- library.json | 2 +- library.properties | 2 +- 12 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Processors/TFT_eSPI_ESP32.c b/Processors/TFT_eSPI_ESP32.c index 1b519bf..7a7de75 100644 --- a/Processors/TFT_eSPI_ESP32.c +++ b/Processors/TFT_eSPI_ESP32.c @@ -173,7 +173,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len) } //////////////////////////////////////////////////////////////////////////////////////// -#elif !defined (ILI9488_DRIVER) && !defined (TFT_PARALLEL_8_BIT) // Most displays +#elif !defined (ILI9481_DRIVER) && !defined (ILI9488_DRIVER) && !defined (TFT_PARALLEL_8_BIT) // Most displays //////////////////////////////////////////////////////////////////////////////////////// /*************************************************************************************** @@ -349,7 +349,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){ } //////////////////////////////////////////////////////////////////////////////////////// -#elif defined (ILI9488_DRIVER) && !defined (TFT_PARALLEL_8_BIT)// Now code for ILI9488 +#elif (defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER)) && !defined (TFT_PARALLEL_8_BIT)// Now code for ILI9481/8 //////////////////////////////////////////////////////////////////////////////////////// /*************************************************************************************** diff --git a/Processors/TFT_eSPI_ESP32.h b/Processors/TFT_eSPI_ESP32.h index d1cca5f..b5aff26 100644 --- a/Processors/TFT_eSPI_ESP32.h +++ b/Processors/TFT_eSPI_ESP32.h @@ -52,7 +52,7 @@ #endif // Code to check if DMA is busy, used by SPI bus transaction transaction and endWrite functions -#if !defined(TFT_PARALLEL_8_BIT) && !defined(ILI9488_DRIVER) && !defined (RPI_DISPLAY_TYPE) +#if !defined(TFT_PARALLEL_8_BIT) && !defined(ILI9481_DRIVER) && !defined(ILI9488_DRIVER) && !defined (RPI_DISPLAY_TYPE) || (defined (RPI_DISPLAY_TYPE) && defined (ST7796_DRIVER)) #define ESP32_DMA // Code to check if DMA is busy, used by SPI DMA + transaction + endWrite functions #define DMA_BUSY_CHECK dmaWait() @@ -351,7 +351,7 @@ //////////////////////////////////////////////////////////////////////////////////////// // Macros to write commands/pixel colour data to an ILI9488 TFT //////////////////////////////////////////////////////////////////////////////////////// -#elif defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB +#elif defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER)// 16 bit colour converted to 3 bytes for 18 bit RGB // Write 8 bits to TFT #define tft_Write_8(C) spi.transfer(C) diff --git a/Processors/TFT_eSPI_ESP8266.c b/Processors/TFT_eSPI_ESP8266.c index 31e87e7..e621242 100644 --- a/Processors/TFT_eSPI_ESP8266.c +++ b/Processors/TFT_eSPI_ESP8266.c @@ -109,7 +109,7 @@ void TFT_eSPI::pushSwapBytePixels(const void* data_in, uint32_t len){ } //////////////////////////////////////////////////////////////////////////////////////// -#elif defined (ILI9488_DRIVER) +#elif defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER) //////////////////////////////////////////////////////////////////////////////////////// /*************************************************************************************** diff --git a/Processors/TFT_eSPI_ESP8266.h b/Processors/TFT_eSPI_ESP8266.h index 3b475cf..5dae7a2 100644 --- a/Processors/TFT_eSPI_ESP8266.h +++ b/Processors/TFT_eSPI_ESP8266.h @@ -117,7 +117,7 @@ //////////////////////////////////////////////////////////////////////////////////////// // Macros to write commands/pixel colour data to an ILI9488 TFT //////////////////////////////////////////////////////////////////////////////////////// -#if defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB +#if defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB // Write 8 bits to TFT #define tft_Write_8(C) spi.transfer(C) diff --git a/Processors/TFT_eSPI_Generic.c b/Processors/TFT_eSPI_Generic.c index fbc6f66..011bcd0 100644 --- a/Processors/TFT_eSPI_Generic.c +++ b/Processors/TFT_eSPI_Generic.c @@ -168,7 +168,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len) } //////////////////////////////////////////////////////////////////////////////////////// -#elif defined (ILI9488_DRIVER) // For 24 bit SPI colour TFT +#elif defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER) // For 24 bit SPI colour TFT //////////////////////////////////////////////////////////////////////////////////////// /*************************************************************************************** diff --git a/Processors/TFT_eSPI_Generic.h b/Processors/TFT_eSPI_Generic.h index e5a2310..b8fd250 100644 --- a/Processors/TFT_eSPI_Generic.h +++ b/Processors/TFT_eSPI_Generic.h @@ -94,7 +94,7 @@ //////////////////////////////////////////////////////////////////////////////////////// // Macros to write commands/pixel colour data to an ILI9488 TFT //////////////////////////////////////////////////////////////////////////////////////// -#if defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB +#if defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB // Write 8 bits to TFT #define tft_Write_8(C) spi.transfer(C) diff --git a/Processors/TFT_eSPI_STM32.c b/Processors/TFT_eSPI_STM32.c index bb1147b..c1cb6ad 100644 --- a/Processors/TFT_eSPI_STM32.c +++ b/Processors/TFT_eSPI_STM32.c @@ -260,7 +260,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len) } //////////////////////////////////////////////////////////////////////////////////////// -#elif defined (ILI9488_DRIVER) // For 24 bit colour TFT ############# UNTESTED ################### +#elif defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER) // For 24 bit colour TFT ############# UNTESTED ################### //////////////////////////////////////////////////////////////////////////////////////// /*************************************************************************************** diff --git a/Processors/TFT_eSPI_STM32.h b/Processors/TFT_eSPI_STM32.h index 943fe2b..9c04fb6 100644 --- a/Processors/TFT_eSPI_STM32.h +++ b/Processors/TFT_eSPI_STM32.h @@ -987,7 +987,7 @@ //////////////////////////////////////////////////////////////////////////////////////// // Macros to write commands/pixel colour data to a SPI ILI9488 TFT //////////////////////////////////////////////////////////////////////////////////////// -#elif defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB +#elif defined (ILI9481_DRIVER) || defined (ILI9488_DRIVER) // 16 bit colour converted to 3 bytes for 18 bit RGB // Write 8 bits to TFT #define tft_Write_8(C) \ diff --git a/TFT_Drivers/ILI9481_Init.h b/TFT_Drivers/ILI9481_Init.h index 038d1fd..8b0809d 100644 --- a/TFT_Drivers/ILI9481_Init.h +++ b/TFT_Drivers/ILI9481_Init.h @@ -53,7 +53,15 @@ writedata(0x0A); writecommand(0x3A); - writedata(0x55); + #ifdef TFT_PARALLEL_8_BIT + writedata(0x55); // 16 bit colour interface + #else + writedata(0x66); // 18 bit colour interface + #endif + + #ifndef TFT_PARALLEL_8_BIT + writecommand(TFT_INVON); + #endif writecommand(TFT_CASET); writedata(0x00); diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 9b06a75..71dc8d6 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -16,7 +16,7 @@ #ifndef _TFT_eSPIH_ #define _TFT_eSPIH_ -#define TFT_ESPI_VERSION "2.3.4" +#define TFT_ESPI_VERSION "2.3.41" // Bit level feature flags // Bit 0 set: viewport capability diff --git a/library.json b/library.json index a353b11..b2bd456 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "2.3.4", + "version": "2.3.41", "keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140", "description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32", "repository": diff --git a/library.properties b/library.properties index 1ac9203..eb41ad3 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=2.3.4 +version=2.3.41 author=Bodmer maintainer=Bodmer sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32