ESP32 Change use of SPI transactions

Using the SUPPORT_TRANSACTIONS define to initialize SPI on ESP32 with or without transaction support.
This commit is contained in:
Bernd Giesecke 2017-10-11 16:18:37 +08:00 committed by GitHub
parent 80b5d91ba4
commit 9cad339bc7
1 changed files with 10 additions and 3 deletions

View File

@ -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