pimoroni-pico/drivers/st7789
Mike Bell 799ed0786d Use DMA for SPI frame buffer too 2022-09-17 20:16:57 +01:00
..
CMakeLists.txt Cleaner RASET, CASET and MADCTL handling 2021-03-29 13:18:31 +01:00
README.md ST7789/PicoGraphics: Update docs. 2022-06-13 20:12:03 +01:00
st7789.cmake ST7789: Convert Parallel IO to PIO + DMA. 2022-06-17 11:03:55 +01:00
st7789.cpp Use DMA for SPI frame buffer too 2022-09-17 20:16:57 +01:00
st7789.hpp Use DMA for SPI frame buffer too 2022-09-17 20:16:57 +01:00
st7789_parallel.pio ST7789: Convert Parallel IO to PIO + DMA. 2022-06-17 11:03:55 +01:00

README.md

ST7789 Display Driver for Pimoroni LCDs

The ST7789 driver supports both Parallel and Serial (SPI) ST7789 displays and is intended for use with:

  • Pico Display
  • Pico Display 2.0
  • Tufty 2040
  • Pico Explorer
  • 240x240 Round & Square SPI LCD Breakouts

Setup

Construct an instance of the ST7789 driver with either Parallel or SPI pins.

Parallel:

ST7789 st7789(WIDTH, HEIGHT, ROTATE_0, {
    Tufty2040::LCD_CS,   // Chip-Select
    Tufty2040::LCD_DC,   // Data-Command
    Tufty2040::LCD_WR,   // Write
    Tufty2040::LCD_RD,   // Read
    Tufty2040::LCD_D0,   // Data 0 (start of a bank of 8 pins)
    Tufty2040::BACKLIGHT // Backlight
});

SPI:

ST7789 st7789(WIDTH, HEIGHT, ROTATE_0, false, {
    PIMORONI_SPI_DEFAULT_INSTANCE, // SPI instance
    SPI_BG_FRONT_CS,               // Chip-select
    SPI_DEFAULT_SCK,               // SPI Clock
    SPI_DEFAULT_MOSI,              // SPI Out
    PIN_UNUSED,                    // SPI In
    SPI_DEFAULT_DC,                // SPI Data/Command
    PIN_UNUSED                     // Backlight
});

Reference

Update

ST7789's update accepts an instance of PicoGraphics in any colour mode:

st7789.update(&graphics);

Set Backlight

If a backlight pin has been configured, you can set the backlight from 0 to 255:

st7789.set_backlight(128)