USE TFT_eSPI with Elecrow 7in RGB screen
I have written a lengthy code using TFT_eSPI library for use on a TTGO Esp32 based small screen device and want transfer this code to a Crowpanel 7.0" HMI ESP32 display panel, which I have just purchased. For the TTGO I had to edit the TFT User select file to choose the correct display setting for TTGO , can I try to load the same code and just edit the User Select file for the Crowpanel? Or is it necessary to rewrite the code using the LovyanGFX library?
Comments
The TFT_eSPI library does not support our 7-inch board yet, so we need to rewrite the code, but the good news is that most of the function names and usage methods of the TFT_eSPI library and the lovyanGFX library are the same, so there is no need to modify too many places.
First, you need to put the driver configuration code of the lovyanGFX library in the project directory (code link: https://github.com/Elecrow-RD/CrowPanel-ESP32-Display-Course-File/blob/main/CrowPanel_ESP32_Tutorial/Code/V2.X/Lesson 6 Design UI with Squareline Studio/4.3-5-7inch/CrowPanel_ESP32_LVGL_Demo/gfx_conf.h)
Next, modify the macro in gfx_conf.h to the one used for 7 inches
Then, go back to the code you wrote and remove the function that declares the TFT_eSPI entity, for example:
TFT_eSPI lcd = TFT_eSPI(); /* TFT entity */
Finally, because I declared the LGFX entity as tft, you need to change all entities named "lcd" in your code to tft
from
lcd.begin();
totft.begin();
Or you can just change "LGFX tft" in the gfx_conf.h file to "LGFX lcd" and you don't need to modify so many "lcd."
thank you !