ssd1331

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package ssd1331 implements a driver for the SSD1331 TFT color displays.

Datasheet: https://www.crystalfontz.com/controllers/SolomonSystech/SSD1331/381/

Index

Constants

View Source
const (
	DRAWLINE       = 0x21
	DRAWRECT       = 0x22
	FILL           = 0x26
	SETCOLUMN      = 0x15
	SETROW         = 0x75
	CONTRASTA      = 0x81
	CONTRASTB      = 0x82
	CONTRASTC      = 0x83
	MASTERCURRENT  = 0x87
	SETREMAP       = 0xA0
	STARTLINE      = 0xA1
	DISPLAYOFFSET  = 0xA2
	NORMALDISPLAY  = 0xA4
	DISPLAYALLON   = 0xA5
	DISPLAYALLOFF  = 0xA6
	INVERTDISPLAY  = 0xA7
	SETMULTIPLEX   = 0xA8
	SETMASTER      = 0xAD
	DISPLAYOFF     = 0xAE
	DISPLAYON      = 0xAF
	POWERMODE      = 0xB0
	PRECHARGE      = 0xB1
	CLOCKDIV       = 0xB3
	PRECHARGEA     = 0x8A
	PRECHARGEB     = 0x8B
	PRECHARGEC     = 0x8C
	PRECHARGELEVEL = 0xBB
	VCOMH          = 0xBE
)

Registers

Variables

This section is empty.

Functions

func RGBATo565

func RGBATo565(c color.RGBA) uint16

RGBATo565 converts a color.RGBA to uint16 used in the display

Types

type Config

type Config struct {
	Width  int16
	Height int16
}

Config is the configuration for the display

type Device

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

Device wraps an SPI connection.

func New

func New(bus machine.SPI, resetPin, dcPin, csPin machine.Pin) Device

New creates a new ST7735 connection. The SPI wire must already be configured.

func (*Device) Command

func (d *Device) Command(command uint8)

Command sends a command to the display

func (*Device) Configure

func (d *Device) Configure(cfg Config)

Configure initializes the display with default configuration

func (*Device) Data

func (d *Device) Data(data uint8)

Command sends a data to the display

func (*Device) Display

func (d *Device) Display() error

Display does nothing, there's no buffer as it might be too big for some boards

func (*Device) DrawFastHLine

func (d *Device) DrawFastHLine(x0, x1, y int16, c color.RGBA)

DrawFastHLine draws a horizontal line faster than using SetPixel

func (*Device) DrawFastVLine

func (d *Device) DrawFastVLine(x, y0, y1 int16, c color.RGBA)

DrawFastVLine draws a vertical line faster than using SetPixel

func (*Device) FillRectangle

func (d *Device) FillRectangle(x, y, width, height int16, c color.RGBA) error

FillRectangle fills a rectangle at a given coordinates with a color

func (*Device) FillRectangleWithBuffer

func (d *Device) FillRectangleWithBuffer(x, y, width, height int16, buffer []color.RGBA) error

FillRectangle fills a rectangle at a given coordinates with a buffer

func (*Device) FillScreen

func (d *Device) FillScreen(c color.RGBA)

FillScreen fills the screen with a given color

func (*Device) IsBGR

func (d *Device) IsBGR(bgr bool)

IsBGR changes the color mode (RGB/BGR)

func (*Device) SetContrast

func (d *Device) SetContrast(contrastA, contrastB, contrastC uint8)

SetContrast sets the three contrast values (A, B & C)

func (*Device) SetPixel

func (d *Device) SetPixel(x int16, y int16, c color.RGBA)

SetPixel sets a pixel in the screen

func (*Device) Size

func (d *Device) Size() (w, h int16)

Size returns the current size of the display.

func (*Device) Tx

func (d *Device) Tx(data []byte, isCommand bool)

Tx sends data to the display

type Model

type Model uint8

type Rotation

type Rotation uint8

Jump to

Keyboard shortcuts

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