Skip to content

Commit

Permalink
feat(core): Add Rust UI components, layouts, text rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
jpochyla committed Jun 8, 2021
1 parent d6776d9 commit 7906336
Show file tree
Hide file tree
Showing 25 changed files with 2,529 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/embed/extmod/modtrezorui/modtrezorui.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@

#if MICROPY_PY_TREZORUI

#include "librust.h"
#include "modtrezorui-display.h"

STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorui_layout_new_example_obj,
ui_layout_new_example);

STATIC const mp_rom_map_elem_t mp_module_trezorui_globals_table[] = {
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorui)},
{MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&mod_trezorui_Display_type)},

{MP_ROM_QSTR(MP_QSTR_layout_new_example),
MP_ROM_PTR(&mod_trezorui_layout_new_example_obj)},
};

STATIC MP_DEFINE_CONST_DICT(mp_module_trezorui_globals,
Expand Down
139 changes: 139 additions & 0 deletions core/embed/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions core/embed/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ codegen-units = 1
[dependencies]
cty = "0.2.1"

[dependencies.heapless]
version = "0.7.0"
default_features = false

[dependencies.cstr_core]
version = "0.2.2"
default_features = false
Expand Down
2 changes: 2 additions & 0 deletions core/embed/rust/librust.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ mp_obj_t protobuf_decode(mp_obj_t buf, mp_obj_t def,
mp_obj_t enable_experimental);
mp_obj_t protobuf_len(mp_obj_t obj);
mp_obj_t protobuf_encode(mp_obj_t buf, mp_obj_t obj);

mp_obj_t ui_layout_new_example(void);
9 changes: 9 additions & 0 deletions core/embed/rust/librust_qstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ static void _librust_qstrs(void) {
MP_QSTR_is_type_of;
MP_QSTR_MESSAGE_WIRE_TYPE;
MP_QSTR_MESSAGE_NAME;

// layout
MP_QSTR_Layout;
MP_QSTR_set_timer_fn;
MP_QSTR_touch_start;
MP_QSTR_touch_move;
MP_QSTR_touch_end;
MP_QSTR_timer;
MP_QSTR_paint;
}
1 change: 1 addition & 0 deletions core/embed/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod error;
mod micropython;
mod protobuf;
mod trezorhal;
mod ui;
mod util;

#[cfg(not(test))]
Expand Down

0 comments on commit 7906336

Please sign in to comment.