From 2c2da5c7bbc7423c291be3187965be1a519782b1 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 6 Nov 2023 18:23:23 +0100 Subject: [PATCH] epd2in13: add Sleep method like other displays For details, see: https://github.com/tinygo-org/drivers/pull/548 --- waveshare-epd/epd2in13/epd2in13.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/waveshare-epd/epd2in13/epd2in13.go b/waveshare-epd/epd2in13/epd2in13.go index bc289ad..6971dab 100644 --- a/waveshare-epd/epd2in13/epd2in13.go +++ b/waveshare-epd/epd2in13/epd2in13.go @@ -131,6 +131,17 @@ func (d *Device) DeepSleep() { d.WaitUntilIdle() } +// Set the sleep mode of the panel. The display will still show its contents, +// but will go into a lower-power state. +func (d *Device) Sleep(sleepEnabled bool) error { + if sleepEnabled { + d.DeepSleep() + } else { + d.Reset() + } + return nil +} + // SendCommand sends a command to the display func (d *Device) SendCommand(command uint8) { d.sendDataCommand(true, command)