hd44780

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package hd44780 provides a driver for the HD44780 LCD controller.

Datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf

Index

Constants

View Source
const (
	DISPLAY_CLEAR = 0x1
	CURSOR_HOME   = 0x2

	ENTRY_MODE       = 0x4
	CURSOR_DECREASE  = ENTRY_MODE | 0x0
	CURSOR_INCREASE  = ENTRY_MODE | 0x2
	DISPLAY_SHIFT    = ENTRY_MODE | 0x1
	DISPLAY_NO_SHIFT = ENTRY_MODE | 0x0

	DISPLAY_ON_OFF   = 0x8
	DISPLAY_ON       = DISPLAY_ON_OFF | 0x4
	DISPLAY_OFF      = DISPLAY_ON_OFF | 0x0
	CURSOR_ON        = DISPLAY_ON_OFF | 0x2
	CURSOR_OFF       = DISPLAY_ON_OFF | 0x0
	CURSOR_BLINK_ON  = DISPLAY_ON_OFF | 0x1
	CURSOR_BLINK_OFF = DISPLAY_ON_OFF | 0x0

	CURSOR_DISPLAY_SHIFT = 0x10
	CURSOR_SHIFT_RIGHT   = CURSOR_DISPLAY_SHIFT | 0x4
	CURSOR_SHIFT_LEFT    = CURSOR_DISPLAY_SHIFT | 0x0
	DISPLAY_SHIFT_RIGHT  = CURSOR_DISPLAY_SHIFT | 0xC
	DISPLAY_SHIFT_LEFT   = CURSOR_DISPLAY_SHIFT | 0x8

	FUNCTION_MODE    = 0x20
	DATA_LENGTH_8BIT = FUNCTION_MODE | 0x10
	DATA_LENGTH_4BIT = FUNCTION_MODE | 0x0
	TWO_LINE         = FUNCTION_MODE | 0x8
	ONE_LINE         = FUNCTION_MODE | 0x0
	FONT_5X10        = FUNCTION_MODE | 0x4
	FONT_5X8         = FUNCTION_MODE | 0x0

	BUSY      = 0x80
	CGRAM_SET = 0x40
	DDRAM_SET = 0x80
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Buser

type Buser interface {
	io.ReadWriter
	SetCommandMode(set bool)
}

type Config

type Config struct {
	Width       int16
	Height      int16
	CursorBlink bool
	CursorOnOff bool
	Font        uint8
}

type Device

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

func NewGPIO4Bit

func NewGPIO4Bit(dataPins []machine.Pin, e, rs, rw machine.Pin) (Device, error)

NewGPIO4Bit returns 4bit data length HD44780 driver. Datapins are LCD DB pins starting from DB4 to DB7

func NewGPIO8Bit

func NewGPIO8Bit(dataPins []machine.Pin, e, rs, rw machine.Pin) (Device, error)

NewGPIO8Bit returns 8bit data length HD44780 driver. Datapins are LCD DB pins starting from DB0 to DB7

func (*Device) Busy

func (d *Device) Busy() bool

Busy returns true when hd447890 is busy

func (*Device) ClearBuffer

func (d *Device) ClearBuffer()

ClearBuffer clears internal buffer

func (*Device) ClearDisplay

func (d *Device) ClearDisplay()

ClearDisplay clears displayed content and buffer

func (*Device) Configure

func (d *Device) Configure(cfg Config) error

Configure initializes device

func (*Device) CreateCharacter

func (d *Device) CreateCharacter(cgramAddr uint8, data []byte)

CreateCharacter crates characters using data and stores it under cgram Addr in CGRAM

func (*Device) Display

func (d *Device) Display() error

Display sends the whole buffer to the screen at cursor position

func (*Device) SendCommand

func (d *Device) SendCommand(command byte)

SendCommand sends commands to driver

func (*Device) SetCursor

func (d *Device) SetCursor(x, y uint8)

SetCursor moves cursor to position x,y, where (0,0) is top left corner and (width-1, height-1) bottom right

func (*Device) Size

func (d *Device) Size() (w, h int16)

Size returns the current size of the display.

func (*Device) Write

func (d *Device) Write(data []byte) (n int, err error)

Write writes data to internal buffer

type GPIO

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

func (*GPIO) Read

func (g *GPIO) Read(data []byte) (n int, err error)

Read reads len(data) bytes from display RAM to data starting from RAM address counter position Ram address can be changed by writing address in command mode

func (*GPIO) SetCommandMode

func (g *GPIO) SetCommandMode(set bool)

SetCommandMode sets command/instruction mode

func (*GPIO) Write

func (g *GPIO) Write(data []byte) (n int, err error)

Write writes len(data) bytes from data to display driver

Jump to

Keyboard shortcuts

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