Skip to main content

ST7735, ILI9163, ST7789, ILI9341

Driver for ST7735, ST7789 and similar LCD screens using SPI. The ST7735 driver also works for ILI9163C.

import { ST7789Driver } from "@devicescript/drivers"
import { ST7735Driver } from "@devicescript/drivers"
import { ILI9341Driver } from "@devicescript/drivers"

WaveShare Pico-LCD shield

I8080 not supported

The drivers use the SPI interface. The parallel interface (I8080) is not supported at the moment.

Hardware configuration

  • Configure the SPI connection
import { spi } from "@devicescript/spi"
import { pins } from "@dsboard/pico_w"

spi.configure({
mosi: pins.GP11,
sck: pins.GP10,
hz: 8_000_000,
})

Display

The driver implements the Display interface and can be used as various services. Using the driver through services provides a better simulation experience.

Driver

The devicescript-waveshare-pico-lcd uses the driver for a WaveShare Pico-LCD shield.

import * as ds from "@devicescript/core"
import { spi } from "@devicescript/spi"
import { pins } from "@dsboard/pico_w"
import { ST7789Driver } from "@devicescript/drivers"
import { Image } from "@devicescript/graphics"

spi.configure({
mosi: pins.GP11,
sck: pins.GP10,
hz: 8_000_000,
})

// backlight led
pins.GP13.setMode(ds.GPIOMode.OutputHigh)

const display = new ST7789Driver(Image.alloc(240, 136, 4), {
dc: pins.GP8,
cs: pins.GP9,
reset: pins.GP12,
// frmctr1: 0x0e_14_ff,
flip: false,
spi: spi,
offX: 40,
offY: 53,
})
await display.init()
display.image.print("Hello world!", 3, 10)
await display.show()