Documentation ¶
Overview ¶
Package hd44780i2c implements a driver for the Hitachi HD44780 LCD display module with an I2C adapter.
Datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf
Index ¶
- Constants
- type Config
- type Device
- func (d *Device) BacklightOn(option bool)
- func (d *Device) ClearDisplay()
- func (d *Device) Configure(cfg Config) error
- func (d *Device) CreateCharacter(cgramAddr uint8, data []byte)
- func (d *Device) CursorBlink(option bool)
- func (d *Device) CursorOn(option bool)
- func (d *Device) DisplayOn(option bool)
- func (d *Device) Home()
- func (d *Device) Print(data []byte)
- func (d *Device) SetCursor(x, y uint8)
Constants ¶
const ( // commands DISPLAY_CLEAR = 0x01 CURSOR_HOME = 0x02 ENTRY_MODE = 0x04 DISPLAY_ON_OFF = 0x08 CURSOR_DISPLAY_SHIFT = 0x10 FUNCTION_MODE = 0x20 CGRAM_SET = 0x40 DDRAM_SET = 0x80 // flags for display entry mode // CURSOR_DECREASE = 0x00 CURSOR_INCREASE = 0x02 // DISPLAY_SHIFT = 0x01 DISPLAY_NO_SHIFT = 0x00 // flags for display on/off control DISPLAY_ON = 0x04 DISPLAY_OFF = 0x00 CURSOR_ON = 0x02 CURSOR_OFF = 0x00 CURSOR_BLINK_ON = 0x01 CURSOR_BLINK_OFF = 0x00 // flags for function set // DATA_LENGTH_8BIT = 0x10 DATA_LENGTH_4BIT = 0x00 TWO_LINE = 0x08 ONE_LINE = 0x00 FONT_5X10 = 0x04 FONT_5X8 = 0x00 // flags for backlight control BACKLIGHT_ON = 0x08 BACKLIGHT_OFF = 0x00 En = 0x04 // Enable bit // Rw = 0x02 // Read/Write bit Rs = 0x01 // Register select bit )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device wraps an I2C connection to a HD44780 I2C LCD with related data.
func New ¶
New creates a new HD44780 I2C LCD connection. The I2C bus must already be configured.
This function only creates the Device object, it does not touch the device.
func (*Device) BacklightOn ¶
BacklightOn turns on/off the display backlight.
func (*Device) ClearDisplay ¶
func (d *Device) ClearDisplay()
ClearDisplay clears all texts on the display.
func (*Device) Configure ¶
Configure sets up the display. Display itself and backlight is default on.
func (*Device) CreateCharacter ¶
CreateCharacter crates custom characters (using data parameter) and stores it under CGRAM address (using cgramAddr, 0x0-0x7).
func (*Device) CursorBlink ¶
CursorBlink turns on/off the blinking cursor mode.