Skip to content

How to use ST7789P3, 2.25 inch 76x284 TFT display #3804

@gecko9

Description

@gecko9

I need some help configuring the latest version (released Mar 7, 2024) of TFT_eSPI library for this display

I'm assuming that I can use the library as it's nearly working. In this case the obvious issues are the x and y offsets are off and colours are reversed but I don't know how to correct either of these properties in platformio.ini.
The display is used with the ESP8266, which I would like the display to operate with width as 284 and height as 76.

Any help or hints would be most welcome as I've all but run out of tinkering ideas. Thanks for a very good library.

Here are a couple of photos of the display
Image
Image

I'm using PlatformIO with the following platformio.ini settings:

[platformio]
data_dir = app

; Actual board used is esp12f
[env:esp12e]
board = esp12e
framework = arduino
; platform = espressif8266
platform = [email protected] ; force a recent version but still uses spiffs!
board_build.filesystem = littlefs ; spiffs is deprecated but still uses spiffs!
build_type = debug
monitor_filters = esp8266_exception_decoder

build_flags =
	-D USER_SETUP_LOADED=1 ; Prevent loading default User_Setup files
	-D ST7789_DRIVER=1
        -D TFT_WIDTH=284
        -D TFT_HEIGHT=76
	-D CGRAM_OFFSET

	-D TFT_MISO=-1 ; Define MISO pin (or -1 if not used)
	-D TFT_MOSI=13 ; Define MOSI pin
	-D TFT_SCLK=14 ; Define SCK pin
	-D TFT_CS=15 ; Define Chip Select pin
	-D TFT_DC=5 ; Define Data/Command pin
	-D TFT_RST=-1 ; Define Reset pin (or -1 if connected to ESP8266 RST)
	-D SPI_FREQUENCY=27000000 ; Define SPI clock frequency
	-D LOAD_GLCD=1
	-D LOAD_FONT2=1
  -D LOAD_FONT4=1
  -D LOAD_FONT6=1
  -D LOAD_FONT7=1
  -D LOAD_FONT8=1
  -D LOAD_GFXFF=1
  -D SMOOTH_FONT=1

monitor_speed = 115200
upload_speed = 921600
monitor_port = COM3
upload_port = COM3
lib_extra_dirs = ../SharedLib

The setup and text display for the photo above is:

#include <Arduino.h>
#include <TFT_eSPI.h> // Hardware-specific library
#include <SPI.h>

// ESP8266 Pin Assignement
// Recommended connections for the ESP8266's built-in SPI pins
#define SCLK 14
#define MOSI 13
#define CS 15
#define DC 5
#define RESET 4
#define FLASH_PIN 0 // Use as input pin
#define LED_PIN 2		// esp12f module on board LED
#define BL_PIN 16		// Display Backlight

TFT_eSPI tft = TFT_eSPI(); // Invoke library

setup()
{
    Serial.begin(115200);
	while (!Serial)
		;

	// use the built in button
	pinMode(BL_PIN, OUTPUT);

    tft.init();
	tft.setRotation(1); // rotate the screen orientation m = 0-3 or 4-7 for BMP drawing
	tft.fillScreen(TFT_WHITE); // <------ (colours are reversed)
	tft.setCursor(0, 0, 2);
	tft.setTextFont(4);
	tft.setTextColor(TFT_BLACK);; // <------ (colours are reversed)
	tft.println("Hello Piglet!");
	tft.println("H1ello Piglet!");
	tft.println("H2ello Piglet!"); // <------ ONLY SEEING THIS LINE
	digitalWrite(BL_PIN, 0); // on
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions