API referencestd/embedded

std/embedded/display/st7789

Public declarations, types, methods, and source contracts for std/embedded/display/st7789.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "std/embedded/display/st7789"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
display std/embedded/display st7789.dodo
graphics std/graphics st7789.dodo
hal std/embedded/hal st7789.dodo

MEMORY_WIDTH

Constant · Source

The controller’s memory, in its own orientation.

pub const MEMORY_WIDTH: u32 = 240

MEMORY_HEIGHT

Constant · Source

pub const MEMORY_HEIGHT: u32 = 320

Panel

Struct · Source

How a panel is wired to the controller’s memory, in the controller’s orientation (Rotation.Deg0): its size, the memory column and row of its top-left pixel, whether it needs inverted colours, as IPS panels do, and whether its subpixels are in blue-green-red order.

pub struct Panel {
    pub width: u32
    pub height: u32
    pub column_offset: u32
    pub row_offset: u32
    pub inverted: bool
    pub bgr: bool
}

panel_240x240

Function · Source

1.3” and 1.54” square IPS panels.

pub fn panel_240x240() -> Panel

panel_240x320

Function · Source

2” and 2.4” panels that use the whole memory, such as the Pimoroni Pico Display Pack 2.0 (use Rotation.Deg90 for its landscape 320 x 240).

pub fn panel_240x320() -> Panel

panel_135x240

Function · Source

1.14” panels: the Pimoroni Pico Display Pack and the LILYGO T-Display.

pub fn panel_135x240() -> Panel

panel_240x280

Function · Source

1.69” panels with rounded corners.

pub fn panel_240x280() -> Panel

panel_172x320

Function · Source

1.47” panels.

pub fn panel_172x320() -> Panel

panel_170x320

Function · Source

1.9” panels.

pub fn panel_170x320() -> Panel

Rotation

Enum · Source

Clockwise rotation of the picture from the controller’s orientation. Deg90 and Deg270 swap the display’s width and height.

pub enum Rotation {
    Deg0,
    Deg90,
    Deg180,
    Deg270
}

Display

Struct · Source

pub struct Display<I: display.Interface> {
    // Private implementation fields omitted.
}

Display.new

Function · Source

Reset the controller by command and set it up for panel at rotation: RGB565 pixels, the panel’s colour inversion and order, and the display switched on. Takes about 300 ms of delays. The panel’s memory holds whatever it did before, so present a whole frame first. InvalidInput if the panel does not fit the controller’s memory.

pub fn new<D: hal.Delay>(wiring: I, panel: Panel, rotation: Rotation, delay: &mut D) -> Display<I>!hal.Error from(wiring)

Display.size

Function · Source

The display’s size at its rotation.

pub fn size(&self) -> graphics.Size

Display.format

Function · Source

pub fn format(&self) -> graphics.PixelFormat

Display.present

Function · Source

Send the part of dirty inside both the canvas and the display.

pub fn present(&mut self, canvas: &graphics.Canvas, dirty: graphics.Rect) -> void!graphics.Error

Display.fill

Function · Source

Fill the whole display with one colour, without a canvas: for example to clear a panel’s memory once after new.

pub fn fill(&mut self, color: graphics.Color) -> void!hal.Error

Display.set_inverted

Function · Source

Invert every colour; most IPS panels need this on to show colours correctly, which their Panel says.

pub fn set_inverted(&mut self, inverted: bool) -> void!hal.Error

Display.set_display_on

Function · Source

Blank the panel or show its memory again. The memory is kept, and presents still update it while the panel is blank.

pub fn set_display_on(&mut self, on: bool) -> void!hal.Error

Display.sleep

Function · Source

Enter sleep mode, which stops the panel and its oscillator; the memory is kept. Turn a backlight off separately.

pub fn sleep<D: hal.Delay>(&mut self, delay: &mut D) -> void!hal.Error

Display.wake

Function · Source

Leave sleep mode.

pub fn wake<D: hal.Delay>(&mut self, delay: &mut D) -> void!hal.Error

Display.wiring

Function · Source

The interface, for example to reach its bus between frames.

pub fn wiring(&mut self) -> &mut I from(self)

Display.release

Function · Source

Give back the interface.

pub fn release(self) -> I from(self)

rgb565

Function · Source

A colour as the panel’s 16-bit RGB565 value, as an Rgb565 canvas stores it.

pub fn rgb565(color: graphics.Color) -> u32

Search every guide, reference page, and API declaration.