1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00

ui: add click helper

This commit is contained in:
Jan Pochyla 2018-02-05 11:49:04 +01:00
parent e907099be1
commit f20ce1fcc9

View File

@ -82,6 +82,19 @@ async def alert(count: int=3):
display.backlight(current)
async def click() -> tuple:
touch = loop.select(io.TOUCH)
while True:
ev, *pos = yield touch
if ev == io.TOUCH_START:
break
while True:
ev, *pos = yield touch
if ev == io.TOUCH_END:
break
return pos
async def backlight_slide(val: int, delay: int=20000, step: int=1):
sleep = loop.sleep(delay)
current = display.backlight()