Documentation
¶
Overview ¶
Package display contains drivers for hardware displays.
Index ¶
- Variables
- type Config
- type Conn
- type Display
- func GP1278(conn Conn, config *Config) (Display, error)
- func GP1294(c Conn, config *Config) (Display, error)
- func GU3000(conn Conn, config *Config) (Display, error)
- func SH1106(conn Conn, config *Config) (Display, error)
- func SH1122(c Conn, config *Config) (Display, error)
- func SSD1305(conn Conn, config *Config) (Display, error)
- func SSD1306(conn Conn, config *Config) (Display, error)
- func SSD1322(c Conn, config *Config) (Display, error)
- func ST7735(c Conn, config *Config) (Display, error)
- func ST7789(c Conn, config *Config) (Display, error)
- type I2CConfig
- type InvalidPin
- type Parallel
- type ParallelConfig
- type Rotation
- type SPI
- type SPIConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBounds = errors.New("display: out of bounds") ErrNotReady = errors.New("display: ready timeout") ErrResetPin = InvalidPin{"reset"} ErrDCPin = InvalidPin{"data/command (DC)"} )
Errors
View Source
var DefaultI2CConfig = I2CConfig{
Device: -1,
Addr: 0x3c,
}
DefaultI2CConfig are the default configuration values for I²C connections.
View Source
var DefaultSPIConfig = SPIConfig{ Bus: 0, Device: 0, Mode: 0, SpeedHz: 8_000_000, BatchSize: 4096, Reset: gpioreg.ByName("GPIO25"), DC: gpioreg.ByName("GPIO24"), }
DefaultSPIConfig are the default configuration values for SPI connections.
View Source
var ValidSPISpeeds = []uint32{
500_000,
1_000_000,
2_000_000,
4_000_000,
8_000_000,
16_000_000,
20_000_000,
24_000_000,
28_000_000,
32_000_000,
36_000_000,
40_000_000,
48_000_000,
50_000_000,
52_000_000,
}
ValidSPISpeeds are common valid SPI bus speeds.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Width of the display in pixels.
Width int
// Height of the display in pixels.
Height int
// Rotation of the display.
Rotation Rotation
// UseMono sets 1-color monochrome mode on displays that support grayscale.
UseMono bool
// Reset pin
Reset gpio.PinOut
// Backlight pin
Backlight gpio.PinOut
}
Config is the display configuration.
type Conn ¶
type Conn interface {
String() string
// Close the connection.
Close() error
// Reset sets the reset pin to the provided level.
Reset(gpio.Level) error
// Command sends a command byte with optional arguments.
Command(byte, ...byte) error
// Data sends data bytes.
Data(...byte) error
// Interface is the underlying interface.
Interface() interface{}
}
Conn is the connection interface for communicating with hardware.
func OpenParallel ¶ added in v1.1.7
func OpenParallel(config *ParallelConfig) (Conn, error)
OpenParallel opens a parallel connection (also known as 8080 connection).
type Display ¶
type Display interface {
draw.Image
// String gives a description of the display.
String() string
// Close the display driver.
Close() error
// Clear the display buffer.
Clear()
// Fill the display buffer with a single color.
Fill(color.Color)
// Show toggles the display on or off.
Show(bool) error
// SetContrast adjusts the contrast level.
SetContrast(level uint8) error
// SetRotation adjusts the pixel rotation.
SetRotation(Rotation) error
// Refresh redraws the display.
Refresh() error
}
Display is an OLED display.
type I2CConfig ¶
type I2CConfig struct {
// Device is the I²C device, use -1 to use the first available device.
Device int
// Addr is the I²C address.
Addr uint8
// Reset pin.
Reset gpio.PinOut
}
I2CConfig describes the I²C bus configuration.
type InvalidPin ¶ added in v1.1.7
type InvalidPin struct {
Name string
}
func (InvalidPin) Error ¶ added in v1.1.7
func (err InvalidPin) Error() string
type ParallelConfig ¶ added in v1.1.7
type ParallelConfig struct {
// Data pins.
D0, D1, D2, D3, D4, D5, D6, D7 gpio.PinOut
// Write pin.
Write gpio.PinOut
// Ready pin.
Ready gpio.PinIn
// UpdateFrequency is the maximum update frequency.
UpdateFrequency physic.Frequency
}
ParallelConfig is the configuration for a parallel (aka 8080) connection.
type Rotation ¶
type Rotation uint8
Rotation defines pixel rotation.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
display-test
command
|
|
|
oled-test-spi
command
|
|
|
Package draw provides provides image composition functions.
|
Package draw provides provides image composition functions. |
|
Package framebuffer provides access to the operating system's native framebuffer
|
Package framebuffer provides access to the operating system's native framebuffer |
|
internal
|
|
|
Package pixel implements a color and image library suitable for OLED and LCD pixel displays.
|
Package pixel implements a color and image library suitable for OLED and LCD pixel displays. |
Click to show internal directories.
Click to hide internal directories.