Skip to content

Commit

Permalink
Allow ESP32 SPI pins to be undefined
Browse files Browse the repository at this point in the history
See #618
  • Loading branch information
Bodmer committed May 13, 2020
1 parent 1314a34 commit cd10a92
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Processors/TFT_eSPI_ESP32.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ bool TFT_eSPI::initDMA(void)
void TFT_eSPI::deInitDMA(void)
{
if (!DMA_Enabled) return;

spi_bus_remove_device(dmaHAL);
spi_bus_free(spi_host);
DMA_Enabled = false;
}
Expand Down
58 changes: 55 additions & 3 deletions Processors/TFT_eSPI_ESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,64 @@
#endif

////////////////////////////////////////////////////////////////////////////////////////
// Make sure TFT_MISO is defined if not used to avoid an error message
// Make sure SPI default pins are assigned if not specified by user or set to -1
////////////////////////////////////////////////////////////////////////////////////////
#if !defined (TFT_PARALLEL_8_BIT)
#ifndef TFT_MISO
#define TFT_MISO -1

#ifdef USE_HSPI_PORT

#ifndef TFT_MISO
#define TFT_MISO 12
#endif
#if (TFT_MISO == -1)
#undef TFT_MISO
#define TFT_MISO 12
#endif

#ifndef TFT_MOSI
#define TFT_MOSI 13
#endif
#if (TFT_MOSI == -1)
#undef TFT_MOSI
#define TFT_MOSI 13
#endif

#ifndef TFT_SCLK 14
#define TFT_SCLK
#endif
#if (TFT_SCLK == -1)
#undef TFT_SCLK
#define TFT_SCLK 14
#endif

#else // VSPI port

#ifndef TFT_MISO
#define TFT_MISO 19
#endif
#if (TFT_MISO == -1)
#undef TFT_MISO
#define TFT_MISO 19
#endif

#ifndef TFT_MOSI
#define TFT_MOSI 23
#endif
#if (TFT_MOSI == -1)
#undef TFT_MOSI
#define TFT_MOSI 23
#endif

#ifndef TFT_SCLK
#define TFT_SCLK 18
#endif
#if (TFT_SCLK == -1)
#undef TFT_SCLK
#define TFT_SCLK 18
#endif

#endif

#endif

////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion TFT_eSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_
#define _TFT_eSPIH_

#define TFT_ESPI_VERSION "2.2.7"
#define TFT_ESPI_VERSION "2.2.8"

/***************************************************************************************
** Section 1: Load required header files
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TFT_eSPI",
"version": "2.2.7",
"version": "2.2.8",
"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":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TFT_eSPI
version=2.2.7
version=2.2.8
author=Bodmer
maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
Expand Down

0 comments on commit cd10a92

Please sign in to comment.