1
0
Fork 0
wasp-os/wasp/apps/flashlight.py
Daniel Thompson 5413d826d7 wasp: Re-factor how Draw565 is used.
Moving it from applications into the watch is useful for two reasons.
Firstly it means applications don't need to know as much about the
display color depth and secondly it makes it easier to replace the
drawing routines with wasptool.
2020-03-08 23:16:30 +00:00

32 lines
760 B
Python

import watch
import manager
class FlashlightApp(object):
"""Trivial flashlight application.
Shows a pure white screen with the backlight set to maximum.
"""
def __init__(self):
self.backlight = None
def foreground(self, manager, effect=None):
"""Activate the application."""
self.on_screen = ( -1, -1, -1, -1, -1, -1 )
self.draw(effect)
manager.request_tick(1000)
def background(self):
"""De-activate the application (without losing state)."""
pass
def sleep(self):
return False
def tick(self, ticks):
pass
def draw(self, effect=None):
"""Redraw the display from scratch."""
display = watch.display
display.fill(0xffff)