API referencestd/embedded

std/embedded/display/ssd1306

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

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/ssd1306"

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 ssd1306.dodo
graphics std/graphics ssd1306.dodo
hal std/embedded/hal ssd1306.dodo

ADDRESS

Constant · Source

The usual I2C addresses, chosen by a jumper or pad on the module.

pub const ADDRESS: u8 = 0x3C

ALTERNATE_ADDRESS

Constant · Source

pub const ALTERNATE_ADDRESS: u8 = 0x3D

MEMORY_WIDTH

Constant · Source

The controller’s memory: 128 columns of 8 pages.

pub const MEMORY_WIDTH: u32 = 128

MEMORY_HEIGHT

Constant · Source

pub const MEMORY_HEIGHT: u32 = 64

Panel

Struct · Source

How a panel is wired to the controller: its size, the memory column of its left edge, and whether its rows alternate between the controller’s two COM pin banks, as on 64- and 48-row panels.

pub struct Panel {
    pub width: u32
    pub height: u32
    pub column_offset: u32
    pub alternative_com_pins: bool
}

panel_128x64

Function · Source

0.96” and 1.3” modules.

pub fn panel_128x64() -> Panel

panel_128x32

Function · Source

0.91” modules.

pub fn panel_128x32() -> Panel

panel_96x16

Function · Source

0.69” modules.

pub fn panel_96x16() -> Panel

panel_64x48

Function · Source

0.66” modules, such as the Wemos D1 mini OLED shield.

pub fn panel_64x48() -> Panel

panel_72x40

Function · Source

0.42” modules.

pub fn panel_72x40() -> Panel

Display

Struct · Source

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

Display.new

Function · Source

Set the controller up for panel, with its charge pump on (the modules above have no separate panel supply), clear the panel, and switch it on. InvalidInput if the panel does not fit the controller or its height is not a multiple of 8.

pub fn new(wiring: I, panel: Panel) -> Display<I>!hal.Error from(wiring)

Display.size

Function · Source

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

Display.format

Function · Source

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

Display.present

Function · Source

Copy the part of dirty inside both the canvas and the display into the driver’s copy of the panel memory and send the pages it touches. On failure the copy is already updated, so presenting the same rectangle again (as graphics.present does after a failure) resends it.

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

Display.is_lit

Function · Source

Whether the pixel at (x, y) is lit in the panel memory as last sent, or false outside the display.

pub fn is_lit(&self, x: u32, y: u32) -> bool

Display.set_contrast

Function · Source

Brightness from 0 to 255.

pub fn set_contrast(&mut self, contrast: u8) -> void!hal.Error

Display.set_inverted

Function · Source

Light the unlit pixels and darken the lit ones.

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

Display.set_display_on

Function · Source

Switch the panel off, which also stops its charge pump, or on again. The memory is kept, and presents still update it while it is off.

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

Display.set_flipped

Function · Source

Turn the picture upside down, for a module mounted the other way up, and resend it.

pub fn set_flipped(&mut self, flipped: bool) -> 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)

Search every guide, reference page, and API declaration.