ssd1351

package
v0.0.0-...-0c309f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dev

type Dev struct {
	// contains filtered or unexported fields
}

Dev is an open handle to the display controller.

func NewSPI

func NewSPI(p spi.Port, dc gpio.PinOut, rst gpio.PinOut) (*Dev, error)

NewSPI returns a Dev object that communicates over SPI to a SSD1351 display controller.

The SSD1351 can operate at up to 3.3Mhz, which is much higher than I²C. This permits higher refresh rates.

Wiring

Connect SDA to SPI_MOSI, SCK to SPI_CLK, CS to SPI_CS.

func (*Dev) Bounds

func (d *Dev) Bounds() image.Rectangle

Bounds implements display.Drawer. Min is guaranteed to be {0, 0}.

func (*Dev) ColorModel

func (d *Dev) ColorModel() color.Model

ColorModel implements display.Drawer.

It is a one bit color model, as implemented by image16bit.Bit.

func (*Dev) Draw

func (d *Dev) Draw(r image.Rectangle, src image.Image, sp image.Point) error

Draw implements display.Drawer.

It draws synchronously, once this function returns, the display is updated. It means that on slow bus (I²C), it may be preferable to defer Draw() calls to a background goroutine.

func (*Dev) Halt

func (d *Dev) Halt() error

Halt turns off the display.

Sending any other command afterward reenables the display.

func (*Dev) Invert

func (d *Dev) Invert(blackOnWhite bool) error

Invert the display (black on white vs white on black).

func (*Dev) String

func (d *Dev) String() string

func (*Dev) Write

func (d *Dev) Write(pixels []byte) (int, error)

Write writes a buffer of pixels to the display.

This function accepts the content of image16bit.VerticalLSB.Pix.

Directories

Path Synopsis
Package image16bit implements 16 bit (5, 6, 7 bits per color) 2D graphics.
Package image16bit implements 16 bit (5, 6, 7 bits per color) 2D graphics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL