-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentry.go
More file actions
30 lines (26 loc) · 694 Bytes
/
entry.go
File metadata and controls
30 lines (26 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package lcd
type entryMode struct {
Increment bool
Shift bool
}
func (e entryMode) byte() byte {
var output byte
if e.Increment {
output |= 0b10
}
if e.Shift {
output |= 0b1
}
return output
}
// SetCursorIncrement controls cursor direction - increment/decrement i.e. right/left
func (l *LCD) SetCursorIncrement(enabled bool) {
l.entryMode.Increment = enabled
l.execInstruction(insEntryModeSet, l.entryMode.byte())
}
// SetShift controls content shifting - content will be moved to the left/right depending
// on the cursor incrementation setting
func (l *LCD) SetShift(enabled bool) {
l.entryMode.Shift = enabled
l.execInstruction(insEntryModeSet, l.entryMode.byte())
}