1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

adapt rest of code to touch changes, example works

This commit is contained in:
Jan Pochyla 2016-05-30 16:40:46 +02:00 committed by Pavol Rusnak
parent b6caad6b9b
commit 71b89c748a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
7 changed files with 11 additions and 14 deletions

View File

@ -4,7 +4,7 @@ from trezor.utils import unimport_gen
from trezor.res import loadres
from trezor import dispatcher
from trezor import loop
from trezor import msg
from trezor import wire
def swipe_to_rotate():
@ -39,7 +39,7 @@ def layout_homescreen(initialize_msg=None):
features.passphrase_cached = False
features.passphrase_protection = False
features.vendor = 'bitcointrezor.com'
msg.write_msg(features)
wire.write_msg(features)
yield loop.Wait([dispatcher.dispatch(),
swipe_to_rotate(),
animate_logo()])

View File

@ -1,4 +1,4 @@
from trezor import msg
from trezor import wire
from trezor import ui
from trezor.ui.button import Button, CONFIRM_BUTTON, CONFIRM_BUTTON_ACTIVE
from trezor.ui.pin import PinDialog
@ -23,4 +23,4 @@ def layout_get_public_key(message):
pubkey.node.fingerprint = 0
pubkey.node.chain_code = 'deadbeef'
pubkey.node.public_key = 'deadbeef'
msg.write_msg(pubkey)
wire.write_msg(pubkey)

View File

@ -1,4 +1,4 @@
from . import msg
from . import wire
from . import layout
@ -15,6 +15,6 @@ def unregister(message_type):
def dispatch():
mtypes = message_handlers.keys()
message = yield from msg.read_msg(*mtypes)
message = yield from wire.read_msg(*mtypes)
handler = message_handlers[message.message_type]
layout.change(handler(message))

View File

@ -16,7 +16,7 @@ if __debug__:
TOUCH = const(256) # 0-255 is reserved for USB interfaces
TOUCH_START = const(1)
TOUCH_MOVE = const(2)
TOUCH_END = const(3)
TOUCH_END = const(4)
msg_handlers = {} # Interface -> generator
time_queue = []
@ -138,8 +138,7 @@ def run_forever():
message = msg.select(delay)
if message:
# Run interrupt handler right away, they have priority
iface = message[0]
data = message
iface, *data = message
gen = msg_handlers.pop(iface, None)
if not gen:
log.info(__name__, 'No handler for message: %s', iface)

View File

@ -96,9 +96,7 @@ class Button():
def wait(self):
while True:
self.render()
event, *pos = yield loop.Select(loop.TOUCH_START,
loop.TOUCH_MOVE,
loop.TOUCH_END)
event, *pos = yield loop.Select(loop.TOUCH)
result = self.send(event, pos)
if result is not None:
return result

View File

@ -65,7 +65,7 @@ class Swipe():
def wait(self):
while True:
event, *pos = yield loop.Select(loop.TOUCH_START, loop.TOUCH_END)
event, *pos = yield loop.Select(loop.TOUCH)
result = self.send(event, pos)
if result is not None:
return result

View File

@ -10,7 +10,7 @@ HEADER_MAGIC = const(35) #
def read_report():
_, rep = yield loop.Select(IFACE)
rep, = yield loop.Select(IFACE)
assert rep[0] == REPORT_NUM, 'Report number malformed'
return rep