Remarks

ST7789
Status
Source code GitHub
NuGet package

The ST7789 is a display controller used to drive color displays over SPI using 12, 16 or 18 bbp. These displays require a backlight. These are typically paired with high pixel density displays, the most common being a 1.5" 240x240 display.

ST7789 displays typically use SPI mode 3, but you may find variants that require different modes.

The Meadow.Foundation ST7789 driver currently only supports 16bpp RGB565.

Purchasing

You can get ST7789 displays from the following suppliers:

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    St7789 display;
    GraphicsLibrary graphics;

    public MeadowApp ()
    {
        var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3);
        var spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config);

        display = new St7789(
            device: Device, 
            spiBus: spiBus,
            chipSelectPin: null,
            dcPin: Device.Pins.D01,
            resetPin: Device.Pins.D00,
            width: 240, height: 240);

        graphics = new GraphicsLibrary(display);

        graphics.CurrentFont = new Font8x8();
        graphics.Clear();
        graphics.DrawTriangle(10, 10, 50, 50, 10, 50, Meadow.Foundation.Color.Red);
        graphics.DrawRectangle(20, 15, 40, 20, Meadow.Foundation.Color.Yellow, false);
        graphics.DrawCircle(50, 50, 40, Meadow.Foundation.Color.Blue, false);
        graphics.DrawText(5, 5, "Meadow F7 SPI");
        graphics.Show();
    }
}

Sample projects available on GitHub

Circuit Example

To wire a ST7789 to your Meadow board, connect the following:

ST7789 Meadow Pin
GND GND
VCC 3V3
SCL SCK
SDA MOSI
RESET D00
DC D01

It should look like the following diagram:

Characteristic Locus
Inheritance System.Object DisplayBase TftSpiBase > St7789
Implements System.IDisposable
Inherited Members TftSpiBase.NO_OP TftSpiBase.MADCTL TftSpiBase.MADCTL_MY TftSpiBase.MADCTL_MX TftSpiBase.MADCTL_MV TftSpiBase.MADCTL_ML TftSpiBase.MADCTL_RGB TftSpiBase.MADCTL_BGR TftSpiBase.MADCTL_MH TftSpiBase.MADCTL_SS TftSpiBase.MADCTL_GS TftSpiBase.COLOR_MODE TftSpiBase.ColorMode TftSpiBase.colorMode TftSpiBase.Width TftSpiBase.Height TftSpiBase.dataCommandPort TftSpiBase.resetPort TftSpiBase.chipSelectPort TftSpiBase.spi TftSpiBase.spiDisplay TftSpiBase.spiBuffer TftSpiBase.spiReceive TftSpiBase.currentPen TftSpiBase.width TftSpiBase.height TftSpiBase.xMin TftSpiBase.xMax TftSpiBase.yMin TftSpiBase.yMax TftSpiBase.Data TftSpiBase.Command TftSpiBase.IsColorModeSupported(DisplayBase.DisplayColorMode) TftSpiBase.SetColorMode(DisplayBase.DisplayColorMode) TftSpiBase.Clear(Boolean) TftSpiBase.Clear(Color, Boolean) TftSpiBase.Clear(UInt16, Boolean) TftSpiBase.SetPenColor(Color) TftSpiBase.DrawPixel(Int32, Int32) TftSpiBase.DrawPixel(Int32, Int32, Boolean) TftSpiBase.DrawPixel(Int32, Int32, UInt16) TftSpiBase.DrawPixel(Int32, Int32, Color) TftSpiBase.DrawPixel(Int32, Int32, Byte, Byte, Byte) TftSpiBase.InvertPixel(Int32, Int32) TftSpiBase.InvertPixelRgb444(Int32, Int32) TftSpiBase.Show() TftSpiBase.Show(Int32, Int32, Int32, Int32) TftSpiBase.Write(Byte) TftSpiBase.Write(Byte[]) TftSpiBase.DelayMs(Int32) TftSpiBase.SendCommand(Byte) TftSpiBase.SendData(Int32) TftSpiBase.SendData(Byte) TftSpiBase.SendData(Byte[]) TftSpiBase.ClearScreen(UInt16) TftSpiBase.Dispose() DisplayBase.IgnoreOutOfBoundsPixels
Namespace Meadow.Foundation.Displays.Tft
Assembly TftSpi.dll

Syntax

public class St7789 : TftSpiBase, IDisposable

Constructors

St7789(IIODevice, ISpiBus, IPin, IPin, IPin, Int32, Int32, DisplayBase.DisplayColorMode)

Declaration
public St7789(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width, int height, DisplayBase.DisplayColorMode displayColorMode = DisplayBase.DisplayColorMode.Format12bppRgb444)

Parameters

Type Name Description
IIODevice device
ISpiBus spiBus
IPin chipSelectPin
IPin dcPin
IPin resetPin
System.Int32 width
System.Int32 height
DisplayBase.DisplayColorMode displayColorMode

Properties

DefautColorMode

Declaration
public override DisplayBase.DisplayColorMode DefautColorMode { get; }

Property Value

Type Description
DisplayBase.DisplayColorMode

Overrides

Methods

Initialize()

Declaration
protected override void Initialize()

Overrides

SetAddressWindow(Int32, Int32, Int32, Int32)

Declaration
protected override void SetAddressWindow(int x0, int y0, int x1, int y1)

Parameters

Type Name Description
System.Int32 x0
System.Int32 y0
System.Int32 x1
System.Int32 y1

Overrides

SetRotation(TftSpiBase.Rotation)

Declaration
public void SetRotation(TftSpiBase.Rotation rotation)

Parameters

Type Name Description
TftSpiBase.Rotation rotation