1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

trezor.ui: introduce ui.SIZE

This commit is contained in:
Pavol Rusnak 2017-12-16 14:50:28 +01:00
parent 965bf84cdb
commit 4584861385
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 8 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#define DISPLAY_RESY 240
#define FONT_BPP 4
#define FONT_SIZE 20
#ifdef TREZOR_FONT_MONO_ENABLE
#define FONT_MONO 0

View File

@ -423,6 +423,9 @@ STATIC const mp_rom_map_elem_t mod_trezorui_Display_locals_dict_table[] = {
{ 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_WIDTH), MP_OBJ_NEW_SMALL_INT(DISPLAY_RESX) },
{ MP_ROM_QSTR(MP_QSTR_HEIGHT), MP_OBJ_NEW_SMALL_INT(DISPLAY_RESY) },
{ MP_ROM_QSTR(MP_QSTR_FONT_SIZE), MP_OBJ_NEW_SMALL_INT(FONT_SIZE) },
{ 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) },

View File

@ -16,13 +16,13 @@ display = Display()
if sys.platform != 'trezor':
loop.after_step_hook = display.refresh
# font styles
# import constants from modtrezorui
SIZE = Display.FONT_SIZE
NORMAL = Display.FONT_NORMAL
BOLD = Display.FONT_BOLD
MONO = Display.FONT_MONO
# display width and height
SCREEN = const(240)
SCREEN = Display.WIDTH # used also for height as we have square display
def lerpi(a: int, b: int, t: float) -> int: