From 9cad339bc7963cc13297d15bcec4653834e086e7 Mon Sep 17 00:00:00 2001 From: Bernd Giesecke Date: Wed, 11 Oct 2017 16:18:37 +0800 Subject: [PATCH] ESP32 Change use of SPI transactions Using the SUPPORT_TRANSACTIONS define to initialize SPI on ESP32 with or without transaction support. --- TFT_eSPI.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 0189854..93b0a94 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -192,9 +192,16 @@ void TFT_eSPI::init(void) SPI.setFrequency(SPI_FREQUENCY); #ifdef ESP32 // Unlock the SPI hal mutex and set the lock management flags - SPI.beginTransaction(SPISettings(SPI_FREQUENCY, MSBFIRST, SPI_MODE0)); - inTransaction = true; // Flag to stop intermediate spi_end calls - locked = false; // Flag to stop repeat beginTransaction calls + #ifdef SUPPORT_TRANSACTIONS + SPI.beginTransaction(SPISettings(SPI_FREQUENCY, MSBFIRST, SPI_MODE0)); + inTransaction = true; // Flag to stop intermediate spi_end calls + locked = false; // Flag to stop repeat beginTransaction calls + #else + SPI.begin(TFT_SCLK,TFT_MISO,TFT_MOSI); + SPI.setFrequency(SPI_FREQUENCY); + SPI.setBitOrder(MSBFIRST); + SPI.setDataMode(SPI_MODE0); + #endif #endif #endif