1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

TrezorUi -> TrezorUI

This commit is contained in:
Pavol Rusnak 2017-05-15 18:12:05 +02:00
parent c3e5e2b208
commit 4d4364f0b5
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 68 additions and 68 deletions

View File

@ -13,7 +13,7 @@ typedef struct _mp_obj_Display_t {
mp_obj_base_t base;
} mp_obj_Display_t;
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) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
display_init();
mp_obj_Display_t *o = m_new_obj(mp_obj_Display_t);
@ -25,27 +25,27 @@ STATIC mp_obj_t mod_TrezorUi_Display_make_new(const mp_obj_type_t *type, size_t
/// '''
/// Clear display (with black color)
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_clear(mp_obj_t self) {
STATIC mp_obj_t mod_TrezorUI_Display_clear(mp_obj_t self) {
display_clear();
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUi_Display_clear_obj, mod_TrezorUi_Display_clear);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUI_Display_clear_obj, mod_TrezorUI_Display_clear);
/// def trezor.ui.display.refresh() -> None
/// '''
/// Refresh display (update screen)
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_refresh(mp_obj_t self) {
STATIC mp_obj_t mod_TrezorUI_Display_refresh(mp_obj_t self) {
display_refresh();
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUi_Display_refresh_obj, mod_TrezorUi_Display_refresh);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_TrezorUI_Display_refresh_obj, mod_TrezorUI_Display_refresh);
/// def trezor.ui.display.bar(x: int, y: int, w: int, h: int, color: int) -> None:
/// '''
/// Renders a bar at position (x,y = upper left corner) with width w and height h of color color.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_bar(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_bar(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t w = mp_obj_get_int(args[3]);
@ -54,14 +54,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_bar(size_t n_args, const mp_obj_t *args) {
display_bar(x, y, w, h, c);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_bar_obj, 6, 6, mod_TrezorUi_Display_bar);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_bar_obj, 6, 6, mod_TrezorUI_Display_bar);
/// def trezor.ui.display.bar_radius(x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None, radius: int=None) -> None:
/// '''
/// Renders a rounded bar at position (x,y = upper left corner) with width w and height h of color fgcolor.
/// Background is set to bgcolor and corners are drawn with radius radius.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_bar_radius(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_bar_radius(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t w = mp_obj_get_int(args[3]);
@ -72,14 +72,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_bar_radius(size_t n_args, const mp_obj_t *a
display_bar_radius(x, y, w, h, c, b, r);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_bar_radius_obj, 8, 8, mod_TrezorUi_Display_bar_radius);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_bar_radius_obj, 8, 8, mod_TrezorUI_Display_bar_radius);
/// def trezor.ui.display.image(x: int, y: int, image: bytes) -> None:
/// '''
/// Renders an image at position (x,y).
/// The image needs to be in TREZOR Optimized Image Format (TOIF) - full-color mode.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_image(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_buffer_info_t image;
@ -97,14 +97,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_image(size_t n_args, const mp_obj_t *args)
display_image(x, y, w, h, data + 12, datalen);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_image_obj, 4, 4, mod_TrezorUi_Display_image);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_image_obj, 4, 4, mod_TrezorUI_Display_image);
/// def trezor.ui.display.icon(x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None:
/// '''
/// Renders an icon at position (x,y), fgcolor is used as foreground color, bgcolor as background.
/// The image needs to be in TREZOR Optimized Image Format (TOIF) - gray-scale mode.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_icon(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_icon(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_buffer_info_t icon;
@ -124,13 +124,13 @@ STATIC mp_obj_t mod_TrezorUi_Display_icon(size_t n_args, const mp_obj_t *args) {
display_icon(x, y, w, h, data + 12, icon.len - 12, fgcolor, bgcolor);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_icon_obj, 6, 6, mod_TrezorUi_Display_icon);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_icon_obj, 6, 6, mod_TrezorUI_Display_icon);
/// def trezor.ui.display.print(text: str) -> None:
/// '''
/// Renders text using 5x8 bitmap font (using special text mode)
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_print(mp_obj_t self, mp_obj_t text) {
STATIC mp_obj_t mod_TrezorUI_Display_print(mp_obj_t self, mp_obj_t text) {
mp_buffer_info_t buf;
mp_get_buffer_raise(text, &buf, MP_BUFFER_READ);
if (buf.len > 0) {
@ -138,14 +138,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_print(mp_obj_t self, mp_obj_t text) {
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorUi_Display_print_obj, mod_TrezorUi_Display_print);
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorUI_Display_print_obj, mod_TrezorUI_Display_print);
/// def trezor.ui.display.text(x: int, y: int, text: str, font: int, fgcolor: int, bgcolor: int) -> None:
/// '''
/// Renders left-aligned text at position (x,y) where x is left position and y is baseline.
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_text(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_text(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_buffer_info_t text;
@ -158,14 +158,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_text(size_t n_args, const mp_obj_t *args) {
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_obj, 7, 7, mod_TrezorUi_Display_text);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_text_obj, 7, 7, mod_TrezorUI_Display_text);
/// def trezor.ui.display.text_center(x: int, y: int, text: str, font: int, fgcolor: int, bgcolor: int) -> None:
/// '''
/// Renders text centered at position (x,y) where x is text center and y is baseline.
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_text_center(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_text_center(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_buffer_info_t text;
@ -178,14 +178,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_text_center(size_t n_args, const mp_obj_t *
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_center_obj, 7, 7, mod_TrezorUi_Display_text_center);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_text_center_obj, 7, 7, mod_TrezorUI_Display_text_center);
/// def trezor.ui.display.text_right(x: int, y: int, text: str, font: int, fgcolor: int, bgcolor: int) -> None:
/// '''
/// Renders right-aligned text at position (x,y) where x is right position and y is baseline.
/// Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_text_right(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_text_right(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_buffer_info_t text;
@ -198,13 +198,13 @@ STATIC mp_obj_t mod_TrezorUi_Display_text_right(size_t n_args, const mp_obj_t *a
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_text_right_obj, 7, 7, mod_TrezorUi_Display_text_right);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_text_right_obj, 7, 7, mod_TrezorUI_Display_text_right);
/// def trezor.ui.display.text_width(text: str, font: int) -> int:
/// '''
/// Returns a width of text in pixels. Font font is used for rendering.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_text_width(mp_obj_t self, mp_obj_t text, mp_obj_t font) {
STATIC mp_obj_t mod_TrezorUI_Display_text_width(mp_obj_t self, mp_obj_t text, mp_obj_t font) {
mp_buffer_info_t txt;
mp_get_buffer_raise(text, &txt, MP_BUFFER_READ);
mp_int_t f = mp_obj_get_int(font);
@ -214,14 +214,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_text_width(mp_obj_t self, mp_obj_t text, mp
}
return MP_OBJ_NEW_SMALL_INT(w);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUi_Display_text_width_obj, mod_TrezorUi_Display_text_width);
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorUI_Display_text_width_obj, mod_TrezorUI_Display_text_width);
/// def trezor.ui.display.qrcode(x: int, y: int, data: bytes, scale: int) -> None:
/// '''
/// Renders data encoded as a QR code centered at position (x,y).
/// Scale determines a zoom factor.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_qrcode(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_qrcode(size_t n_args, const mp_obj_t *args) {
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t scale = mp_obj_get_int(args[4]);
@ -235,7 +235,7 @@ STATIC mp_obj_t mod_TrezorUi_Display_qrcode(size_t n_args, const mp_obj_t *args)
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_qrcode_obj, 5, 5, mod_TrezorUi_Display_qrcode);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_qrcode_obj, 5, 5, mod_TrezorUI_Display_qrcode);
/// def trezor.ui.display.loader(progress: int, yoffset: int, fgcolor: int, bgcolor: int, icon: bytes=None, iconfgcolor: int=None) -> None:
/// '''
@ -244,7 +244,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_qrcode_obj, 5, 5
/// When icon and iconfgcolor are provided, an icon is drawn in the middle using the color specified in iconfgcolor.
/// Icon needs to be of exactly LOADER_ICON_SIZE x LOADER_ICON_SIZE pixels size.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_loader(size_t n_args, const mp_obj_t *args) {
mp_int_t progress = mp_obj_get_int(args[1]);
mp_int_t yoffset = mp_obj_get_int(args[2]);
mp_int_t fgcolor = mp_obj_get_int(args[3]);
@ -277,7 +277,7 @@ STATIC mp_obj_t mod_TrezorUi_Display_loader(size_t n_args, const mp_obj_t *args)
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_loader_obj, 5, 7, mod_TrezorUi_Display_loader);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_loader_obj, 5, 7, mod_TrezorUI_Display_loader);
/// def trezor.ui.display.orientation(degrees: int=None) -> int:
/// '''
@ -285,7 +285,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_loader_obj, 5, 7
/// Everything needs to be redrawn again when this function is used.
/// Call without the degrees parameter to just perform the read of the value.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_orientation(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_orientation(size_t n_args, const mp_obj_t *args) {
mp_int_t deg;
if (n_args > 1) {
deg = mp_obj_get_int(args[1]);
@ -298,14 +298,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_orientation(size_t n_args, const mp_obj_t *
}
return MP_OBJ_NEW_SMALL_INT(deg);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_orientation_obj, 1, 2, mod_TrezorUi_Display_orientation);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_orientation_obj, 1, 2, mod_TrezorUI_Display_orientation);
/// def trezor.ui.display.backlight(val: int=None) -> int:
/// '''
/// Sets backlight intensity to the value specified in val.
/// Call without the val parameter to just perform the read of the value.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_backlight(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_backlight(size_t n_args, const mp_obj_t *args) {
mp_int_t val;
if (n_args > 1) {
val = mp_obj_get_int(args[1]);
@ -318,14 +318,14 @@ STATIC mp_obj_t mod_TrezorUi_Display_backlight(size_t n_args, const mp_obj_t *ar
}
return MP_OBJ_NEW_SMALL_INT(val);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_backlight_obj, 1, 2, mod_TrezorUi_Display_backlight);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_backlight_obj, 1, 2, mod_TrezorUI_Display_backlight);
/// def trezor.ui.display.offset(xy: tuple=None) -> tuple:
/// '''
/// Sets offset (x, y) for all subsequent drawing calls.
/// Call without the xy parameter to just perform the read of the value.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_offset(size_t n_args, const mp_obj_t *args) {
STATIC mp_obj_t mod_TrezorUI_Display_offset(size_t n_args, const mp_obj_t *args) {
int xy[2], *ret;
if (n_args > 1) {
size_t xy_cnt;
@ -350,13 +350,13 @@ STATIC mp_obj_t mod_TrezorUi_Display_offset(size_t n_args, const mp_obj_t *args)
return MP_OBJ_FROM_PTR(tuple);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUi_Display_offset_obj, 1, 2, mod_TrezorUi_Display_offset);
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_TrezorUI_Display_offset_obj, 1, 2, mod_TrezorUI_Display_offset);
/// def trezor.ui.display.save(filename: string) -> None:
/// '''
/// Saves current display contents to file filename.
/// '''
STATIC mp_obj_t mod_TrezorUi_Display_save(mp_obj_t self, mp_obj_t filename) {
STATIC mp_obj_t mod_TrezorUI_Display_save(mp_obj_t self, mp_obj_t filename) {
mp_buffer_info_t fn;
mp_get_buffer_raise(filename, &fn, MP_BUFFER_READ);
if (fn.len > 0) {
@ -364,35 +364,35 @@ STATIC mp_obj_t mod_TrezorUi_Display_save(mp_obj_t self, mp_obj_t filename) {
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorUi_Display_save_obj, mod_TrezorUi_Display_save);
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorUI_Display_save_obj, mod_TrezorUI_Display_save);
STATIC const mp_rom_map_elem_t mod_TrezorUi_Display_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&mod_TrezorUi_Display_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&mod_TrezorUi_Display_refresh_obj) },
{ MP_ROM_QSTR(MP_QSTR_bar), MP_ROM_PTR(&mod_TrezorUi_Display_bar_obj) },
{ MP_ROM_QSTR(MP_QSTR_bar_radius), MP_ROM_PTR(&mod_TrezorUi_Display_bar_radius_obj) },
{ MP_ROM_QSTR(MP_QSTR_image), MP_ROM_PTR(&mod_TrezorUi_Display_image_obj) },
{ MP_ROM_QSTR(MP_QSTR_icon), MP_ROM_PTR(&mod_TrezorUi_Display_icon_obj) },
{ MP_ROM_QSTR(MP_QSTR_print), MP_ROM_PTR(&mod_TrezorUi_Display_print_obj) },
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&mod_TrezorUi_Display_text_obj) },
{ MP_ROM_QSTR(MP_QSTR_text_center), MP_ROM_PTR(&mod_TrezorUi_Display_text_center_obj) },
{ MP_ROM_QSTR(MP_QSTR_text_right), MP_ROM_PTR(&mod_TrezorUi_Display_text_right_obj) },
{ MP_ROM_QSTR(MP_QSTR_text_width), MP_ROM_PTR(&mod_TrezorUi_Display_text_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_qrcode), MP_ROM_PTR(&mod_TrezorUi_Display_qrcode_obj) },
{ MP_ROM_QSTR(MP_QSTR_loader), MP_ROM_PTR(&mod_TrezorUi_Display_loader_obj) },
{ MP_ROM_QSTR(MP_QSTR_orientation), MP_ROM_PTR(&mod_TrezorUi_Display_orientation_obj) },
{ MP_ROM_QSTR(MP_QSTR_backlight), MP_ROM_PTR(&mod_TrezorUi_Display_backlight_obj) },
{ MP_ROM_QSTR(MP_QSTR_offset), MP_ROM_PTR(&mod_TrezorUi_Display_offset_obj) },
{ MP_ROM_QSTR(MP_QSTR_save), MP_ROM_PTR(&mod_TrezorUi_Display_save_obj) },
STATIC const mp_rom_map_elem_t mod_TrezorUI_Display_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&mod_TrezorUI_Display_clear_obj) },
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&mod_TrezorUI_Display_refresh_obj) },
{ MP_ROM_QSTR(MP_QSTR_bar), MP_ROM_PTR(&mod_TrezorUI_Display_bar_obj) },
{ MP_ROM_QSTR(MP_QSTR_bar_radius), MP_ROM_PTR(&mod_TrezorUI_Display_bar_radius_obj) },
{ MP_ROM_QSTR(MP_QSTR_image), MP_ROM_PTR(&mod_TrezorUI_Display_image_obj) },
{ MP_ROM_QSTR(MP_QSTR_icon), MP_ROM_PTR(&mod_TrezorUI_Display_icon_obj) },
{ MP_ROM_QSTR(MP_QSTR_print), MP_ROM_PTR(&mod_TrezorUI_Display_print_obj) },
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&mod_TrezorUI_Display_text_obj) },
{ MP_ROM_QSTR(MP_QSTR_text_center), MP_ROM_PTR(&mod_TrezorUI_Display_text_center_obj) },
{ MP_ROM_QSTR(MP_QSTR_text_right), MP_ROM_PTR(&mod_TrezorUI_Display_text_right_obj) },
{ MP_ROM_QSTR(MP_QSTR_text_width), MP_ROM_PTR(&mod_TrezorUI_Display_text_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_qrcode), MP_ROM_PTR(&mod_TrezorUI_Display_qrcode_obj) },
{ MP_ROM_QSTR(MP_QSTR_loader), MP_ROM_PTR(&mod_TrezorUI_Display_loader_obj) },
{ MP_ROM_QSTR(MP_QSTR_orientation), MP_ROM_PTR(&mod_TrezorUI_Display_orientation_obj) },
{ MP_ROM_QSTR(MP_QSTR_backlight), MP_ROM_PTR(&mod_TrezorUI_Display_backlight_obj) },
{ MP_ROM_QSTR(MP_QSTR_offset), MP_ROM_PTR(&mod_TrezorUI_Display_offset_obj) },
{ MP_ROM_QSTR(MP_QSTR_save), MP_ROM_PTR(&mod_TrezorUI_Display_save_obj) },
{ MP_ROM_QSTR(MP_QSTR_FONT_MONO), MP_OBJ_NEW_SMALL_INT(FONT_MONO) },
{ MP_ROM_QSTR(MP_QSTR_FONT_NORMAL), MP_OBJ_NEW_SMALL_INT(FONT_NORMAL) },
{ MP_ROM_QSTR(MP_QSTR_FONT_BOLD), MP_OBJ_NEW_SMALL_INT(FONT_BOLD) },
};
STATIC MP_DEFINE_CONST_DICT(mod_TrezorUi_Display_locals_dict, mod_TrezorUi_Display_locals_dict_table);
STATIC MP_DEFINE_CONST_DICT(mod_TrezorUI_Display_locals_dict, mod_TrezorUI_Display_locals_dict_table);
STATIC const mp_obj_type_t mod_TrezorUi_Display_type = {
STATIC const mp_obj_type_t mod_TrezorUI_Display_type = {
{ &mp_type_type },
.name = MP_QSTR_Display,
.make_new = mod_TrezorUi_Display_make_new,
.locals_dict = (void*)&mod_TrezorUi_Display_locals_dict,
.make_new = mod_TrezorUI_Display_make_new,
.locals_dict = (void*)&mod_TrezorUI_Display_locals_dict,
};

View File

@ -15,16 +15,16 @@
#include "modtrezorui-display.h"
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) },
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) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_TrezorUi_globals, mp_module_TrezorUi_globals_table);
STATIC MP_DEFINE_CONST_DICT(mp_module_TrezorUI_globals, mp_module_TrezorUI_globals_table);
const mp_obj_module_t mp_module_TrezorUi = {
const mp_obj_module_t mp_module_TrezorUI = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&mp_module_TrezorUi_globals,
.globals = (mp_obj_dict_t*)&mp_module_TrezorUI_globals,
};
#endif // MICROPY_PY_TREZORUI

