Skip to content

sitronlabs/SitronLabs_Sitronix_ST7789_Arduino_Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sitronix ST7789 Arduino Library

Arduino library for TFT displays based on the Sitronix ST7789 controller.

arduino-library-badge PlatformIO_Registry

Supported interfaces

Interface Status Notes
SPI, 4-Wires, Buffered ✔️ Works with local RGB565 buffer for fast rendering.

Features

  • Local framebuffer for efficient rendering
  • RGB565 color format (16-bit color)
  • Full Adafruit GFX compatibility
  • SPI interface with configurable speed
  • Rotation support
  • Display brightness control
  • Display inversion control

Usage

#include <st7789.h>
#include <SPI.h>

// Display dimensions
#define WIDTH  240
#define HEIGHT 320

// Pin definitions
#define PIN_CS  10
#define PIN_DC  9
#define PIN_RES 8

// SPI speed (Hz)
#define SPI_SPEED 40000000

// Buffer for framebuffer (RGB565: 2 bytes per pixel)
uint8_t display_buffer[WIDTH * HEIGHT * 2];

// Create display object
st7789 display(WIDTH, HEIGHT);

void setup() {
    // Initialize SPI
    SPI.begin();
    
    // Setup display
    display.setup(SPI, SPI_SPEED, PIN_CS, PIN_DC, PIN_RES, display_buffer);
    
    // Clear display
    display.clear();
    
    // Draw something
    display.fillScreen(ST77XX_BLACK);
    display.setTextColor(ST77XX_WHITE);
    display.setTextSize(2);
    display.setCursor(10, 10);
    display.print("Hello, ST7789!");
    
    // Send buffer to display
    display.display();
}

void loop() {
    // Your code here
}

Credits

About

Arduino library for TFT displays based on the Sitronix ST7789 controller.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages