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:
parent
f2703f1af2
commit
c0487f1d6b
@ -5,7 +5,7 @@ import os
|
|||||||
import ustruct
|
import ustruct
|
||||||
import uselect
|
import uselect
|
||||||
|
|
||||||
from uasyncio import core
|
from uasyncio import loop
|
||||||
|
|
||||||
read_fd = None
|
read_fd = None
|
||||||
write_fd = None
|
write_fd = None
|
||||||
@ -29,7 +29,6 @@ def init(filename):
|
|||||||
poll.register(read_fd, uselect.POLLIN)
|
poll.register(read_fd, uselect.POLLIN)
|
||||||
|
|
||||||
# Setup polling
|
# Setup polling
|
||||||
loop = core.get_event_loop()
|
|
||||||
loop.call_soon(watch_read())
|
loop.call_soon(watch_read())
|
||||||
|
|
||||||
def set_notify(_on_read):
|
def set_notify(_on_read):
|
||||||
@ -44,7 +43,7 @@ def close():
|
|||||||
|
|
||||||
def watch_read():
|
def watch_read():
|
||||||
global on_read
|
global on_read
|
||||||
sleep = core.Sleep(10000) # 0.01s
|
sleep = loop.Sleep(10000) # 0.01s
|
||||||
while True:
|
while True:
|
||||||
if ready_to_read() and on_read:
|
if ready_to_read() and on_read:
|
||||||
on_read()
|
on_read()
|
||||||
|
Loading…
Reference in New Issue
Block a user