README
¶
SSD1306 OLED Driver for Go
This package provides an implementation for controlling an SSD1306 OLED display using Go.
Features
-
Support for different OLED screen dimensions:
- 128x64
- 128x32
- 96x16
-
Initialization and basic configuration commands.
-
Modular design for easy expansion and integration.
Usage
- Initialize the Display
To create a display instance based on your screen's dimensions:
display, err := ssd1306.NewDisplay(width, height, fd, vccstate)
if err != nil {
log.Fatalf("Failed to create a new display: %v", err)
}
- Initialize the Screen
err = display.Initialize()
if err != nil {
log.Fatalf("Failed to initialize the screen: %v", err)
}
- You can now proceed with any other SSD1306 related operations.
Configuration
-
VCC State:
- SSD1306_EXTERNALVCC: External power supply.
- SSD1306_SWITCHCAPVCC: Internal power supply (default).
-
Screen Dimensions:
- Supported dimensions include: 128x64, 128x32, and 96x16.
Files
- ssd1306.go: Contains constants and primary functions for controlling the SSD1306.
- SSD1306_96_16.go: Implementation for 96x16 dimension OLED screens.
- SSD1306_128_64.go: Implementation for 128x64 dimension OLED screens.
- SSD1306_128_32.go: Implementation for 128x32 dimension OLED screens.
Requirements
Go version 1.xx.x (Replace with your version) Access to the appropriate device interface (typically I2C) on your system.
Documentation
¶
Index ¶
Constants ¶
const ( SSD1306_CMD = 0x80 SSD1306_SETDISPLAYCLOCKDIV = 0xD5 SSD1306_DISPLAYOFF = 0xAE SSD1306_SETMULTIPLEX = 0xA8 SSD1306_SETDISPLAYOFFSET = 0xD3 SSD1306_SETSTARTLINE = 0x0 SSD1306_CHARGEPUMP = 0x8D SSD1306_MEMORYMODE = 0x20 SSD1306_SEGREMAP = 0xA0 SSD1306_COMSCANDEC = 0xC8 SSD1306_SETCOMPINS = 0xDA SSD1306_SETCONTRAST = 0x81 SSD1306_SETPRECHARGE = 0xD9 SSD1306_SETVCOMDETECT = 0xDB SSD1306_DISPLAYALLON_RESUME = 0xA4 SSD1306_NORMALDISPLAY = 0xA6 SSD1306_EXTERNALVCC = 0x1 SSD1306_SWITCHCAPVCC = 0x2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SSD1306_128_32 ¶
type SSD1306_128_32 struct {
// contains filtered or unexported fields
}
func NewSSD1306_128_32 ¶
func NewSSD1306_128_32(fd *os.File, vccstate byte) *SSD1306_128_32
NewSSD1306_128_32 creates a new instance of the SSD1306_128_32 structure.
func (*SSD1306_128_32) Initialize ¶
func (d *SSD1306_128_32) Initialize() error
type SSD1306_128_64 ¶
type SSD1306_128_64 struct {
// contains filtered or unexported fields
}
func NewSSD1306_128_64 ¶
func NewSSD1306_128_64(fd *os.File, vccstate byte) *SSD1306_128_64
NewSSD1306_128_64 creates a new instance of the SSD1306_128_64 structure.
func (*SSD1306_128_64) Initialize ¶
func (d *SSD1306_128_64) Initialize() error
type SSD1306_96_16 ¶
type SSD1306_96_16 struct {
// contains filtered or unexported fields
}
func NewSSD1306_96_16 ¶
func NewSSD1306_96_16(fd *os.File, vccstate byte) *SSD1306_96_16
NewSSD1306_96_16 creates a new instance of the SSD1306_96_16 structure.
func (*SSD1306_96_16) Initialize ¶
func (d *SSD1306_96_16) Initialize() error