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 ¶
- Variables
- type Font
- type OLED96x96
- func (o *OLED96x96) Clear() error
- func (o *OLED96x96) Close() error
- func (o *OLED96x96) ContrastLevel(level int) error
- func (o *OLED96x96) DisableScroll() error
- func (o *OLED96x96) DrawBitmap(bitmap []byte) error
- func (o *OLED96x96) EnableScroll() error
- func (o *OLED96x96) HorizontalMode() error
- func (o *OLED96x96) HorizontalScrollProperties(direction ScrollDirection, startRow int, endRow int, startColumn int, ...) error
- func (o *OLED96x96) Inverse() error
- func (o *OLED96x96) Normal() error
- func (o *OLED96x96) Off() error
- func (o *OLED96x96) On() error
- func (o *OLED96x96) PositionCursor(row, col int) error
- func (o *OLED96x96) VerticalMode() error
- func (o *OLED96x96) Write(txt string) error
- type ScrollDirection
- type ScrollSpeed
Examples ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
OLED96x96 represents the Grove Oled 96x96 display.
func (*OLED96x96) Clear ¶
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) ContrastLevel ¶
ContrastLevel sets the contrast ratio of OLED display. The level can be any number between 0 - 255.
func (*OLED96x96) DisableScroll ¶
DisableScroll disables and stops scrolling
func (*OLED96x96) DrawBitmap ¶
DrawBitmap displays a binary bitmap on the OLED matrix. The data is provided through a slice holding bitmap.
func (*OLED96x96) EnableScroll ¶
EnableScroll enables and starts scrolling
func (*OLED96x96) HorizontalMode ¶
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) PositionCursor ¶
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 ¶
VerticalMode configures the display to vertical addressing mode. The display must be set to vertical mode before printing text.
type ScrollDirection ¶
type ScrollDirection byte
ScrollDirection is the type determining the scrolling direction of text