Documentation ¶
Overview ¶
Package hd44780 provides a driver for the HD44780 LCD controller.
Datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
Index ¶
- Constants
- type Buser
- type Config
- type Device
- func (d *Device) Busy() bool
- func (d *Device) ClearBuffer()
- func (d *Device) ClearDisplay()
- func (d *Device) Configure(cfg Config) error
- func (d *Device) CreateCharacter(cgramAddr uint8, data []byte)
- func (d *Device) Display() error
- func (d *Device) SendCommand(command byte)
- func (d *Device) SetCursor(x, y uint8)
- func (d *Device) Size() (w, h int16)
- func (d *Device) Write(data []byte) (n int, err error)
- type GPIO
Constants ¶
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 Device ¶
type Device struct {
// contains filtered or unexported fields
}
func NewGPIO4Bit ¶
NewGPIO4Bit returns 4bit data length HD44780 driver. Datapins are LCD DB pins starting from DB4 to DB7
func NewGPIO8Bit ¶
NewGPIO8Bit returns 8bit data length HD44780 driver. Datapins are LCD DB pins starting from DB0 to DB7
func (*Device) ClearDisplay ¶
func (d *Device) ClearDisplay()
ClearDisplay clears displayed content and buffer
func (*Device) CreateCharacter ¶
CreateCharacter crates characters using data and stores it under cgram Addr in CGRAM
func (*Device) SendCommand ¶
SendCommand sends commands to driver
func (*Device) SetCursor ¶
SetCursor moves cursor to position x,y, where (0,0) is top left corner and (width-1, height-1) bottom right
type GPIO ¶
type GPIO struct {
// contains filtered or unexported fields
}
func (*GPIO) Read ¶
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 ¶
SetCommandMode sets command/instruction mode