diff --git a/Processors/TFT_eSPI_ESP32.c b/Processors/TFT_eSPI_ESP32.c index 2c018e0..b72c3a2 100644 --- a/Processors/TFT_eSPI_ESP32.c +++ b/Processors/TFT_eSPI_ESP32.c @@ -29,6 +29,7 @@ // DMA SPA handle spi_device_handle_t dmaHAL; #ifdef CONFIG_IDF_TARGET_ESP32 + #define DMA_CHANNEL 1 #ifdef USE_HSPI_PORT spi_host_device_t spi_host = HSPI_HOST; #else // use VSPI port @@ -36,9 +37,11 @@ #endif #else #ifdef USE_HSPI_PORT - spi_host_device_t spi_host = (spi_host_device_t)1; // 1 scrambles display area! + #define DMA_CHANNEL 2 + spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes #else // use FSPI port - spi_host_device_t spi_host = (spi_host_device_t)1; // 1 draws once then freezes + #define DMA_CHANNEL 1 + spi_host_device_t spi_host = (spi_host_device_t) DMA_CHANNEL; // Draws once then freezes #endif #endif #endif @@ -774,7 +777,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs) .pre_cb = 0, //dc_callback, //Callback to handle D/C line .post_cb = 0 }; - ret = spi_bus_initialize(spi_host, &buscfg, 1); + ret = spi_bus_initialize(spi_host, &buscfg, DMA_CHANNEL); ESP_ERROR_CHECK(ret); ret = spi_bus_add_device(spi_host, &devcfg, &dmaHAL); ESP_ERROR_CHECK(ret); diff --git a/Processors/TFT_eSPI_ESP32.h b/Processors/TFT_eSPI_ESP32.h index 1dafd23..84a5038 100644 --- a/Processors/TFT_eSPI_ESP32.h +++ b/Processors/TFT_eSPI_ESP32.h @@ -12,6 +12,23 @@ #include "soc/spi_reg.h" #include "driver/spi_master.h" +// Fix IDF problems with ESP32C3 +#if CONFIG_IDF_TARGET_ESP32C3 + // Fix ESP32C3 IDF bug for missing definition + #ifndef REG_SPI_BASE + #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 ))) + #endif + + // Fix ESP32C3 IDF bug for name change + #ifndef SPI_MOSI_DLEN_REG + #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) + #endif + + // Fix ESP32C3 specific register reference + #define out_w1tc out_w1tc.val + #define out_w1ts out_w1ts.val +#endif + // SUPPORT_TRANSACTIONS is mandatory for ESP32 so the hal mutex is toggled #if !defined (SUPPORT_TRANSACTIONS) #define SUPPORT_TRANSACTIONS diff --git a/TFT_eSPI.h b/TFT_eSPI.h index d6c0a0a..dcacf12 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.83" +#define TFT_ESPI_VERSION "2.3.84" // Bit level feature flags // Bit 0 set: viewport capability diff --git a/library.json b/library.json index 872f3c1..9714763 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "2.3.83", + "version": "2.3.84", "keywords": "Arduino, tft, ePaper, display, Pico, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, RM68140, SSD1351, SSD1963, ILI9225, HX8357D", "description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32", "repository": diff --git a/library.properties b/library.properties index 5769750..f6450ce 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=2.3.83 +version=2.3.84 author=Bodmer maintainer=Bodmer sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32