View File

@ -127,7 +127,7 @@ extern const struct _mp_obj_module_t mp_module_TrezorConfig;
extern const struct _mp_obj_module_t mp_module_TrezorCrypto;
extern const struct _mp_obj_module_t mp_module_TrezorIO;
extern const struct _mp_obj_module_t mp_module_TrezorMsg;
extern const struct _mp_obj_module_t mp_module_TrezorUi;
extern const struct _mp_obj_module_t mp_module_TrezorUI;
extern const struct _mp_obj_module_t mp_module_TrezorUtils;
#define MICROPY_PORT_BUILTIN_MODULES \
@ -136,7 +136,7 @@ extern const struct _mp_obj_module_t mp_module_TrezorUtils;
{ MP_OBJ_NEW_QSTR(MP_QSTR_TrezorCrypto), (mp_obj_t)&mp_module_TrezorCrypto }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_TrezorIO), (mp_obj_t)&mp_module_TrezorIO }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_TrezorMsg), (mp_obj_t)&mp_module_TrezorMsg }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_TrezorUi), (mp_obj_t)&mp_module_TrezorUi }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_TrezorUI), (mp_obj_t)&mp_module_TrezorUI }, \
{ MP_OBJ_NEW_QSTR(MP_QSTR_TrezorUtils), (mp_obj_t)&mp_module_TrezorUtils },
#define MP_STATE_PORT MP_STATE_VM

