summaryrefslogtreecommitdiff
path: root/wasp/apps/flashlight.py
blob: 13341b059be84b82761eb006dc9a9e3b74bb691b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import wasp

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, effect=None):
        """Activate the application."""
        self.on_screen = ( -1, -1, -1, -1, -1, -1 )
        self.draw(effect)
        wasp.system.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 = wasp.watch.display
        display.fill(0xffff)