Skip to content

Commit 2c2da5c

Browse files
aykevldeadprogram
authored andcommitted
epd2in13: add Sleep method like other displays
For details, see: #548
1 parent 14994a3 commit 2c2da5c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

waveshare-epd/epd2in13/epd2in13.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ func (d *Device) DeepSleep() {
131131
d.WaitUntilIdle()
132132
}
133133

134+
// Set the sleep mode of the panel. The display will still show its contents,
135+
// but will go into a lower-power state.
136+
func (d *Device) Sleep(sleepEnabled bool) error {
137+
if sleepEnabled {
138+
d.DeepSleep()
139+
} else {
140+
d.Reset()
141+
}
142+
return nil
143+
}
144+
134145
// SendCommand sends a command to the display
135146
func (d *Device) SendCommand(command uint8) {
136147
d.sendDataCommand(true, command)

0 commit comments

Comments
 (0)