Commit d13f84e4 authored by Bodmer's avatar Bodmer

Re-work the support for bi-directional SDA line

Tested on ESP32 and ST7789V display only. It may not work with other
displays!

Use:
#define TFT_SDA_READ

in setup file to use bi-directional SDA pin support.
parent ef9e4660
......@@ -26,11 +26,11 @@ The Button class from Adafruit_GFX is incorporated, with the enhancement that th
The library supports SPI overlap on the ESP8266 so the TFT screen can share MOSI, MISO and SCLK pins with the program FLASH, this frees up GPIO pins for other uses.
The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-alased (smooth) font files in vlw format stored in SPIFFS are supported and in the case any 16 bit Unicode character can be included and rendered, this means many language specific characters can be rendered to the screen.
The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. Anti-alased (smooth) font files in vlw format stored in SPIFFS are supported. Any 16 bit Unicode character can be included and rendered, this means many language specific characters can be rendered to the screen.
The library is based on the Adafruit GFX and Adafruit driver libraries and the aim is to retain compatibility. Significant additions have been made to the library to boost the speed for ESP8266/ESP32 processors (it is typically 3 to 10 times faster) and to add new features. The new graphics functions include different size proportional fonts and formatting features. There are lots of example sketches to demonstrate the different features and included functions.
Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder, or by selecting a configuration in the library "User_Setup_Selet,h" file. Fonts and features can easily be disabled by commenting out lines.
Configuration of the library font selections, pins used to interface with the TFT and other features is made by editting the User_Setup.h file in the library folder, or by selecting your own configuration in the "User_Setup_Selet,h" file. Fonts and features can easily be enabled/disabled by commenting out lines.
# Anti-aliased Fonts
......
This diff is collapsed.
......@@ -341,13 +341,16 @@
#endif
#if !defined (ESP32_PARALLEL) && !defined (TFT_SDA_READ)
// Support SPI TFT reads using MISO line (not all displays support this)
#define tft_Read_8(C) SPI.transfer(C)
#else
// For reading from a TFT with single SDA data in/out pin
// Uses a function in the .cpp file to read a bidirectional SDA line, the
// tft_Read_8() function will bit bang SCLK and use MOSI as an input
#if !defined (ESP32_PARALLEL)
// Read from display using SPI or software SPI
#if defined (ESP8266) && defined (TFT_SDA_READ)
// Use a bit banged function call for ESP8266 and bi-directional SDA pin
#define SCLK_L GPOC=sclkpinmask
#define SCLK_H GPOS=sclkpinmask
#else
// Use a SPI read transfer
#define tft_Read_8() SPI.transfer(0)
#endif
#endif
......@@ -746,7 +749,11 @@ class TFT_eSPI : public Print {
size_t write(uint8_t);
#ifdef TFT_SDA_READ
uint8_t tft_Read_8(uint8_t dummy);
#if defined (ESP8266) && defined (TFT_SDA_READ)
uint8_t tft_Read_8(void);
#endif
void begin_SDA_Read(void);
void end_SDA_Read(void);
#endif
void getSetup(setup_t& tft_settings); // Sketch provides the instance to populate
......
......@@ -26,6 +26,11 @@
//#define ILI9488_DRIVER
//#define ST7789_DRIVER // Define the screen size below for this display
// Some displays support SPI reads via the MISO pin, if the display has a single
// bi-directional SDA pin the library will try to use bit banging to read the line
// To use the SDA line for reading data from the TFT uncomment the following line:
// #define TFT_SDA_READ
// For ST7789 ONLY, define the colour order if the blue and red are swapped on your display
// Try ONE option at a time to find the correct colour order for your display
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment