Documentation ¶
Overview ¶
Package hdc implements driver for popular Hitachi HD44780 LCD controller.
Index ¶
- type Display
- func (d *Display) ClearAUX() error
- func (d *Display) ClearDisplay() error
- func (d *Display) Init() error
- func (d *Display) MoveCursor(col, row int) error
- func (d *Display) ReturnHome() error
- func (d *Display) SetAUX() error
- func (d *Display) SetAddrCGRAM(addr int) error
- func (d *Display) SetAddrDDRAM(addr int) error
- func (d *Display) SetDisplayMode(f DisplayMode) error
- func (d *Display) SetEntryMode(f EntryMode) error
- func (d *Display) SetFunction(f Function) error
- func (d *Display) Shift(f Shift) error
- func (d *Display) Write(data []byte) (int, error)
- func (d *Display) WriteByte(b byte) error
- func (d *Display) WriteString(s string) (int, error)
- type DisplayMode
- type EntryMode
- type Function
- type Shift
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) ClearDisplay ¶
func (*Display) Init ¶
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 ¶
Flush calls bufio.Writer.Flush if bufio.Writer was used as io.Write
func (*Display) ReturnHome ¶
func (*Display) SetAddrCGRAM ¶
func (*Display) SetAddrDDRAM ¶
func (*Display) SetDisplayMode ¶
func (d *Display) SetDisplayMode(f DisplayMode) error
func (*Display) SetEntryMode ¶
func (*Display) SetFunction ¶
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 )