Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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 object TftSpiBase > St7789
Implements IGraphicsDisplay ISpiPeripheral IRotatableDisplay
Inherited Members TftSpiBase.SetAddressBuffer TftSpiBase.ColorMode TftSpiBase.Rotation TftSpiBase.Width TftSpiBase.Height TftSpiBase.PixelBuffer TftSpiBase.SpiBusSpeed TftSpiBase.SpiBusMode TftSpiBase.dataCommandPort TftSpiBase.resetPort TftSpiBase.chipSelectPort TftSpiBase.spiDisplay TftSpiBase.imageBuffer TftSpiBase.readBuffer TftSpiBase.Data TftSpiBase.Command TftSpiBase.nativeHeight TftSpiBase.nativeWidth TftSpiBase.setAddressLastX0 TftSpiBase.setAddressLastX1 TftSpiBase.setAddressLastY0 TftSpiBase.setAddressLastY1 TftSpiBase.IsColorTypeSupported(ColorMode) TftSpiBase.CreateBuffer(ColorMode, int, int) TftSpiBase.Clear(bool) TftSpiBase.Fill(Color, bool) TftSpiBase.WriteBuffer(int, int, IPixelBuffer) TftSpiBase.DrawPixel(int, int, bool) TftSpiBase.DrawPixel(int, int, Color) TftSpiBase.DrawPixel(int, int, byte, byte, byte) TftSpiBase.InvertPixel(int, int) TftSpiBase.Fill(int, int, int, int, Color) TftSpiBase.Show() TftSpiBase.Show(int, int, int, int) TftSpiBase.Write(byte) TftSpiBase.Write(byte[]) TftSpiBase.DelayMs(int) TftSpiBase.SendCommand(TftSpiBase.Register) TftSpiBase.SendCommand(TftSpiBase.LcdCommand) TftSpiBase.SendCommand(byte) TftSpiBase.SendData(int) TftSpiBase.SendData(byte) TftSpiBase.SendData(byte[]) TftSpiBase.Clear(Color) TftSpiBase.UpdateBuffer() object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Displays
Assembly TftSpi.dll

Syntax

public class St7789 : TftSpiBase, IGraphicsDisplay, ISpiPeripheral, IRotatableDisplay

Constructors

St7789(ISpiBus, IDigitalOutputPort, IDigitalOutputPort, IDigitalOutputPort, int, int, ColorMode)

Create a new St7789 color display object

Declaration
public St7789(ISpiBus spiBus, IDigitalOutputPort chipSelectPort, IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort, int width, int height, ColorMode colorMode = ColorMode.Format12bppRgb444)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus connected to display

IDigitalOutputPort chipSelectPort

Chip select output port

IDigitalOutputPort dataCommandPort

Data command output port

IDigitalOutputPort resetPort

Reset output port

int width

Width of display in pixels

int height

Height of display in pixels

ColorMode colorMode

The color mode to use for the display buffer

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

St7789(ISpiBus, IPin, IPin, IPin, int, int, ColorMode)

Create a new St7789 color display object

Declaration
public St7789(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin, int width, int height, ColorMode colorMode = ColorMode.Format12bppRgb444)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus connected to display

IPin chipSelectPin

Chip select pin

IPin dcPin

Data command pin

IPin resetPin

Reset pin

int width

Width of display in pixels

int height

Height of display in pixels

ColorMode colorMode

The color mode to use for the display buffer

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

Properties

DefaultColorMode

The default display color mode

Declaration
public override ColorMode DefaultColorMode { get; }

Property Value

Type Description
ColorMode

Overrides

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

DefaultSpiBusMode

The SPI bus mode for the device

Declaration
public override SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

Property Value

Type Description
SpiClockConfiguration.Mode

Overrides

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

DefaultSpiBusSpeed

SPI bus speed

Declaration
public override Frequency DefaultSpiBusSpeed { get; }

Property Value

Type Description
Frequency

Overrides

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

SupportedColorModes

The color modes supported by the display

Declaration
public override ColorMode SupportedColorModes { get; }

Property Value

Type Description
ColorMode

Overrides

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

Methods

Initialize()

Initialize the display

Declaration
protected override void Initialize()

Overrides

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

SetAddressWindow(int, int, int, int)

Set address window for display updates

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

Parameters

Type Name Description
int x0

X start in pixels

int y0

Y start in pixels

int x1

X end in pixels

int y1

Y end in pixels

Overrides

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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:

SetRotation(RotationType)

Set the display rotation

Declaration
public void SetRotation(RotationType rotation)

Parameters

Type Name Description
RotationType rotation

The rotation value

Remarks

St7789
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Displays.TftSpi

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

MicroGraphics graphics;
St7789 display;

public override Task Initialize()
{
    Resolver.Log.Info("Initializing ...");

    var spiBus = Device.CreateSpiBus();

    display = new St7789(
        spiBus: spiBus,
        chipSelectPin: Device.Pins.A03,
        dcPin: Device.Pins.A04,
        resetPin: Device.Pins.A05,
        width: 240, height: 240, colorMode: ColorMode.Format16bppRgb565);

    display.Clear(Color.AliceBlue);
    display.Show();

    graphics = new MicroGraphics(display)
    {
        Rotation = RotationType._90Degrees,
        IgnoreOutOfBoundsPixels = true
    };

    return base.Initialize();
}

public override Task Run()
{
    graphics.Clear(true);

    graphics.DrawRectangle(120, 0, 120, 220, Color.White, true);
    graphics.DrawRectangle(0, 0, 120, 20, Color.Red, true);
    graphics.DrawRectangle(0, 20, 120, 20, Color.Purple, true);
    graphics.DrawRectangle(0, 40, 120, 20, Color.Blue, true);
    graphics.DrawRectangle(0, 60, 120, 20, Color.Green, true);
    graphics.DrawRectangle(0, 80, 120, 20, Color.Yellow, true);
    graphics.DrawRectangle(0, 100, 120, 20, Color.Orange, true);

    graphics.Show();

    DisplayTest();

    return base.Run();
}

Sample project(s) available on GitHub

Wiring 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: