mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 01:18:28 +00:00
introduce trezor module
This commit is contained in:
parent
4a9b60a0f3
commit
8493da5f97
2
emu.sh
2
emu.sh
@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd `dirname $0`/src
|
cd `dirname $0`/src
|
||||||
../vendor/micropython/unix/micropython -m main
|
../vendor/micropython/unix/micropython main.py
|
||||||
|
@ -155,11 +155,8 @@ typedef struct _mp_obj_Display_t {
|
|||||||
|
|
||||||
// def Display.__init__(self):
|
// def Display.__init__(self):
|
||||||
STATIC mp_obj_t mod_TrezorUi_Display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
STATIC mp_obj_t mod_TrezorUi_Display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||||
static mp_obj_Display_t *o = 0; // singleton
|
|
||||||
if (!o) {
|
|
||||||
display_init();
|
display_init();
|
||||||
o = m_new_obj(mp_obj_Display_t);
|
mp_obj_Display_t *o = m_new_obj(mp_obj_Display_t);
|
||||||
}
|
|
||||||
o->base.type = type;
|
o->base.type = type;
|
||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from TrezorUi import Display
|
from trezor import ui
|
||||||
|
|
||||||
def rgb2color(r, g, b):
|
def rgb2color(r, g, b):
|
||||||
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)
|
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)
|
||||||
@ -29,16 +29,11 @@ MONO = 0
|
|||||||
NORMAL = 1
|
NORMAL = 1
|
||||||
BOLD = 2
|
BOLD = 2
|
||||||
|
|
||||||
d = Display()
|
|
||||||
|
|
||||||
class Layout(object):
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def show_send(address, amount, currency='BTC'):
|
def show_send(address, amount, currency='BTC'):
|
||||||
d.bar(0, 0, 240, 40, GREEN)
|
ui.display.bar(0, 0, 240, 40, GREEN)
|
||||||
d.bar(0, 40, 240, 200, WHITE)
|
ui.display.bar(0, 40, 240, 200, WHITE)
|
||||||
d.text(10, 28, 'Sending', BOLD, WHITE, GREEN)
|
ui.display.text(10, 28, 'Sending', BOLD, WHITE, GREEN)
|
||||||
d.text(10, 80, '%f %s' % (amount, currency), BOLD, BLACK, WHITE)
|
ui.display.text(10, 80, '%f %s' % (amount, currency), BOLD, BLACK, WHITE)
|
||||||
d.text(10, 110, 'to this address:', NORMAL, BLACK, WHITE)
|
ui.display.text(10, 110, 'to this address:', NORMAL, BLACK, WHITE)
|
||||||
d.text(10, 140, address[:18], MONO, BLACK, WHITE)
|
ui.display.text(10, 140, address[:18], MONO, BLACK, WHITE)
|
||||||
d.text(10, 160, address[18:], MONO, BLACK, WHITE)
|
ui.display.text(10, 160, address[18:], MONO, BLACK, WHITE)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
from layout import Layout
|
import layout
|
||||||
|
|
||||||
Layout.show_send('1BitkeyP2nDd5oa64x7AjvBbbwST54W5Zmx2', 110.126967)
|
layout.show_send('1BitkeyP2nDd5oa64x7AjvBbbwST54W5Zmx2', 110.126967)
|
||||||
|
|
||||||
|
while True: pass
|
||||||
|
0
src/trezor/__init__.py
Normal file
0
src/trezor/__init__.py
Normal file
3
src/trezor/ui.py
Normal file
3
src/trezor/ui.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from TrezorUi import Display
|
||||||
|
|
||||||
|
display = Display()
|
Loading…
Reference in New Issue
Block a user