mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-07-26 10:38:41 +00:00
ssd1306: add Sleep() function for Displayer interface
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -371,3 +371,15 @@ func (d *Device) Rotation() drivers.Rotation {
|
||||
func (d *Device) SetRotation(rotation drivers.Rotation) error {
|
||||
return errNotImplemented
|
||||
}
|
||||
|
||||
// Set the sleep mode for this display. When sleeping, the panel uses a lot
|
||||
// less power. The display won't show an image anymore, but the memory contents
|
||||
// should be kept.
|
||||
func (d *Device) Sleep(sleepEnabled bool) error {
|
||||
if sleepEnabled {
|
||||
d.Command(DISPLAYOFF)
|
||||
} else {
|
||||
d.Command(DISPLAYON)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user