Update hd44780.go

Add method CreateChar.
This commit is contained in:
Cruiser79 2017-02-21 08:07:53 +01:00 committed by GitHub
parent adc3d47305
commit 642e75ad30
1 changed files with 11 additions and 0 deletions

View File

@ -646,3 +646,14 @@ func (conn *I2CConnection) Close() error {
glog.V(2).Info("hd44780: closing I2C bus")
return conn.I2C.Close()
}
// Allows us to fill the first 8 CGRAM locations
// with custom characters, we can then print with writeChar(0-7)
func (hd *HD44780) CreateChar(location byte, charmap []byte) error {
location &= 0x7;
err := hd.WriteInstruction(lcdSetCGRamAddr | (location << 3))
for i := 0; i < 8; i++ {
hd.WriteChar(charmap[i]);
}
return err
}