wasp: Adopt a low power mode shortly after booting
This is useful for battery run-down testing and so on.
This commit is contained in:
parent
9eb5d19e35
commit
c7e11d6020
3 changed files with 15 additions and 6 deletions
|
@ -1,6 +1,10 @@
|
||||||
import logo
|
import logo
|
||||||
import watch
|
import watch
|
||||||
|
import time
|
||||||
|
|
||||||
|
# Splash screen
|
||||||
watch.display.rleblit(logo.pine64, fg=0xffff)
|
watch.display.rleblit(logo.pine64, fg=0xffff)
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
watch.backlight.set(0)
|
||||||
|
watch.display.poweroff()
|
||||||
|
|
|
@ -7,6 +7,7 @@ from time import sleep_ms
|
||||||
|
|
||||||
# register definitions
|
# register definitions
|
||||||
_SWRESET = const(0x01)
|
_SWRESET = const(0x01)
|
||||||
|
_SLPIN = const(0x10)
|
||||||
_SLPOUT = const(0x11)
|
_SLPOUT = const(0x11)
|
||||||
_NORON = const(0x13)
|
_NORON = const(0x13)
|
||||||
_INVOFF = const(0x20)
|
_INVOFF = const(0x20)
|
||||||
|
@ -51,10 +52,12 @@ class ST7789(object):
|
||||||
#sleep_ms(125)
|
#sleep_ms(125)
|
||||||
|
|
||||||
def poweroff(self):
|
def poweroff(self):
|
||||||
pass
|
self.write_cmd(_SLPIN)
|
||||||
|
sleep_ms(125)
|
||||||
|
|
||||||
def poweron(self):
|
def poweron(self):
|
||||||
pass
|
self.write_cmd(_SLPOUT)
|
||||||
|
sleep_ms(125)
|
||||||
|
|
||||||
def contrast(self, contrast):
|
def contrast(self, contrast):
|
||||||
pass
|
pass
|
||||||
|
@ -139,7 +142,7 @@ class ST7789_SPI(ST7789):
|
||||||
self.res(1)
|
self.res(1)
|
||||||
else:
|
else:
|
||||||
self.write_cmd(_SWRESET)
|
self.write_cmd(_SWRESET)
|
||||||
sleep_ms(130)
|
sleep_ms(125)
|
||||||
|
|
||||||
def write_cmd(self, cmd):
|
def write_cmd(self, cmd):
|
||||||
self.dc(0)
|
self.dc(0)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
import demo
|
import machine
|
||||||
demo.run()
|
|
||||||
|
while True
|
||||||
|
machine.deepsleep()
|
||||||
|
|
Loading…
Add table
Reference in a new issue