Commit 84a69457 authored by Bodmer's avatar Bodmer

Updates for ESP32C3

parent 9bf9c094
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
// DMA SPA handle // DMA SPA handle
spi_device_handle_t dmaHAL; spi_device_handle_t dmaHAL;
#ifdef CONFIG_IDF_TARGET_ESP32 #ifdef CONFIG_IDF_TARGET_ESP32
#define DMA_CHANNEL 1
#ifdef USE_HSPI_PORT #ifdef USE_HSPI_PORT
spi_host_device_t spi_host = HSPI_HOST; spi_host_device_t spi_host = HSPI_HOST;
#else // use VSPI port #else // use VSPI port
...@@ -36,9 +37,11 @@ ...@@ -36,9 +37,11 @@
#endif #endif
#else #else
#ifdef USE_HSPI_PORT #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 #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 #endif
#endif #endif
...@@ -774,7 +777,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs) ...@@ -774,7 +777,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
.pre_cb = 0, //dc_callback, //Callback to handle D/C line .pre_cb = 0, //dc_callback, //Callback to handle D/C line
.post_cb = 0 .post_cb = 0
}; };
ret = spi_bus_initialize(spi_host, &buscfg, 1); ret = spi_bus_initialize(spi_host, &buscfg, DMA_CHANNEL);
ESP_ERROR_CHECK(ret); ESP_ERROR_CHECK(ret);
ret = spi_bus_add_device(spi_host, &devcfg, &dmaHAL); ret = spi_bus_add_device(spi_host, &devcfg, &dmaHAL);
ESP_ERROR_CHECK(ret); ESP_ERROR_CHECK(ret);
......
...@@ -12,6 +12,23 @@ ...@@ -12,6 +12,23 @@
#include "soc/spi_reg.h" #include "soc/spi_reg.h"
#include "driver/spi_master.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 // SUPPORT_TRANSACTIONS is mandatory for ESP32 so the hal mutex is toggled
#if !defined (SUPPORT_TRANSACTIONS) #if !defined (SUPPORT_TRANSACTIONS)
#define SUPPORT_TRANSACTIONS #define SUPPORT_TRANSACTIONS
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_ #ifndef _TFT_eSPIH_
#define _TFT_eSPIH_ #define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.3.83" #define TFT_ESPI_VERSION "2.3.84"
// Bit level feature flags // Bit level feature flags
// Bit 0 set: viewport capability // Bit 0 set: viewport capability
......
{ {
"name": "TFT_eSPI", "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", "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", "description": "A TFT and ePaper SPI graphics library with optimisation for Raspberry Pi Pico, ESP8266, ESP32 and STM32",
"repository": "repository":
......
name=TFT_eSPI name=TFT_eSPI
version=2.3.83 version=2.3.84
author=Bodmer author=Bodmer
maintainer=Bodmer maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32 sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment