/*
This sketch reads the user setup information from the processor via the Serial Port
It is a support and diagnostic sketch for the TFT_eSPI library:
https://github.com/Bodmer/TFT_eSPI
The output is essentially a copy of the User_Setep configuration so can be used to
verify the correct settings are being picked up by the compiler.
If support is needed the output can be cut and pasted into an Arduino Forum post and
already includes the formatting [code]...[/code] markups.
Written by Bodmer 9/4/18
*/
//>>>>> Note: STM32 pin references above D15 may not reflect board markings <<<<<
#include <SPI.h>
#include <TFT_eSPI.h> // Graphics library
#define TFT_MISO -1
#define TFT_MOSI 3
#define TFT_SCLK 2
#define TFT_CS 1 // Chip select control pin D8
#define TFT_DC 0 // Data Command control pin
#define TFT_RST 8 // Reset pin (could connect to NodeMCU RST, see next line)
#define TOUCH_CS -1
TFT_eSPI tft = TFT_eSPI(); // Invoke library
setup_t user; // The library defines the type "setup_t" as a struct
// Calling tft.getSetup(user) populates it with the settings
//------------------------------------------------------------------------------------------
void setup() {
// Use serial port
Serial1.begin(9600);
pinMode(16, OUTPUT);
Serial1.println("\nPins:");
Serial1.println(TFT_MISO); // TFT:??? (shied OUT to MCU IN (note necessary here)
Serial1.println(TFT_MOSI); // TFT:SDA (MCU OUT to shied IN)
Serial1.println(TFT_SCLK); // TFT:SCL
Serial1.println(TFT_CS); // TFT:CS
Serial1.println(TFT_DC); // TFT:DC
Serial1.println(TFT_RST); // TFT:RST
Serial1.println(TOUCH_CS); // TFT:???
Serial1.println(USER_SETUP_INFO);
Serial1.print("W: ");
Serial1.print(TFT_WIDTH);
Serial1.print(" H: ");
Serial1.print(TFT_HEIGHT);
Serial1.print(" F: ");
Serial1.println(SPI_FREQUENCY);
#if defined (ARDUINO_ARCH_RP2040)
Serial1.println("ARDUINO_ARCH_RP2040");
#endif
#if defined (ILI9341_DRIVER)
Serial1.println("ILI9341_DRIVER");
#endif
#if defined (RP2040_PIO_SPI)
Serial1.println("RP2040_PIO_SPI");
#endif
// Initialise the TFT screen
tft.init();
digitalWrite(16, HIGH);
}
//------------------------------------------------------------------------------------------
void loop(void) {
}