//#define ADAFRUIT
#define TFT_ESPI
#ifdef ADAFRUIT
// INCLUYE CODEPAGE 437
#include <Adafruit_ILI9341.h>
//#include <Adafruit_ImageReader.h>
#define TFT_DC 2
#define TFT_CS 3
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
//Adafruit_Image img;
#define DEGREES ((char)0xf8)
#define OHM ((char)0xea)
#define ARROW_UP ((char)0x18)
#define ARROW_DOWN ((char)0x19)
#define ARROW_RIGHT ((char)0x1a)
#define ARROW_LEFT ((char)0x1b)
#endif
#ifdef TFT_ESPI
#include <TFT_eSPI.h>
#include <SPI.h> // this is needed for display
#define TFT_CS 3
#define TFT_DC 2
#define TFT_MOSI 11
#define TFT_SCLK 12
#define TFT_MISO 13
#define TFT_RESET 6
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library with default width and height
#endif
#include "background1.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32-S3!");
#ifdef ADAFRUIT
Serial.println("Adafruit ILI9341");
tft.begin();
tft.setRotation(1);
tft.cp437(true);
tft.fillScreen(ILI9341_BLUE);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(1);
tft.setCursor(0, 35);
tft.print("Hola, TFT");
tft.setTextColor(ILI9341_YELLOW);
tft.setTextSize(2);
tft.setCursor(0, 100);
tft.print("T:25.1"); tft.print((char)0xf8); tft.print("C H:19.6% L:1489");
tft.println();
tft.print(OHM);
tft.print(ARROW_UP);
tft.print(ARROW_DOWN);
tft.print(ARROW_LEFT);
tft.print(ARROW_RIGHT);
tft.println();
tft.drawRGBBitmap(
//random(-DRAGON_WIDTH , tft.width()),
//random(-DRAGON_HEIGHT, tft.height()),
0, 0,
// Some non-AVR MCU's have a "flat" memory model and don't
// distinguish between flash and RAM addresses. In this case,
// the RAM-resident-optimized drawRGBBitmap in the ILI9341
// library can be invoked by forcibly type-converting the
// PROGMEM bitmap pointer to a non-const uint16_t *.
(uint16_t *)back1,
320, 240);
#endif
#ifdef TFT_ESPI
Serial.println("TFT_eSPI");
tft.begin(); // initialize a ST7789 chip
Serial.println("FTF inicializado");
tft.setSwapBytes(true); // swap the byte order for pushImage() - corrects endianness
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
Serial.println("Voy a pintar la imagen");
tft.pushImage(0, 0, 320, 240, back1);
#endif
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}