View File

@ -182,7 +182,7 @@ extern const struct _mp_obj_module_t mp_module_TrezorConfig;
extern const struct _mp_obj_module_t mp_module_TrezorCrypto;
extern const struct _mp_obj_module_t mp_module_TrezorIO;
extern const struct _mp_obj_module_t mp_module_TrezorMsg;
extern const struct _mp_obj_module_t mp_module_TrezorUi;
extern const struct _mp_obj_module_t mp_module_TrezorUI;
extern const struct _mp_obj_module_t mp_module_TrezorUtils;
#if MICROPY_PY_UOS_VFS
@ -242,7 +242,7 @@ extern const struct _mp_obj_module_t mp_module_TrezorUtils;
#define MICROPY_PY_TREZORMSG_DEF
#endif
#if MICROPY_PY_TREZORUI
#define MICROPY_PY_TREZORUI_DEF { MP_ROM_QSTR(MP_QSTR_TrezorUi), MP_ROM_PTR(&mp_module_TrezorUi) },
#define MICROPY_PY_TREZORUI_DEF { MP_ROM_QSTR(MP_QSTR_TrezorUI), MP_ROM_PTR(&mp_module_TrezorUI) },
#else
#define MICROPY_PY_TREZORUI_DEF
#endif

View File

@ -2,7 +2,7 @@ import sys
import math
import utime
from TrezorUi import Display
from TrezorUI import Display
from trezor import loop, res
display = Display()