You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#define ST7789_2_DRIVER // Minimal configuration option, define additional parameters below for this display
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
#define TFT_HEIGHT 320 // ST7789 240 x 320
#define TFT_INVERSION_OFF
#define TFT_MOSI 21 // In some display driver board, it might be written as "SDA" and so on.
#define TFT_SCLK 12
#define TFT_CS 14 // Chip select control pin
#define TFT_DC 13 // Data Command control pin
#define TFT_RST -1 // Reset pin (could connect to Arduino RESET pin)
#define TOUCH_CS -1
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 27000000
#define SPI_READ_FREQUENCY 6000000
#define SPI_TOUCH_FREQUENCY 2500000
#define USE_HSPI_PORT
Code:
#include "SPI.h"
#include "TFT_eSPI.h"
TFT_eSPI tft = TFT_eSPI();
void setup() {
Serial.begin(115200);
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
test_rorate();
// test_text();
}
voide loop() {
}
void test_rorate(void)
{
tft.fillScreen(TFT_BLACK);
tft.setRotation(0);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(1);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(2);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(3);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(4);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(5);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(6);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(1000);
tft.fillScreen(TFT_BLACK);
tft.setRotation(7);
tft.setCursor(100,100);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.println("Hello World!");
delay(10000);
}
void test_text() {
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
tft.setViewport(0+2, 0+2, tft.width()-1-2, tft.height()-1-2);
tft.frameViewport(TFT_RED, 1);
int x0 = 5;
int y0 = 5;
int x1 = tft.width()-1-5;
int y1 = tft.height()-1-5;
int padding = 20;
tft.drawLine(x0, y0, x1, y0, TFT_RED); // Left Top -> Right Top
tft.drawLine(x1, y0, x1, y1, TFT_GREEN); // Right Top -> Right Bottom
tft.drawLine(x1, y1, x0, y1, TFT_BLUE); // Right Bottom -> Left Bottom
tft.drawLine(x0, y1, x0, y0, TFT_YELLOW); // Left Bottom -> Left Top
tft.setTextSize(2);
tft.setTextColor(TFT_RED);
tft.setCursor(x0 + padding, y0 + padding); // Left Top
tft.println("1");
tft.setTextColor(TFT_GREEN);
tft.setCursor(x1 - padding, y0 + padding); // Right Top
tft.println("2");
tft.setTextColor(TFT_BLUE);
tft.setCursor(x1 - padding, y1 - padding); // Right Bottom
tft.println("3");
tft.setTextColor(TFT_YELLOW);
tft.setCursor(x0 + padding, y1-padding); // Left Bottom
tft.println("4");
delay(10000);
}
Operational Status and Issues:
Can display full screen
Colors are correct
But the Y-axis is mirrored
The specific display results can be seen in the image below:
The text was updated successfully, but these errors were encountered:
Hardware:
Board: DFRobot K10, ESP32S3
Screen: ST7789V2
Soft:
Arduino IDE: 2.3.4
Arduino-ESP32: 3.0.7
TFT_eSPI: 2.5.43
User_Setup.h:
Code:
Operational Status and Issues:
The specific display results can be seen in the image below:
The text was updated successfully, but these errors were encountered: