1
0
Fork 0

wasp: manager: Blankt the display during app transitions

This commit is contained in:
Daniel Thompson 2020-03-08 20:47:19 +00:00
parent adf9a33c9e
commit a864a93706
2 changed files with 15 additions and 1 deletions

View file

@ -1,4 +1,9 @@
# MicroPython ST7789 display driver, currently only has an SPI interface """Sitronix ST7789 display driver for MicroPython.
Note: Although the ST7789 supports a variety of communication protocols
currently this driver only has support for SPI interfaces. However it is
structured such that other serial protocols can easily be added.
"""
import micropython import micropython
@ -12,6 +17,7 @@ _SLPOUT = const(0x11)
_NORON = const(0x13) _NORON = const(0x13)
_INVOFF = const(0x20) _INVOFF = const(0x20)
_INVON = const(0x21) _INVON = const(0x21)
_DISPOFF = const(0x28)
_DISPON = const(0x29) _DISPON = const(0x29)
_CASET = const(0x2a) _CASET = const(0x2a)
_RASET = const(0x2b) _RASET = const(0x2b)
@ -78,6 +84,12 @@ class ST7789(object):
else: else:
self.write_cmd(_INVOFF) self.write_cmd(_INVOFF)
def mute(self, mute):
if mute:
self.write_cmd(_DISPOFF)
else:
self.write_cmd(_DISPON)
def set_window(self, x=0, y=0, width=None, height=None): def set_window(self, x=0, y=0, width=None, height=None):
if not width: if not width:
width = self.width width = self.width

View file

@ -42,7 +42,9 @@ class Manager(object):
self.tick_expiry = None self.tick_expiry = None
self.app = app self.app = app
self.watch.display.mute(True)
app.foreground(self) app.foreground(self)
self.watch.display.mute(False)
def navigate(self, direction=None): def navigate(self, direction=None):
"""Navigate between different applications. """Navigate between different applications.