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 DisplayTftSpiBase > St7789
Implements System.IDisposable
Inherited Members DisplayTftSpiBase.ColorMode DisplayTftSpiBase.Width DisplayTftSpiBase.Height DisplayTftSpiBase.dataCommandPort DisplayTftSpiBase.resetPort DisplayTftSpiBase.chipSelectPort DisplayTftSpiBase.spi DisplayTftSpiBase.spiDisplay DisplayTftSpiBase.spiBuffer DisplayTftSpiBase.spiReceive DisplayTftSpiBase.currentPen DisplayTftSpiBase.width DisplayTftSpiBase.height DisplayTftSpiBase.xMin DisplayTftSpiBase.xMax DisplayTftSpiBase.yMin DisplayTftSpiBase.yMax DisplayTftSpiBase.Data DisplayTftSpiBase.Command DisplayTftSpiBase.Clear(Boolean) DisplayTftSpiBase.Clear(Color, Boolean) DisplayTftSpiBase.Clear(UInt16, Boolean) DisplayTftSpiBase.SetPenColor(Color) DisplayTftSpiBase.DrawPixel(Int32, Int32) DisplayTftSpiBase.DrawPixel(Int32, Int32, Boolean) DisplayTftSpiBase.DrawPixel(Int32, Int32, UInt16) DisplayTftSpiBase.DrawPixel(Int32, Int32, Color) DisplayTftSpiBase.DrawPixel(Int32, Int32, Byte, Byte, Byte) DisplayTftSpiBase.Show() DisplayTftSpiBase.Show(UInt32, UInt32, UInt32, UInt32) DisplayTftSpiBase.Write(Byte) DisplayTftSpiBase.Write(Byte[]) DisplayTftSpiBase.DelayMs(Int32) DisplayTftSpiBase.SendCommand(Byte) DisplayTftSpiBase.SendData(Int32) DisplayTftSpiBase.SendData(Byte) DisplayTftSpiBase.SendData(Byte[]) DisplayTftSpiBase.ClearScreen(UInt16) DisplayTftSpiBase.Dispose()
Namespace Meadow.Foundation.Displays.Tft
Assembly TftSpi.dll

Syntax

public class St7789 : DisplayTftSpiBase, IDisposable

Constructors

St7789(IIODevice, ISpiBus, IPin, IPin, IPin, UInt32, UInt32)

Declaration
public St7789(IIODevice device, ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, uint width, uint height)

Parameters

Type Name Description
IIODevice device
ISpiBus spiBus
IPin chipSelectPin
IPin dcPin
IPin resetPin
System.UInt32 width
System.UInt32 height

Methods

Initialize()

Declaration
protected override void Initialize()

Overrides

SetAddressWindow(UInt32, UInt32, UInt32, UInt32)

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

Parameters

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

Overrides

SetRotation(DisplayTftSpiBase.Rotation)

Declaration
public void SetRotation(DisplayTftSpiBase.Rotation rotation)

Parameters

Type Name Description
DisplayTftSpiBase.Rotation rotation