hdc

package
v0.0.0-...-168ccc2 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package hdc implements driver for popular Hitachi HD44780 LCD controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Display

type Display struct {
	ReadWriter io.ReadWriter
	Cols       byte
	Rows       byte
	DS         byte // Data shift: 4-bit nible uses bit numbers from DS to DS+3.
	E          byte // E line.
	RW         byte // R/W line.
	RS         byte // RS line.
	AUX        byte // AUX line (typically used for control backlight).
	// contains filtered or unexported fields
}

Display allows to send commands and data to HD44780 LCD controller in 4-bit mode.

Every byte is sent as two 4-bit nibbles. One nibble is sent by writing three bytes to provided ReadWriter:

  • first: with E bit unset, need >= 40 ns
  • second: with E bit set, need >= 230 ns
  • thrid: with E bit unset, need >= 10 ns

Full E cycle needs >= 500 ns. Display doesn't control proper nible timings, instead ReadWriter implementation must do it.

Display reads busy flag before executing a command. Read command is written with all data bits set to 1.

func (*Display) ClearAUX

func (d *Display) ClearAUX() error

func (*Display) ClearDisplay

func (d *Display) ClearDisplay() error

func (*Display) Init

func (d *Display) Init() error

Init initializes the display to the following state: - 4-bit mode, - one line display if Rows == 1, two line display otherwise, - 5x8 font, - display off, cursor off, blink off, - increment mode, - display cleared and cursor at home position.

func (*Display) MoveCursor

func (d *Display) MoveCursor(col, row int) error

Flush calls bufio.Writer.Flush if bufio.Writer was used as io.Write

func (*Display) ReturnHome

func (d *Display) ReturnHome() error

func (*Display) SetAUX

func (d *Display) SetAUX() error

func (*Display) SetAddrCGRAM

func (d *Display) SetAddrCGRAM(addr int) error

func (*Display) SetAddrDDRAM

func (d *Display) SetAddrDDRAM(addr int) error

func (*Display) SetDisplayMode

func (d *Display) SetDisplayMode(f DisplayMode) error

func (*Display) SetEntryMode

func (d *Display) SetEntryMode(f EntryMode) error

func (*Display) SetFunction

func (d *Display) SetFunction(f Function) error

func (*Display) Shift

func (d *Display) Shift(f Shift) error

func (*Display) Write

func (d *Display) Write(data []byte) (int, error)

func (*Display) WriteByte

func (d *Display) WriteByte(b byte) error

func (*Display) WriteString

func (d *Display) WriteString(s string) (int, error)

type DisplayMode

type DisplayMode byte
const (
	DisplayOff DisplayMode = 0
	DisplayOn  DisplayMode = 1 << 2
	CursorOff  DisplayMode = 0
	CursorOn   DisplayMode = 1 << 1
	BlinkOff   DisplayMode = 0
	BlinkOn    DisplayMode = 1
)

type EntryMode

type EntryMode byte
const (
	ShiftOff EntryMode = 0
	ShiftOn  EntryMode = 1 << 0
	Decr     EntryMode = 0
	Incr     EntryMode = 1 << 1
)

type Function

type Function byte
const (
	OneLine  Function = 0
	TwoLines Function = 1 << 3
	Font5x8  Function = 0
	Font5x10 Function = 1 << 2
)

type Shift

type Shift byte
const (
	Cursor Shift = 0
	Screen Shift = 1 << 3
	Left   Shift = 0
	Right  Shift = 1 << 2
)

Directories

Path Synopsis
Package hdcfb implements lockless text framebuffer on top of hdc driver.
Package hdcfb implements lockless text framebuffer on top of hdc driver.

Jump to

Keyboard shortcuts

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