monochromeoled

package module
v0.0.0-...-4ec41ec Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

MonochromeOLED Library

Library for working with OLEDs on the raspberry pi.

Credit

This was taken from https://github.com/goiot/devices and modified to work with both 128x32 and 128x64 SSD1306 OLEDs

License

In keeping with 'goiot/devices' - Apache 2.0

Documentation

Overview

Package monochromeoled contains an Adafruit Monochrome OLED (SSD1306) display driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OLED

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

OLED represents an SSD1306 OLED display.

func Open

func Open(o driver.Opener) (*OLED, error)

Open opens an SSD1306 OLED display. Once not in use, it needs to be close by calling Close. The default width is 128, height is 64 if zero values are given.

func (*OLED) Clear

func (o *OLED) Clear() error

Clear clears the entire display.

func (*OLED) Close

func (o *OLED) Close() error

Close closes the display.

func (*OLED) DisableScroll

func (o *OLED) DisableScroll() error

StopStrolls stops the scrolling on the display.

func (*OLED) Draw

func (o *OLED) Draw() error

Draw draws the intermediate pixel buffer on the display. See SetPixel and SetImage to mutate the buffer.

func (*OLED) EnableScroll

func (o *OLED) EnableScroll(startY, endY int) error

StartScroll starts scrolling in the horizontal direction starting from startY column to endY column.

func (*OLED) Height

func (o *OLED) Height() int

Height returns the display height.

func (*OLED) Off

func (o *OLED) Off() error

Off turns off the display if it is on.

func (*OLED) On

func (o *OLED) On() error

On turns on the display if it is off.

func (*OLED) SetImage

func (o *OLED) SetImage(x, y int, img image.Image) error

SetImage draws an image on the display buffer starting from x, y. A call to Draw is required to display it on the OLED display.

func (*OLED) SetPixel

func (o *OLED) SetPixel(x, y int, v byte) error

func (*OLED) Width

func (o *OLED) Width() int

Width returns the display width.

Jump to

Keyboard shortcuts

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