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) DrawBitmap(x, y int16, bitmap pixel.Image[pixel.Monochrome]) error
- func (d *Device) FillRectangle(x, y, width, height int16, c color.RGBA) error
- func (d *Device) GetBuffer() []byte
- func (d *Device) GetPixel(x int16, y int16) bool
- func (d *Device) Rotation() drivers.Rotation
- func (d *Device) SetBuffer(buffer []byte) error
- func (d *Device) SetPixel(x int16, y int16, c color.RGBA)
- func (d *Device) SetRotation(rotation drivers.Rotation) error
- func (d *Device) SetScroll(line int16)
- func (d *Device) Size() (w, h int16)
- func (d *Device) Sleep(sleepEnabled bool) error
- func (d *Device) Tx(data []byte, isCommand bool) error
- type I2CBus
- type ResetValue
- type SPIBus
- type VccMode
Constants ¶
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 NO_ROTATION = drivers.Rotation0 ROTATION_180 = drivers.Rotation180 )
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 Rotation drivers.Rotation }
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) DrawBitmap ¶ added in v0.28.0
DrawBitmap copies the bitmap to the screen at the given coordinates.
func (*Device) FillRectangle ¶ added in v0.29.0
FillRectangle fills a rectangle at a given coordinates with a color
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
func (*Device) SetRotation ¶ added in v0.28.0
SetRotation changes the rotation of the device (clock-wise).
func (*Device) SetScroll ¶ added in v0.29.0
SetScroll sets the vertical scrolling for the display, which is a NOP for this display.
type ResetValue ¶ added in v0.27.0
type ResetValue [2]byte