mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-07 14:44:43 +02:00
Add ESP32 S2 support
Tested with ESP32 board package 2.0.1 Additional boards manager URL may need to be updated to load the latest ESP32 board package!
This commit is contained in:
@@ -8,21 +8,38 @@
|
||||
|
||||
// Select the SPI port to use, ESP32 has 2 options
|
||||
#if !defined (TFT_PARALLEL_8_BIT)
|
||||
#ifdef USE_HSPI_PORT
|
||||
SPIClass spi = SPIClass(HSPI);
|
||||
#else // use default VSPI port
|
||||
//SPIClass& spi = SPI;
|
||||
SPIClass spi = SPIClass(VSPI);
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#ifdef USE_HSPI_PORT
|
||||
SPIClass spi = SPIClass(HSPI);
|
||||
#else // use default VSPI port
|
||||
//SPIClass& spi = SPI;
|
||||
SPIClass spi = SPIClass(VSPI);
|
||||
#endif
|
||||
#else
|
||||
#ifdef USE_HSPI_PORT
|
||||
SPIClass spi = SPIClass(HSPI);
|
||||
#else // use FSPI port
|
||||
//SPIClass& spi = SPI;
|
||||
SPIClass spi = SPIClass(FSPI);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ESP32_DMA
|
||||
// DMA SPA handle
|
||||
spi_device_handle_t dmaHAL;
|
||||
#ifdef USE_HSPI_PORT
|
||||
spi_host_device_t spi_host = HSPI_HOST;
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#ifdef USE_HSPI_PORT
|
||||
spi_host_device_t spi_host = HSPI_HOST;
|
||||
#else // use VSPI port
|
||||
spi_host_device_t spi_host = VSPI_HOST;
|
||||
#endif
|
||||
#else
|
||||
spi_host_device_t spi_host = VSPI_HOST;
|
||||
#ifdef USE_HSPI_PORT
|
||||
spi_host_device_t spi_host = (spi_host_device_t)1; // 1 scrambles display area!
|
||||
#else // use FSPI port
|
||||
spi_host_device_t spi_host = (spi_host_device_t)1; // 1 draws once then freezes
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -17,11 +17,37 @@
|
||||
#define SUPPORT_TRANSACTIONS
|
||||
#endif
|
||||
|
||||
/*
|
||||
ESP32:
|
||||
FSPI not defined
|
||||
HSPI = 2, uses SPI2
|
||||
VSPI = 3, uses SPI3
|
||||
|
||||
ESP32-S2:
|
||||
FSPI = 1, uses SPI2
|
||||
HSPI = 2, uses SPI3
|
||||
VSPI not defined
|
||||
|
||||
ESP32 C3:
|
||||
FSPI = 0, uses SPI2 ???? To be checked
|
||||
HSPI = 1, uses SPI3 ???? To be checked
|
||||
VSPI not defined
|
||||
|
||||
For ESP32/S2/C3:
|
||||
SPI1_HOST = 0
|
||||
SPI2_HOST = 1
|
||||
SPI3_HOST = 2
|
||||
*/
|
||||
|
||||
// ESP32 specific SPI port selection
|
||||
#ifdef USE_HSPI_PORT
|
||||
#define SPI_PORT HSPI
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define SPI_PORT HSPI //HSPI is port 2 on ESP32
|
||||
#else
|
||||
#define SPI_PORT 3 //HSPI is port 3 on ESP32 S2
|
||||
#endif
|
||||
#else
|
||||
#define SPI_PORT VSPI
|
||||
#define SPI_PORT 2 //FSPI(ESP32 S2) or VSPI (ESP32)
|
||||
#endif
|
||||
|
||||
#ifdef RPI_DISPLAY_TYPE
|
||||
|
12
TFT_eSPI.h
12
TFT_eSPI.h
@@ -16,7 +16,7 @@
|
||||
#ifndef _TFT_eSPIH_
|
||||
#define _TFT_eSPIH_
|
||||
|
||||
#define TFT_ESPI_VERSION "2.3.73"
|
||||
#define TFT_ESPI_VERSION "2.3.80"
|
||||
|
||||
// Bit level feature flags
|
||||
// Bit 0 set: viewport capability
|
||||
@@ -317,15 +317,19 @@ int32_t esp; // Processor code
|
||||
uint8_t trans; // SPI transaction support
|
||||
uint8_t serial; // Serial (SPI) or parallel
|
||||
uint8_t overlap; // ESP8266 overlap mode
|
||||
|
||||
/*
|
||||
#if defined (ESP32) // TODO: make generic for other processors
|
||||
#if defined (USE_HSPI_PORT)
|
||||
uint8_t port = HSPI;
|
||||
#else
|
||||
uint8_t port = VSPI;
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
uint8_t port = VSPI;
|
||||
#else
|
||||
uint8_t port = FSPI;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
*/
|
||||
uint16_t tft_driver; // Hexadecimal code
|
||||
uint16_t tft_width; // Rotation 0 width and height
|
||||
uint16_t tft_height;
|
||||
|
@@ -81,6 +81,8 @@
|
||||
|
||||
//#include <User_Setups/Setup60_RP2040_ILI9341.h> // Setup file for Raspberry Pi Pico with SPI ILI9341
|
||||
|
||||
//#include <User_Setups/Setup70_ESP32_S2_ILI9341.h> // Setup file for ESP32 S2 with SPI ILI9341
|
||||
|
||||
//#include <User_Setups/Setup135_ST7789.h> // Setup file for ESP8266 and ST7789 135 x 240 TFT
|
||||
|
||||
//#include <User_Setups/Setup136_LilyGo_TTV.h> // Setup file for ESP32 and Lilygo TTV ST7789 SPI bus TFT 135x240
|
||||
|
33
User_Setups/Setup70_ESP32_S2_ILI9341.h
Normal file
33
User_Setups/Setup70_ESP32_S2_ILI9341.h
Normal file
@@ -0,0 +1,33 @@
|
||||
// Setup for the ESP32 S2 with ILI9341 display
|
||||
// Note SPI DMA with ESP32 S2 is not currently supported
|
||||
|
||||
// See SetupX_Template.h for all options available
|
||||
#define ILI9341_DRIVER
|
||||
|
||||
// Typical board default pins
|
||||
#define TFT_CS 10 // 10 or 34
|
||||
|
||||
#define TFT_MOSI 11 // 11 or 35
|
||||
#define TFT_SCLK 12 // 12 or 36
|
||||
#define TFT_MISO 13 // 13 or 37
|
||||
|
||||
#define TFT_DC 14
|
||||
#define TFT_RST 15
|
||||
|
||||
#define LOAD_GLCD
|
||||
#define LOAD_FONT2
|
||||
#define LOAD_FONT4
|
||||
#define LOAD_FONT6
|
||||
#define LOAD_FONT7
|
||||
#define LOAD_FONT8
|
||||
#define LOAD_GFXFF
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// FSPI port will be used unless the following is defined
|
||||
#define USE_HSPI_PORT
|
||||
|
||||
//#define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000 // Maximum for ILI9341
|
||||
|
||||
#define SPI_READ_FREQUENCY 6000000 // 6 MHz is the maximum SPI read speed for the ST7789V
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TFT_eSPI",
|
||||
"version": "2.3.73",
|
||||
"version": "2.3.80",
|
||||
"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":
|
||||
|
@@ -1,5 +1,5 @@
|
||||
name=TFT_eSPI
|
||||
version=2.3.73
|
||||
version=2.3.80
|
||||
author=Bodmer
|
||||
maintainer=Bodmer
|
||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||
|
Reference in New Issue
Block a user