Documentation ¶
Overview ¶
Package ssd1306 implements a driver for the SSD1306 led matrix controller, it comes in various colors and screen sizes.
Datasheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
Index ¶
- Constants
- type Buser
- type Config
- type Device
- func (d *Device) ClearBuffer()
- func (d *Device) ClearDisplay()
- func (d *Device) Command(command uint8)
- func (d *Device) Configure(cfg Config)
- func (d *Device) Display() error
- func (d *Device) GetBuffer() []byte
- func (d *Device) GetPixel(x int16, y int16) bool
- func (d *Device) SetBuffer(buffer []byte) error
- func (d *Device) SetPixel(x int16, y int16, c color.RGBA)
- func (d *Device) Size() (w, h int16)
- func (d *Device) Tx(data []byte, isCommand bool) error
- type I2CBus
- type ResetValue
- type SPIBus
- type VccMode
Constants ¶
View Source
const ( Address = 0x3D Address_128_32 = 0x3C SETCONTRAST = 0x81 DISPLAYALLON_RESUME = 0xA4 DISPLAYALLON = 0xA5 NORMALDISPLAY = 0xA6 INVERTDISPLAY = 0xA7 DISPLAYOFF = 0xAE DISPLAYON = 0xAF SETDISPLAYOFFSET = 0xD3 SETCOMPINS = 0xDA SETVCOMDETECT = 0xDB SETDISPLAYCLOCKDIV = 0xD5 SETPRECHARGE = 0xD9 SETMULTIPLEX = 0xA8 SETLOWCOLUMN = 0x00 SETHIGHCOLUMN = 0x10 SETSTARTLINE = 0x40 MEMORYMODE = 0x20 COLUMNADDR = 0x21 PAGEADDR = 0x22 COMSCANINC = 0xC0 COMSCANDEC = 0xC8 SEGREMAP = 0xA0 CHARGEPUMP = 0x8D ACTIVATE_SCROLL = 0x2F DEACTIVATE_SCROLL = 0x2E SET_VERTICAL_SCROLL_AREA = 0xA3 RIGHT_HORIZONTAL_SCROLL = 0x26 LEFT_HORIZONTAL_SCROLL = 0x27 VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL = 0x29 VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = 0x2A EXTERNALVCC VccMode = 0x1 SWITCHCAPVCC VccMode = 0x2 )
Registers
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Width int16 Height int16 VccState VccMode Address uint16 // ResetCol and ResetPage are used to reset the screen to 0x0 // This is useful for some screens that have a different size than 128x64 // For example, the Thumby's screen is 72x40 // The default values are normally set automatically based on the size. // If you're using a different size, you might need to set these values manually. ResetCol ResetValue ResetPage ResetValue }
Config is the configuration for the display
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device wraps I2C or SPI connection.
func (*Device) ClearDisplay ¶
func (d *Device) ClearDisplay()
ClearDisplay clears the image buffer and clear the display
func (*Device) SetPixel ¶
SetPixel enables or disables a pixel in the buffer color.RGBA{0, 0, 0, 255} is consider transparent, anything else with enable a pixel on the screen
type ResetValue ¶
type ResetValue [2]byte
Click to show internal directories.
Click to hide internal directories.