From f6589580575785af9f9093fe55a68e497d833d57 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Thu, 8 Aug 2019 16:04:55 +0200 Subject: [PATCH] core/ui: Add ui.alert() for CTAP WINK command. --- core/src/trezor/ui/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index f1a747fa36..5d04127b65 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -75,6 +75,19 @@ def pulse(period: int, offset: int = 0) -> float: return 0.5 + 0.5 * math.sin(2 * math.pi * (utime.ticks_us() + offset) / period) +async def alert(count: int = 3) -> None: + short_sleep = loop.sleep(20000) + long_sleep = loop.sleep(80000) + for i in range(count * 2): + if i % 2 == 0: + display.backlight(style.BACKLIGHT_MAX) + await short_sleep + else: + display.backlight(style.BACKLIGHT_DIM) + await long_sleep + display.backlight(style.BACKLIGHT_NORMAL) + + async def click() -> Pos: touch = loop.wait(io.TOUCH) while True: