mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 13:38:12 +00:00
WIP
This commit is contained in:
parent
c0487f1d6b
commit
afb4bb7d76
@ -1,9 +1,6 @@
|
|||||||
from trezor import ui
|
from trezor import ui
|
||||||
import layout
|
|
||||||
import utime
|
import utime
|
||||||
|
|
||||||
layout.show_send('1BitkeyP2nDd5oa64x7AjvBbbwST54W5Zmx2', 110.126967)
|
|
||||||
|
|
||||||
ui.touch.start(lambda x, y: print('touch start %d %d\n' % (x, y)))
|
ui.touch.start(lambda x, y: print('touch start %d %d\n' % (x, y)))
|
||||||
ui.touch.move(lambda x, y: print('touch move %d %d\n' % (x, y)))
|
ui.touch.move(lambda x, y: print('touch move %d %d\n' % (x, y)))
|
||||||
ui.touch.end(lambda x, y: print('touch end %d %d\n' % (x, y)))
|
ui.touch.end(lambda x, y: print('touch end %d %d\n' % (x, y)))
|
||||||
|
@ -10,7 +10,7 @@ import utime
|
|||||||
import math
|
import math
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
from uasyncio import core
|
from uasyncio import loop
|
||||||
# import transport_pipe as pipe
|
# import transport_pipe as pipe
|
||||||
|
|
||||||
from trezor import ui
|
from trezor import ui
|
||||||
@ -18,8 +18,9 @@ from trezor import msg
|
|||||||
from trezor.utils import unimport
|
from trezor.utils import unimport
|
||||||
from trezor import layout
|
from trezor import layout
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
if __debug__:
|
||||||
loop = core.get_event_loop()
|
import logging
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
def perf_info():
|
def perf_info():
|
||||||
mem_alloc = gc.mem_alloc()
|
mem_alloc = gc.mem_alloc()
|
||||||
@ -40,7 +41,7 @@ def animate():
|
|||||||
ui.display.icon(190, 170, f.read(), ui.rgbcolor(col, 0, 0), 0xffff)
|
ui.display.icon(190, 170, f.read(), ui.rgbcolor(col, 0, 0), 0xffff)
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
|
|
||||||
yield core.Sleep(int(0.5 * 1000000))
|
yield loop.Sleep(int(0.5 * 1000000))
|
||||||
|
|
||||||
sec = 0
|
sec = 0
|
||||||
event = None
|
event = None
|
||||||
@ -61,18 +62,30 @@ def sekunda(x):
|
|||||||
def wait_for():
|
def wait_for():
|
||||||
print("Jsem tady")
|
print("Jsem tady")
|
||||||
|
|
||||||
ktery = yield core.IOButton()
|
ktery = yield loop.IOButton()
|
||||||
print(ktery)
|
print(ktery)
|
||||||
|
|
||||||
print("Po cekani na event")
|
print("Po cekani na event")
|
||||||
|
|
||||||
def tap_to_confirm():
|
def tap_to_confirm(address, amount, currency):
|
||||||
|
|
||||||
|
loop.call_later(5 * 1000000, layout.change(homescreen()))
|
||||||
|
|
||||||
STEP_X = 0.07
|
STEP_X = 0.07
|
||||||
DELAY = int(0.01 * 1000000)
|
DELAY = int(0.01 * 1000000)
|
||||||
BASE_COLOR = (0x00, 0x00, 0x00)
|
BASE_COLOR = (0x00, 0x00, 0x00)
|
||||||
MIN_COLOR = 0x00
|
MIN_COLOR = 0x00
|
||||||
MAX_COLOR = 0xB0
|
MAX_COLOR = 0xB0
|
||||||
|
|
||||||
|
ui.display.bar(0, 0, 240, 40, ui.GREEN)
|
||||||
|
ui.display.bar(0, 40, 240, 200, ui.WHITE)
|
||||||
|
|
||||||
|
ui.display.text(10, 28, 'Sending', ui.BOLD, ui.WHITE, ui.GREEN)
|
||||||
|
ui.display.text(10, 80, '%f %s' % (amount, currency), ui.BOLD, ui.BLACK, ui.WHITE)
|
||||||
|
ui.display.text(10, 110, 'to this address:', ui.NORMAL, ui.BLACK, ui.WHITE)
|
||||||
|
ui.display.text(10, 140, address[:18], ui.MONO, ui.BLACK, ui.WHITE)
|
||||||
|
ui.display.text(10, 160, address[18:], ui.MONO, ui.BLACK, ui.WHITE)
|
||||||
|
|
||||||
f = open('playground/tap_64.toig', 'r')
|
f = open('playground/tap_64.toig', 'r')
|
||||||
|
|
||||||
_background = ui.rgbcolor(255, 255, 255)
|
_background = ui.rgbcolor(255, 255, 255)
|
||||||
@ -96,7 +109,7 @@ def tap_to_confirm():
|
|||||||
# ui.display.icon(165, 50, f.read(), _background, foreground)
|
# ui.display.icon(165, 50, f.read(), _background, foreground)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield core.Sleep(DELAY)
|
yield loop.Sleep(DELAY)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
print("Somebody asked me to stop layout tap_to_confirm")
|
print("Somebody asked me to stop layout tap_to_confirm")
|
||||||
return
|
return
|
||||||
@ -124,21 +137,27 @@ def zprava():
|
|||||||
# m2 = GetAddress.load(BytesIO(data))
|
# m2 = GetAddress.load(BytesIO(data))
|
||||||
# print(m2.__dict__)
|
# print(m2.__dict__)
|
||||||
|
|
||||||
def novy_layout():
|
def homescreen():
|
||||||
print("Novy layout!")
|
print("Homescreen layout!")
|
||||||
yield core.Sleep(2 * 1000000)
|
|
||||||
return tap_to_confirm
|
ui.display.bar(0, 0, 240, 240, ui.WHITE)
|
||||||
|
|
||||||
|
f = open('playground/trezor.toig', 'r')
|
||||||
|
f.seek(0)
|
||||||
|
ui.display.icon(0, 0, f.read(), ui.BLACK, ui.WHITE)
|
||||||
|
while True:
|
||||||
|
yield loop.Sleep(1000000)
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
# pipe.init('../pipe', on_read)
|
# pipe.init('../pipe', on_read)
|
||||||
# msg.set_notify(on_read)
|
# msg.set_notify(on_read)
|
||||||
|
|
||||||
zprava()
|
# zprava()
|
||||||
|
|
||||||
loop.call_soon(perf_info)
|
loop.call_soon(perf_info)
|
||||||
loop.call_soon(layout.set_main_layout(tap_to_confirm))
|
loop.call_soon(layout.set_main(homescreen()))
|
||||||
|
|
||||||
loop.call_later(2 * 1000000, layout.change_layout(novy_layout))
|
loop.call_later(3 * 1000000, layout.change(tap_to_confirm('1BitkeyP2nDd5oa64x7AjvBbbwST54W5Zmx2', 110.126967, 'BTC')))
|
||||||
# loop.call_soon(animate())
|
# loop.call_soon(animate())
|
||||||
|
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
|
Loading…
Reference in New Issue
Block a user