Documentation
¶
Overview ¶
Package lcd is a library for displaying on certain LCDs via GPIO pins (using periph.io).
Index ¶
- type QP5515
- func (q *QP5515) BusyWait()
- func (q *QP5515) Clear()
- func (q *QP5515) Display(s string)
- func (q *QP5515) RawFunction(a uint8)
- func (q *QP5515) ReadBFAC() uint8
- func (q *QP5515) ReadData() uint8
- func (q *QP5515) ReturnHome()
- func (q *QP5515) SetCGAddress(a uint8)
- func (q *QP5515) SetDDAddress(a uint8)
- func (q *QP5515) SetDisplayMode(display, cursor, blink bool)
- func (q *QP5515) SetDisplayShiftOrCursorMove(shift, right bool)
- func (q *QP5515) SetEntryMode(increment, shift bool)
- func (q *QP5515) SetFunction(eightbit, twolines, largefont bool)
- func (q *QP5515) WriteData(b uint8)
- type RS257543
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QP5515 ¶
type QP5515 struct {
RS, RW, E gpio.PinIO // register select, read/write, enable signal
DB [8]gpio.PinIO // data bits 0 - 7
}
QP5515 implements a driver for a QP-5515 or QP-5516 module. It assumes 8-bit mode (all 8 data pins are connected). The contrast adjust (pin 3 on mine) should be connected to the centre of a 10k trimpot between 0 and 5v.
Example ¶
host.Init()
q := &QP5515{
RS: gpioreg.ByName("27"),
RW: gpioreg.ByName("20"),
E: gpioreg.ByName("26"),
DB: [8]gpio.PinIO{
0: gpioreg.ByName("19"),
1: gpioreg.ByName("25"),
2: gpioreg.ByName("18"),
3: gpioreg.ByName("24"),
4: gpioreg.ByName("17"),
5: gpioreg.ByName("23"),
6: gpioreg.ByName("16"),
7: gpioreg.ByName("22"),
},
}
q.BusyWait()
q.Clear()
q.BusyWait()
q.SetFunction(true, true, false) // 8-bit, 2-line, small font
q.BusyWait()
q.SetDisplayMode(true, false, false) // display on, no cursor or blink
q.BusyWait()
q.SetEntryMode(true, false) // increment address, no shift
q.BusyWait()
if len(os.Args) == 1 {
q.Display("github.com/")
q.BusyWait()
q.SetDDAddress(0x40)
q.BusyWait()
q.Display("DrJosh9000/lcd")
return
}
q.Display(os.Args[1])
if len(os.Args[1]) > 16 {
q.BusyWait()
q.SetDDAddress(0x40)
q.BusyWait()
q.Display(os.Args[1][16:])
}
func (*QP5515) BusyWait ¶
func (q *QP5515) BusyWait()
BusyWait waits until the busy flag is cleared.
func (*QP5515) Clear ¶
func (q *QP5515) Clear()
Clear clears the display and returns the cursor to the home position.
func (*QP5515) RawFunction ¶
RawFunction performs a function or sets an address for the next write.
func (*QP5515) ReturnHome ¶
func (q *QP5515) ReturnHome()
ReturnHome returns the cursor to the home position and resets the display shift.
func (*QP5515) SetCGAddress ¶
SetCGAddress sets the CG RAM address (0 <= a < 64).
func (*QP5515) SetDDAddress ¶
SetDDAddress sets the DD RAM address (0 <= a < 128).
func (*QP5515) SetDisplayMode ¶
SetDisplayMode turns on/off the whole display, cursor, or cursor-blinking.
func (*QP5515) SetDisplayShiftOrCursorMove ¶
SetDisplayShiftOrCursorMove sets display shift or cursor move, and direction.
func (*QP5515) SetEntryMode ¶
SetEntryMode sets the data entry direction and whether to also shift.
func (*QP5515) SetFunction ¶
SetFunction sets the interface data length, number of display lines, and character font. eightbit = false means switch to 4-bit operation. twolines = false means use 1 display line. largefont = false mease use 5x7 font instead of 5x10 font.
type RS257543 ¶
type RS257543 struct {
LD, CLK, DIN gpio.PinIO // required, as described in the data sheet
DEG, COL, CUR gpio.PinIO // optional
RuneMap map[rune]uint8 // optional, uses a default map if nil
}
RS257543 implements a driver for the RS 257-543 module (a discontinued 4-digit LCD module based on the Hughes 0438A chip). DEG, COL, and CUR are optional, and if provided, are assumed to each be connected via an XOR gate with BP as described in the data sheet. RuneMap is also optional and if provided, is used by Display to translate each rune into 8 segments.
func (*RS257543) CycleDigits ¶
CycleDigits animates a simple test pattern consisting of hex digits.
func (*RS257543) Display ¶
Display displays a string on the module. Each rune in the string is translated to a digit, except for '.', which is translated into the DP ("decimal point") segment of the following digit (the DP segment is to the left of each digit).
func (*RS257543) RawDisplay ¶
RawDisplay loads bits into the display directly.