summaryrefslogtreecommitdiff
path: root/wasp/demo.py
blob: 1470ff5877519d21b61a4b4e08a9cda426cf509e (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# Logo demo for PineTime
#
# This demo is simply an alternating sweep of the Pine64 and
# MicroPython logos. It cycles through a variety of colours
# and swaps between the logos every 5 images (so make sure
# len(colors) is not a multiple of 5 ;-) ).
#

import pinetime, logo, time, gc

colors = (
        0xffff,
        0xf800, # red
        0xffff,
        0xffe0, # yellow
        0xffff,
        0x07e0, # green
        0xffff,
        0x07ff, # cyan
        0xffff,
        0x001f, # blue
        0xffff,
        0xf81f, # magenta
    )

# Let's keep this where we can find it if someone delivers ^C to the
# demo
tft = pinetime.st7789()

def run():
    l = logo.pine64
    i = 0

    while True:
        for c in colors:
            if i < 5:
                i += 1
            else:
                i = 0
                if l == logo.pine64:
                    l = logo.micropython
                else:
                    l = logo.pine64
                tft.fill(0)

            tft.rleblit(l, fg=c)
            time.sleep(2)
            gc.collect()