Skip to content

Commit cd10a92

Browse files
committed
Allow ESP32 SPI pins to be undefined
See #618
1 parent 1314a34 commit cd10a92

File tree

5 files changed

+59
-7
lines changed

5 files changed

+59
-7
lines changed

Processors/TFT_eSPI_ESP32.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ bool TFT_eSPI::initDMA(void)
705705
void TFT_eSPI::deInitDMA(void)
706706
{
707707
if (!DMA_Enabled) return;
708-
708+
spi_bus_remove_device(dmaHAL);
709709
spi_bus_free(spi_host);
710710
DMA_Enabled = false;
711711
}

Processors/TFT_eSPI_ESP32.h

+55-3
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,64 @@
166166
#endif
167167

168168
////////////////////////////////////////////////////////////////////////////////////////
169-
// Make sure TFT_MISO is defined if not used to avoid an error message
169+
// Make sure SPI default pins are assigned if not specified by user or set to -1
170170
////////////////////////////////////////////////////////////////////////////////////////
171171
#if !defined (TFT_PARALLEL_8_BIT)
172-
#ifndef TFT_MISO
173-
#define TFT_MISO -1
172+
173+
#ifdef USE_HSPI_PORT
174+
175+
#ifndef TFT_MISO
176+
#define TFT_MISO 12
177+
#endif
178+
#if (TFT_MISO == -1)
179+
#undef TFT_MISO
180+
#define TFT_MISO 12
181+
#endif
182+
183+
#ifndef TFT_MOSI
184+
#define TFT_MOSI 13
185+
#endif
186+
#if (TFT_MOSI == -1)
187+
#undef TFT_MOSI
188+
#define TFT_MOSI 13
189+
#endif
190+
191+
#ifndef TFT_SCLK 14
192+
#define TFT_SCLK
193+
#endif
194+
#if (TFT_SCLK == -1)
195+
#undef TFT_SCLK
196+
#define TFT_SCLK 14
197+
#endif
198+
199+
#else // VSPI port
200+
201+
#ifndef TFT_MISO
202+
#define TFT_MISO 19
203+
#endif
204+
#if (TFT_MISO == -1)
205+
#undef TFT_MISO
206+
#define TFT_MISO 19
207+
#endif
208+
209+
#ifndef TFT_MOSI
210+
#define TFT_MOSI 23
211+
#endif
212+
#if (TFT_MOSI == -1)
213+
#undef TFT_MOSI
214+
#define TFT_MOSI 23
215+
#endif
216+
217+
#ifndef TFT_SCLK
218+
#define TFT_SCLK 18
219+
#endif
220+
#if (TFT_SCLK == -1)
221+
#undef TFT_SCLK
222+
#define TFT_SCLK 18
223+
#endif
224+
174225
#endif
226+
175227
#endif
176228

177229
////////////////////////////////////////////////////////////////////////////////////////

TFT_eSPI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef _TFT_eSPIH_
1717
#define _TFT_eSPIH_
1818

19-
#define TFT_ESPI_VERSION "2.2.7"
19+
#define TFT_ESPI_VERSION "2.2.8"
2020

2121
/***************************************************************************************
2222
** Section 1: Load required header files

library.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "TFT_eSPI",
3-
"version": "2.2.7",
3+
"version": "2.2.8",
44
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
55
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
66
"repository":

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=TFT_eSPI
2-
version=2.2.7
2+
version=2.2.8
33
author=Bodmer
44
maintainer=Bodmer
55
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32

0 commit comments

Comments
 (0)