1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 13:38:12 +00:00

Adapt to new event loop interface

This commit is contained in:
slush0 2016-04-28 04:56:43 +02:00 committed by Pavol Rusnak
parent f2703f1af2
commit c0487f1d6b
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -5,7 +5,7 @@ import os
import ustruct
import uselect
from uasyncio import core
from uasyncio import loop
read_fd = None
write_fd = None
@ -29,7 +29,6 @@ def init(filename):
poll.register(read_fd, uselect.POLLIN)
# Setup polling
loop = core.get_event_loop()
loop.call_soon(watch_read())
def set_notify(_on_read):
@ -44,7 +43,7 @@ def close():
def watch_read():
global on_read
sleep = core.Sleep(10000) # 0.01s
sleep = loop.Sleep(10000) # 0.01s
while True:
if ready_to_read() and on_read:
on_read()