From 3af6e3e8c70fc2da96a3b83cff932bd374105e75 Mon Sep 17 00:00:00 2001 From: rdagger Date: Sat, 13 Aug 2022 14:11:29 -0700 Subject: [PATCH] Add sleep method. --- ili9341.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ili9341.py b/ili9341.py index eab78fc..e9a504d 100644 --- a/ili9341.py +++ b/ili9341.py @@ -957,6 +957,18 @@ class Display(object): bottom >> 8, bottom & 0xFF) + def sleep(self, enable=True): + """Enters or exits sleep mode. + + Args: + enable (bool): True (default)=Enter sleep mode, False=Exit sleep + """ + if enable: + self.write_cmd(self.SLPIN) + else: + self.write_cmd(self.SLPOUT) + + def write_cmd_mpy(self, command, *args): """Write command to OLED (MicroPython).