oled96x96

package
v0.0.0-...-09d1226 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

README

#Grove - OLED 96×96

GoDoc

Manufacturer info

This device is an i2c 16 color grayscale 96×96 dot matrix OLED display module with Grove compatible 4pin I2C interface. Grove - OLED 96×96 is constructed with 96×96 dot matrix OLED module LY120 and SSD1327 driver IC.

##Datasheets:

Documentation

Overview

Package oled96x96 implements a driver for the Grove OLED grayscale 96x96 display.

Example
package main

import (
	"github.com/goiot/devices/oled96x96"
	"golang.org/x/exp/io/i2c"
)

func main() {
	bus := &i2c.Devfs{
		// change the following value if you use another bus
		Dev: "/dev/i2c-1",
	}

	display, err := oled96x96.Open(bus)
	if err != nil {
		panic(err)
	}
	defer display.Close()

	display.Write("Hello World!")
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ScrollLeft  ScrollDirection = 0x00
	ScrollRight ScrollDirection = 0x01

	Scroll2Frames   ScrollSpeed = 0x7
	Scroll3Frames   ScrollSpeed = 0x4
	Scroll4Frames   ScrollSpeed = 0x5
	Scroll5Frames   ScrollSpeed = 0x0
	Scroll25Frames  ScrollSpeed = 0x6
	Scroll64Frames  ScrollSpeed = 0x1
	Scroll128Frames ScrollSpeed = 0x2
	Scroll256Frames ScrollSpeed = 0x3
)

Functions

This section is empty.

Types

type Font

type Font [][8]byte

func DefaultFont

func DefaultFont() Font

DefaultFont returns a basic ascii font. Developers can implement their own font.

type OLED96x96

type OLED96x96 struct {
	Device *i2c.Device
	Font   Font
	// contains filtered or unexported fields
}

OLED96x96 represents the Grove Oled 96x96 display.

func Open

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

Open connects to the passed driver and sets things up.

func (*OLED96x96) Clear

func (o *OLED96x96) Clear() error

Clear clears the whole screen. Should be used before starting a fresh start or after scroll deactivation. This function also sets the cursor to top left corner.

func (*OLED96x96) Close

func (o *OLED96x96) Close() error

Close takes care of cleaning things up.

func (*OLED96x96) ContrastLevel

func (o *OLED96x96) ContrastLevel(level int) error

ContrastLevel sets the contrast ratio of OLED display. The level can be any number between 0 - 255.

func (*OLED96x96) DisableScroll

func (o *OLED96x96) DisableScroll() error

DisableScroll disables and stops scrolling

func (*OLED96x96) DrawBitmap

func (o *OLED96x96) DrawBitmap(bitmap []byte) error

DrawBitmap displays a binary bitmap on the OLED matrix. The data is provided through a slice holding bitmap.

func (*OLED96x96) EnableScroll

func (o *OLED96x96) EnableScroll() error

EnableScroll enables and starts scrolling

func (*OLED96x96) HorizontalMode

func (o *OLED96x96) HorizontalMode() error

HorizontalMode configures the display to horizontal addressing mode.

func (*OLED96x96) HorizontalScrollProperties

func (o *OLED96x96) HorizontalScrollProperties(
	direction ScrollDirection,
	startRow int,
	endRow int,
	startColumn int,
	endColumn int,
	scrollSpeed ScrollSpeed) error

HorizontalScrollProperties defines the scrolling behavior. StartRow must be in the 0-127 range EndRow must be in the 0-127 range and greater than StartRow StartColumn must be between 0 and 63. EndColumn must be in the 0 and 63 range and greater than StartColumn

func (*OLED96x96) Inverse

func (o *OLED96x96) Inverse() error

Inverse sets the display to inverse mode (colors are inversed)

func (*OLED96x96) Normal

func (o *OLED96x96) Normal() error

Normal sets the display in mormal mode (colors aren't inversed)

func (*OLED96x96) Off

func (o *OLED96x96) Off() error

Off turns the OLED panel display OFF

func (*OLED96x96) On

func (o *OLED96x96) On() error

On turns the OLED panel display ON

func (*OLED96x96) PositionCursor

func (o *OLED96x96) PositionCursor(row, col int) error

PositionCursor sets the text's position (cursor) to Xth Text Row, Yth Text Column. The 96x96 OLED is divided into 12 rows and 12 Columns of text. These text row and columns should not be confused with the OLED's Row and Column.

func (*OLED96x96) VerticalMode

func (o *OLED96x96) VerticalMode() error

VerticalMode configures the display to vertical addressing mode. The display must be set to vertical mode before printing text.

func (*OLED96x96) Write

func (o *OLED96x96) Write(txt string) error

Write prints the content of the passed text at the cursor's.

type ScrollDirection

type ScrollDirection byte

ScrollDirection is the type determining the scrolling direction of text

type ScrollSpeed

type ScrollSpeed byte

ScrollSpeed is the type determining the speed of scrolling

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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