2020-03-22 16:40:18 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
# Copyright (C) 2020 Daniel Thompson
|
|
|
|
|
2020-01-23 23:00:42 +01:00
|
|
|
#
|
|
|
|
# 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 ;-) ).
|
|
|
|
#
|
2020-01-23 20:36:48 +01:00
|
|
|
|
2020-03-09 01:00:13 +01:00
|
|
|
import watch, logo, time, gc
|
2020-01-23 20:36:48 +01:00
|
|
|
|
2020-01-23 23:00:42 +01:00
|
|
|
colors = (
|
|
|
|
0xffff,
|
|
|
|
0xf800, # red
|
|
|
|
0xffff,
|
|
|
|
0xffe0, # yellow
|
|
|
|
0xffff,
|
|
|
|
0x07e0, # green
|
|
|
|
0xffff,
|
|
|
|
0x07ff, # cyan
|
|
|
|
0xffff,
|
|
|
|
0x001f, # blue
|
|
|
|
0xffff,
|
|
|
|
0xf81f, # magenta
|
|
|
|
)
|
|
|
|
|
2020-02-19 20:47:51 +01:00
|
|
|
def textdemo():
|
|
|
|
watch.display.fill(0)
|
2020-03-09 01:00:13 +01:00
|
|
|
draw = watch.drawable
|
2020-02-19 20:47:51 +01:00
|
|
|
draw.string("The quick brown", 12, 24)
|
|
|
|
draw.string("fox jumped over", 12, 48)
|
|
|
|
draw.string("the lazy dog.", 12, 72)
|
|
|
|
time.sleep(2)
|
|
|
|
draw.string("0123456789", 12, 120)
|
|
|
|
draw.string('!"£$%^&*()', 12, 144)
|
|
|
|
time.sleep(3)
|
|
|
|
|
2020-01-23 23:00:42 +01:00
|
|
|
def run():
|
|
|
|
l = logo.pine64
|
|
|
|
i = 0
|
2020-01-23 20:36:48 +01:00
|
|
|
|
2020-02-04 09:44:21 +01:00
|
|
|
watch.display.poweron()
|
|
|
|
watch.backlight.set(2)
|
|
|
|
|
2020-01-23 20:36:48 +01:00
|
|
|
while True:
|
|
|
|
for c in colors:
|
2020-02-19 20:47:51 +01:00
|
|
|
if i == 2:
|
|
|
|
textdemo()
|
2020-01-23 23:00:42 +01:00
|
|
|
if i < 5:
|
|
|
|
i += 1
|
|
|
|
else:
|
|
|
|
i = 0
|
|
|
|
if l == logo.pine64:
|
|
|
|
l = logo.micropython
|
|
|
|
else:
|
|
|
|
l = logo.pine64
|
2020-01-30 23:11:31 +01:00
|
|
|
watch.display.fill(0)
|
2020-01-23 20:36:48 +01:00
|
|
|
|
2020-03-09 01:00:13 +01:00
|
|
|
watch.drawable.rleblit(l, fg=c)
|
2020-01-23 23:00:42 +01:00
|
|
|
time.sleep(2)
|
|
|
|
gc.collect()
|
2020-02-19 20:47:51 +01:00
|
|
|
|