Bodmer / TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
Other
3.69k stars 1.07k forks source link

Not working with Waveshare ST7789V2 rounded display #3452

Open step135 opened 1 month ago

step135 commented 1 month ago

I use ESP32 CAM.

User_Setup.h

#define ST7789_2_DRIVER  // Use this definition for ST7789v2

// Define the display size
#define TFT_WIDTH  240     // ST7789v2 240 x 240 pixels
#define TFT_HEIGHT 280     // Change this if your display has a different resolution

// initialization sequence
#define TFT_INIT_DELAY 0x01

// Define the pins used for the display
#define TFT_MOSI  13       // Data out (MOSI)
#define TFT_SCLK  14       // Clock out (SCLK)
#define TFT_CS    15       // Chip select control pin (if used), set to -1 if not connected
#define TFT_DC    2       // Data/Command control pin (DC)
#define TFT_RST   12       // Reset pin (RST)

// Optional: Set the backlight pin if available
// #define TFT_BL   16      // Backlight control pin

// Set the SPI frequency
#define SPI_FREQUENCY  27000000 // 27 MHz (adjust as needed)

text.ino

#include <TFT_eSPI.h>   // Include the graphics library (this includes the SPI library)

// Create an instance of the display driver
TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h

void setup() {
  Serial.begin(115200);
  Serial.println("mx TFT2 started");

  pinMode(TFT_RST, OUTPUT);
  digitalWrite(TFT_RST, LOW);
  delay(50);  // Hold reset low for 50ms
  digitalWrite(TFT_RST, HIGH);
  delay(50);  // Wait for display to reset

  tft.init();
  tft.setRotation(1); // Set display rotation

  tft.fillScreen(TFT_BLUE); // Clear the screen
  tft.invertDisplay(true);
  tft.setTextColor(TFT_WHITE, TFT_BLACK);  // Set text color to white with black background
  tft.setTextSize(2); // Set the text size

  tft.setCursor(10, 10); // Set cursor position
  tft.print("Hello World! ST7789v2"); // Print "Hello World!" on the screen

  tft.setTextSize(6);
  tft.setTextColor(TFT_RED, TFT_ORANGE);
  tft.setCursor(10, 50);
  tft.print("end");

  Serial.println("end printed on TFT");
}

void loop() {
  if(true){
  tft.init();
  tft.setRotation(0); // Set display rotation

  //tft.fillScreen(TFT_BLUE); // Clear the screen
  tft.setTextColor(TFT_WHITE, TFT_BLACK);  // Set text color to white with black background
  tft.setTextSize(4); // Set the text size
  tft.setCursor(10, 150);
  tft.print("loop");
  Serial.println("loop on TFT");
  delay(5000);
  }
}
anishkarbhari commented 4 days ago

I'm also facing a similar issue. If you have got any update on this please do share here

anishkarbhari commented 4 days ago

https://forum.lvgl.io/t/facing-st7789v2-240-280-display-issue-using-lvgl-display-look-black-not-showing-ui/14795

You could try this once, although it did not work for me!