fixup! feat(core/rust): model R bootloader implementation in rust

tychovrahe/rust_bootloader_/tr
tychovrahe 2 years ago
parent f722ba840e
commit af6cbe7d05

@ -26,8 +26,8 @@ SOURCE_MOD = []
if TREZOR_MODEL in ('1', 'R'):
FONT_NORMAL='Font_PixelOperator_Regular_8'
FONT_DEMIBOLD=None
FONT_BOLD=None
FONT_MONO='Font_PixelOperatorMono_Regular_8'
FONT_BOLD='Font_PixelOperator8_Bold_8'
FONT_MONO='Font_PixelOperator_Regular_8'
if TREZOR_MODEL in ('T', ):
FONT_NORMAL='Font_TTHoves_Regular_18'
FONT_DEMIBOLD=None

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

@ -109,7 +109,6 @@ void ui_screen_boot(const vendor_header *const vhdr,
FONT_NORMAL, COLOR_BL_BG, boot_background);
}
PIXELDATA_DIRTY();
display_refresh();
}
@ -119,7 +118,6 @@ void ui_screen_boot_wait(int wait_seconds) {
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5, wait_str, -1,
FONT_NORMAL, COLOR_BL_BG, boot_background);
PIXELDATA_DIRTY();
display_refresh();
}
@ -128,7 +126,6 @@ void ui_screen_boot_click(void) {
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5,
"click to continue ...", -1, FONT_NORMAL, COLOR_BL_BG,
boot_background);
PIXELDATA_DIRTY();
display_refresh();
}

@ -550,7 +550,7 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
FIRMWARE_IMAGE_MAGIC, FIRMWARE_IMAGE_MAXSIZE);
if (current_hdr !=
(const image_header *)FIRMWARE_START + current_vhdr.hdrlen) {
(const image_header *)(FIRMWARE_START + current_vhdr.hdrlen)) {
is_new = sectrue;
}
}

@ -546,7 +546,7 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
FIRMWARE_IMAGE_MAGIC, FIRMWARE_IMAGE_MAXSIZE);
if (current_hdr !=
(const image_header *)FIRMWARE_START + current_vhdr.hdrlen) {
(const image_header *)(FIRMWARE_START + current_vhdr.hdrlen)) {
is_new = sectrue;
}
}

@ -0,0 +1,203 @@
#include <stdint.h>
// clang-format off
// - the first two bytes are width and height of the glyph
// - the third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
// - the rest is packed 1-bit glyph data
/* */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_32[] = { 0, 0, 4, 0, 0 };
/* ! */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_33[] = { 2, 7, 5, 1, 7, 255, 204 };
/* " */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_34[] = { 5, 3, 6, 0, 7, 222, 246 };
/* # */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_35[] = { 7, 6, 8, 0, 6, 109, 253, 179, 111, 237, 128 };
/* $ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_36[] = { 7, 7, 8, 0, 7, 16, 251, 67, 225, 127, 132, 0 };
/* % */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_37[] = { 12, 7, 13, 0, 7, 112, 141, 152, 219, 7, 110, 13, 177, 155, 16, 224 };
/* & */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_38[] = { 6, 7, 7, 0, 7, 123, 60, 30, 207, 55, 192 };
/* ' */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_39[] = { 2, 3, 5, 1, 7, 252 };
/* ( */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_40[] = { 4, 7, 7, 2, 7, 54, 204, 198, 48 };
/* ) */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_41[] = { 4, 7, 7, 0, 7, 198, 51, 54, 192 };
/* * */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_42[] = { 5, 7, 6, 0, 7, 37, 126, 239, 212, 128 };
/* + */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_43[] = { 6, 5, 7, 0, 6, 48, 207, 204, 48 };
/* , */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_44[] = { 3, 3, 5, 0, 2, 111, 0 };
/* - */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_45[] = { 4, 1, 5, 0, 4, 240 };
/* . */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_46[] = { 2, 1, 5, 1, 1, 192 };
/* / */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_47[] = { 4, 7, 5, 0, 7, 51, 102, 108, 192 };
/* 0 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_48[] = { 6, 7, 7, 0, 7, 123, 61, 255, 239, 55, 128 };
/* 1 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_49[] = { 4, 7, 7, 1, 7, 55, 251, 51, 48 };
/* 2 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_50[] = { 6, 7, 7, 0, 7, 123, 48, 198, 49, 143, 192 };
/* 3 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_51[] = { 6, 7, 7, 0, 7, 123, 48, 206, 15, 55, 128 };
/* 4 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_52[] = { 6, 7, 7, 0, 7, 28, 246, 243, 252, 48, 192 };
/* 5 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_53[] = { 6, 7, 7, 0, 7, 255, 15, 131, 15, 55, 128 };
/* 6 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_54[] = { 6, 7, 7, 0, 7, 123, 60, 62, 207, 55, 128 };
/* 7 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_55[] = { 6, 7, 7, 0, 7, 252, 49, 140, 99, 12, 0 };
/* 8 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_56[] = { 6, 7, 7, 0, 7, 123, 60, 222, 207, 55, 128 };
/* 9 */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_57[] = { 6, 7, 7, 0, 7, 123, 60, 223, 15, 55, 128 };
/* : */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_58[] = { 2, 5, 5, 1, 5, 192, 192 };
/* ; */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_59[] = { 3, 6, 5, 0, 5, 96, 55, 128 };
/* < */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_60[] = { 4, 5, 5, 0, 6, 54, 198, 48 };
/* = */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_61[] = { 4, 3, 5, 0, 5, 240, 240 };
/* > */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_62[] = { 4, 5, 5, 0, 6, 198, 54, 192 };
/* ? */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_63[] = { 6, 7, 7, 0, 7, 123, 48, 198, 48, 3, 0 };
/* @ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_64[] = { 7, 8, 8, 0, 7, 125, 6, 109, 90, 179, 160, 62, 0 };
/* A */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_65[] = { 6, 7, 7, 0, 7, 123, 60, 243, 255, 60, 192 };
/* B */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_66[] = { 6, 7, 7, 0, 7, 251, 60, 254, 207, 63, 128 };
/* C */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_67[] = { 6, 7, 7, 0, 7, 123, 60, 48, 195, 55, 128 };
/* D */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_68[] = { 6, 7, 7, 0, 7, 251, 60, 243, 207, 63, 128 };
/* E */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_69[] = { 6, 7, 7, 0, 7, 255, 12, 60, 195, 15, 192 };
/* F */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_70[] = { 6, 7, 7, 0, 7, 255, 12, 60, 195, 12, 0 };
/* G */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_71[] = { 6, 7, 7, 0, 7, 123, 60, 55, 207, 55, 192 };
/* H */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_72[] = { 6, 7, 7, 0, 7, 207, 60, 255, 207, 60, 192 };
/* I */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_73[] = { 2, 7, 5, 1, 7, 255, 252 };
/* J */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_74[] = { 6, 7, 7, 0, 7, 12, 48, 195, 15, 55, 128 };
/* K */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_75[] = { 6, 7, 7, 0, 7, 207, 111, 56, 243, 108, 192 };
/* L */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_76[] = { 6, 7, 7, 0, 7, 195, 12, 48, 195, 15, 192 };
/* M */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_77[] = { 7, 7, 8, 0, 7, 199, 143, 191, 253, 120, 241, 128 };
/* N */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_78[] = { 6, 7, 7, 0, 7, 207, 62, 255, 223, 60, 192 };
/* O */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_79[] = { 6, 7, 7, 0, 7, 123, 60, 243, 207, 55, 128 };
/* P */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_80[] = { 6, 7, 7, 0, 7, 251, 60, 243, 251, 12, 0 };
/* Q */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_81[] = { 6, 7, 7, 0, 7, 123, 60, 251, 255, 102, 192 };
/* R */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_82[] = { 6, 7, 7, 0, 7, 251, 60, 243, 251, 108, 192 };
/* S */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_83[] = { 6, 7, 7, 0, 7, 123, 60, 30, 15, 55, 128 };
/* T */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_84[] = { 6, 7, 7, 0, 7, 252, 195, 12, 48, 195, 0 };
/* U */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_85[] = { 6, 7, 7, 0, 7, 207, 60, 243, 207, 55, 128 };
/* V */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_86[] = { 6, 7, 7, 0, 7, 207, 60, 243, 205, 227, 0 };
/* W */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_87[] = { 7, 7, 8, 0, 7, 199, 143, 94, 189, 122, 219, 0 };
/* X */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_88[] = { 6, 7, 7, 0, 7, 207, 55, 140, 123, 60, 192 };
/* Y */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_89[] = { 6, 7, 7, 0, 7, 207, 55, 140, 48, 195, 0 };
/* Z */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_90[] = { 6, 7, 7, 0, 7, 252, 49, 140, 99, 15, 192 };
/* [ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_91[] = { 4, 7, 7, 2, 7, 252, 204, 204, 240 };
/* \ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_92[] = { 4, 7, 5, 0, 7, 204, 102, 99, 48 };
/* ] */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_93[] = { 4, 7, 6, 0, 7, 243, 51, 51, 240 };
/* ^ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_94[] = { 6, 4, 7, 0, 7, 49, 236, 225, 0 };
/* _ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_95[] = { 5, 1, 5, 0, 0, 248 };
/* ` */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_96[] = { 3, 2, 5, 0, 7, 204 };
/* a */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_97[] = { 6, 5, 7, 0, 5, 120, 55, 243, 124 };
/* b */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_98[] = { 6, 7, 7, 0, 7, 195, 15, 179, 207, 63, 128 };
/* c */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_99[] = { 6, 5, 7, 0, 5, 123, 60, 51, 120 };
/* d */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_100[] = { 6, 7, 7, 0, 7, 12, 55, 243, 207, 55, 192 };
/* e */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_101[] = { 6, 5, 7, 0, 5, 123, 63, 240, 120 };
/* f */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_102[] = { 5, 7, 6, 0, 7, 59, 62, 198, 49, 128 };
/* g */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_103[] = { 6, 6, 7, 0, 5, 127, 60, 223, 13, 224 };
/* h */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_104[] = { 6, 7, 7, 0, 7, 195, 15, 179, 207, 60, 192 };
/* i */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_105[] = { 2, 7, 5, 1, 7, 207, 252 };
/* j */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_106[] = { 6, 8, 7, 0, 7, 12, 0, 195, 12, 60, 222, 0 };
/* k */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_107[] = { 6, 7, 7, 0, 7, 195, 13, 188, 243, 108, 192 };
/* l */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_108[] = { 3, 7, 5, 1, 7, 219, 109, 152 };
/* m */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_109[] = { 7, 5, 8, 0, 5, 237, 175, 94, 60, 96 };
/* n */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_110[] = { 6, 5, 7, 0, 5, 251, 60, 243, 204 };
/* o */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_111[] = { 6, 5, 7, 0, 5, 123, 60, 243, 120 };
/* p */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_112[] = { 6, 6, 7, 0, 5, 251, 60, 254, 195, 0 };
/* q */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_113[] = { 6, 6, 7, 0, 5, 127, 60, 223, 12, 48 };
/* r */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_114[] = { 6, 5, 7, 0, 5, 207, 126, 48, 192 };
/* s */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_115[] = { 6, 5, 7, 0, 5, 123, 7, 131, 248 };
/* t */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_116[] = { 5, 6, 6, 0, 6, 103, 216, 198, 28 };
/* u */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_117[] = { 6, 5, 7, 0, 5, 207, 60, 243, 120 };
/* v */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_118[] = { 6, 5, 7, 0, 5, 207, 60, 222, 48 };
/* w */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_119[] = { 7, 5, 8, 0, 5, 199, 143, 94, 182, 192 };
/* x */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_120[] = { 6, 5, 7, 0, 5, 205, 227, 30, 204 };
/* y */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_121[] = { 6, 6, 7, 0, 5, 207, 60, 223, 13, 224 };
/* z */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_122[] = { 6, 5, 7, 0, 5, 252, 99, 24, 252 };
/* { */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_123[] = { 5, 7, 6, 0, 7, 59, 25, 134, 48, 224 };
/* | */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_124[] = { 2, 7, 5, 1, 7, 255, 252 };
/* } */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_125[] = { 5, 7, 6, 0, 7, 225, 140, 51, 27, 128 };
/* ~ */ static const uint8_t Font_PixelOperator8_Bold_8_glyph_126[] = { 7, 2, 8, 0, 7, 119, 184 };
const uint8_t Font_PixelOperator8_Bold_8_glyph_nonprintable[] = { 6, 7, 7, 0, 7, 132, 207, 57, 207, 252, 255 };
const uint8_t * const Font_PixelOperator8_Bold_8[126 + 1 - 32] = {
Font_PixelOperator8_Bold_8_glyph_32,
Font_PixelOperator8_Bold_8_glyph_33,
Font_PixelOperator8_Bold_8_glyph_34,
Font_PixelOperator8_Bold_8_glyph_35,
Font_PixelOperator8_Bold_8_glyph_36,
Font_PixelOperator8_Bold_8_glyph_37,
Font_PixelOperator8_Bold_8_glyph_38,
Font_PixelOperator8_Bold_8_glyph_39,
Font_PixelOperator8_Bold_8_glyph_40,
Font_PixelOperator8_Bold_8_glyph_41,
Font_PixelOperator8_Bold_8_glyph_42,
Font_PixelOperator8_Bold_8_glyph_43,
Font_PixelOperator8_Bold_8_glyph_44,
Font_PixelOperator8_Bold_8_glyph_45,
Font_PixelOperator8_Bold_8_glyph_46,
Font_PixelOperator8_Bold_8_glyph_47,
Font_PixelOperator8_Bold_8_glyph_48,
Font_PixelOperator8_Bold_8_glyph_49,
Font_PixelOperator8_Bold_8_glyph_50,
Font_PixelOperator8_Bold_8_glyph_51,
Font_PixelOperator8_Bold_8_glyph_52,
Font_PixelOperator8_Bold_8_glyph_53,
Font_PixelOperator8_Bold_8_glyph_54,
Font_PixelOperator8_Bold_8_glyph_55,
Font_PixelOperator8_Bold_8_glyph_56,
Font_PixelOperator8_Bold_8_glyph_57,
Font_PixelOperator8_Bold_8_glyph_58,
Font_PixelOperator8_Bold_8_glyph_59,
Font_PixelOperator8_Bold_8_glyph_60,
Font_PixelOperator8_Bold_8_glyph_61,
Font_PixelOperator8_Bold_8_glyph_62,
Font_PixelOperator8_Bold_8_glyph_63,
Font_PixelOperator8_Bold_8_glyph_64,
Font_PixelOperator8_Bold_8_glyph_65,
Font_PixelOperator8_Bold_8_glyph_66,
Font_PixelOperator8_Bold_8_glyph_67,
Font_PixelOperator8_Bold_8_glyph_68,
Font_PixelOperator8_Bold_8_glyph_69,
Font_PixelOperator8_Bold_8_glyph_70,
Font_PixelOperator8_Bold_8_glyph_71,
Font_PixelOperator8_Bold_8_glyph_72,
Font_PixelOperator8_Bold_8_glyph_73,
Font_PixelOperator8_Bold_8_glyph_74,
Font_PixelOperator8_Bold_8_glyph_75,
Font_PixelOperator8_Bold_8_glyph_76,
Font_PixelOperator8_Bold_8_glyph_77,
Font_PixelOperator8_Bold_8_glyph_78,
Font_PixelOperator8_Bold_8_glyph_79,
Font_PixelOperator8_Bold_8_glyph_80,
Font_PixelOperator8_Bold_8_glyph_81,
Font_PixelOperator8_Bold_8_glyph_82,
Font_PixelOperator8_Bold_8_glyph_83,
Font_PixelOperator8_Bold_8_glyph_84,
Font_PixelOperator8_Bold_8_glyph_85,
Font_PixelOperator8_Bold_8_glyph_86,
Font_PixelOperator8_Bold_8_glyph_87,
Font_PixelOperator8_Bold_8_glyph_88,
Font_PixelOperator8_Bold_8_glyph_89,
Font_PixelOperator8_Bold_8_glyph_90,
Font_PixelOperator8_Bold_8_glyph_91,
Font_PixelOperator8_Bold_8_glyph_92,
Font_PixelOperator8_Bold_8_glyph_93,
Font_PixelOperator8_Bold_8_glyph_94,
Font_PixelOperator8_Bold_8_glyph_95,
Font_PixelOperator8_Bold_8_glyph_96,
Font_PixelOperator8_Bold_8_glyph_97,
Font_PixelOperator8_Bold_8_glyph_98,
Font_PixelOperator8_Bold_8_glyph_99,
Font_PixelOperator8_Bold_8_glyph_100,
Font_PixelOperator8_Bold_8_glyph_101,
Font_PixelOperator8_Bold_8_glyph_102,
Font_PixelOperator8_Bold_8_glyph_103,
Font_PixelOperator8_Bold_8_glyph_104,
Font_PixelOperator8_Bold_8_glyph_105,
Font_PixelOperator8_Bold_8_glyph_106,
Font_PixelOperator8_Bold_8_glyph_107,
Font_PixelOperator8_Bold_8_glyph_108,
Font_PixelOperator8_Bold_8_glyph_109,
Font_PixelOperator8_Bold_8_glyph_110,
Font_PixelOperator8_Bold_8_glyph_111,
Font_PixelOperator8_Bold_8_glyph_112,
Font_PixelOperator8_Bold_8_glyph_113,
Font_PixelOperator8_Bold_8_glyph_114,
Font_PixelOperator8_Bold_8_glyph_115,
Font_PixelOperator8_Bold_8_glyph_116,
Font_PixelOperator8_Bold_8_glyph_117,
Font_PixelOperator8_Bold_8_glyph_118,
Font_PixelOperator8_Bold_8_glyph_119,
Font_PixelOperator8_Bold_8_glyph_120,
Font_PixelOperator8_Bold_8_glyph_121,
Font_PixelOperator8_Bold_8_glyph_122,
Font_PixelOperator8_Bold_8_glyph_123,
Font_PixelOperator8_Bold_8_glyph_124,
Font_PixelOperator8_Bold_8_glyph_125,
Font_PixelOperator8_Bold_8_glyph_126,
};

@ -0,0 +1,10 @@
#include <stdint.h>
#if TREZOR_FONT_BPP != 1
#error Wrong TREZOR_FONT_BPP (expected 1)
#endif
#define Font_PixelOperator8_Bold_8_HEIGHT 8
#define Font_PixelOperator8_Bold_8_MAX_HEIGHT 8
#define Font_PixelOperator8_Bold_8_BASELINE 1
extern const uint8_t* const Font_PixelOperator8_Bold_8[126 + 1 - 32];
extern const uint8_t Font_PixelOperator8_Bold_8_glyph_nonprintable[];

@ -0,0 +1,203 @@
#include <stdint.h>
// clang-format off
// - the first two bytes are width and height of the glyph
// - the third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
// - the rest is packed 1-bit glyph data
/* */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_32[] = { 0, 0, 8, 0, 0 };
/* ! */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_33[] = { 2, 7, 7, 2, 7, 255, 204 };
/* " */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_34[] = { 5, 3, 7, 0, 7, 222, 246 };
/* # */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_35[] = { 7, 6, 8, 0, 6, 109, 253, 179, 111, 237, 128 };
/* $ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_36[] = { 7, 7, 8, 0, 7, 16, 251, 67, 225, 127, 132, 0 };
/* % */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_37[] = { 7, 7, 8, 0, 7, 65, 74, 162, 162, 169, 65, 0 };
/* & */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_38[] = { 6, 7, 7, 0, 7, 123, 60, 30, 207, 55, 192 };
/* ' */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_39[] = { 2, 3, 7, 2, 7, 252 };
/* ( */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_40[] = { 4, 7, 7, 2, 7, 54, 204, 198, 48 };
/* ) */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_41[] = { 4, 7, 7, 0, 7, 198, 51, 54, 192 };
/* * */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_42[] = { 5, 7, 7, 0, 7, 37, 126, 239, 212, 128 };
/* + */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_43[] = { 6, 5, 7, 0, 6, 48, 207, 204, 48 };
/* , */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_44[] = { 3, 3, 7, 1, 2, 111, 0 };
/* - */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_45[] = { 4, 1, 7, 1, 4, 240 };
/* . */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_46[] = { 2, 1, 7, 2, 1, 192 };
/* / */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_47[] = { 4, 7, 7, 1, 7, 51, 102, 108, 192 };
/* 0 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_48[] = { 6, 7, 7, 0, 7, 123, 61, 255, 239, 55, 128 };
/* 1 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_49[] = { 6, 7, 7, 0, 7, 49, 207, 44, 48, 207, 192 };
/* 2 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_50[] = { 6, 7, 7, 0, 7, 123, 48, 198, 49, 143, 192 };
/* 3 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_51[] = { 6, 7, 7, 0, 7, 123, 48, 206, 15, 55, 128 };
/* 4 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_52[] = { 6, 7, 7, 0, 7, 28, 246, 243, 252, 48, 192 };
/* 5 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_53[] = { 6, 7, 7, 0, 7, 255, 15, 131, 15, 55, 128 };
/* 6 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_54[] = { 6, 7, 7, 0, 7, 123, 60, 62, 207, 55, 128 };
/* 7 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_55[] = { 6, 7, 7, 0, 7, 252, 49, 140, 99, 12, 0 };
/* 8 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_56[] = { 6, 7, 7, 0, 7, 123, 60, 222, 207, 55, 128 };
/* 9 */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_57[] = { 6, 7, 7, 0, 7, 123, 60, 223, 15, 55, 128 };
/* : */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_58[] = { 2, 5, 7, 2, 5, 192, 192 };
/* ; */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_59[] = { 3, 6, 7, 1, 5, 96, 55, 128 };
/* < */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_60[] = { 4, 5, 7, 1, 6, 54, 198, 48 };
/* = */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_61[] = { 4, 3, 7, 1, 5, 240, 240 };
/* > */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_62[] = { 4, 5, 7, 1, 6, 198, 54, 192 };
/* ? */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_63[] = { 6, 7, 7, 0, 7, 123, 48, 198, 48, 3, 0 };
/* @ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_64[] = { 7, 8, 8, 0, 7, 125, 6, 109, 90, 179, 160, 62, 0 };
/* A */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_65[] = { 6, 7, 7, 0, 7, 123, 60, 243, 255, 60, 192 };
/* B */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_66[] = { 6, 7, 7, 0, 7, 251, 60, 254, 207, 63, 128 };
/* C */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_67[] = { 6, 7, 7, 0, 7, 123, 60, 48, 195, 55, 128 };
/* D */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_68[] = { 6, 7, 7, 0, 7, 251, 60, 243, 207, 63, 128 };
/* E */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_69[] = { 6, 7, 7, 0, 7, 255, 12, 60, 195, 15, 192 };
/* F */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_70[] = { 6, 7, 7, 0, 7, 255, 12, 60, 195, 12, 0 };
/* G */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_71[] = { 6, 7, 7, 0, 7, 123, 60, 55, 207, 55, 192 };
/* H */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_72[] = { 6, 7, 7, 0, 7, 207, 60, 255, 207, 60, 192 };
/* I */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_73[] = { 6, 7, 7, 0, 7, 252, 195, 12, 48, 207, 192 };
/* J */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_74[] = { 7, 7, 7, 0, 7, 62, 24, 48, 96, 217, 158, 0 };
/* K */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_75[] = { 6, 7, 7, 0, 7, 207, 111, 56, 243, 108, 192 };
/* L */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_76[] = { 6, 7, 7, 0, 7, 195, 12, 48, 195, 15, 192 };
/* M */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_77[] = { 7, 7, 8, 0, 7, 199, 143, 191, 253, 120, 241, 128 };
/* N */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_78[] = { 6, 7, 7, 0, 7, 207, 62, 255, 223, 60, 192 };
/* O */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_79[] = { 6, 7, 7, 0, 7, 123, 60, 243, 207, 55, 128 };
/* P */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_80[] = { 6, 7, 7, 0, 7, 251, 60, 243, 251, 12, 0 };
/* Q */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_81[] = { 6, 7, 7, 0, 7, 123, 60, 251, 255, 102, 192 };
/* R */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_82[] = { 6, 7, 7, 0, 7, 251, 60, 243, 251, 108, 192 };
/* S */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_83[] = { 6, 7, 7, 0, 7, 123, 60, 30, 15, 55, 128 };
/* T */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_84[] = { 6, 7, 7, 0, 7, 252, 195, 12, 48, 195, 0 };
/* U */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_85[] = { 6, 7, 7, 0, 7, 207, 60, 243, 207, 55, 128 };
/* V */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_86[] = { 6, 7, 7, 0, 7, 207, 60, 243, 205, 227, 0 };
/* W */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_87[] = { 7, 7, 8, 0, 7, 199, 143, 94, 189, 122, 219, 0 };
/* X */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_88[] = { 6, 7, 7, 0, 7, 207, 55, 140, 123, 60, 192 };
/* Y */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_89[] = { 6, 7, 7, 0, 7, 207, 55, 140, 48, 195, 0 };
/* Z */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_90[] = { 6, 7, 7, 0, 7, 252, 49, 140, 99, 15, 192 };
/* [ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_91[] = { 4, 7, 7, 2, 7, 252, 204, 204, 240 };
/* \ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_92[] = { 4, 7, 7, 1, 7, 204, 102, 99, 48 };
/* ] */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_93[] = { 4, 7, 7, 0, 7, 243, 51, 51, 240 };
/* ^ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_94[] = { 6, 4, 7, 0, 7, 49, 236, 225, 0 };
/* _ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_95[] = { 8, 1, 8, 0, 0, 255, 0 };
/* ` */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_96[] = { 3, 2, 7, 1, 7, 204 };
/* a */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_97[] = { 6, 5, 7, 0, 5, 120, 55, 243, 124 };
/* b */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_98[] = { 6, 7, 7, 0, 7, 195, 15, 179, 207, 63, 128 };
/* c */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_99[] = { 6, 5, 7, 0, 5, 123, 60, 51, 120 };
/* d */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_100[] = { 6, 7, 7, 0, 7, 12, 55, 243, 207, 55, 192 };
/* e */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_101[] = { 6, 5, 7, 0, 5, 123, 63, 240, 120 };
/* f */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_102[] = { 5, 7, 7, 1, 7, 59, 62, 198, 49, 128 };
/* g */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_103[] = { 6, 6, 7, 0, 5, 127, 60, 223, 13, 224 };
/* h */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_104[] = { 6, 7, 7, 0, 7, 195, 15, 179, 207, 60, 192 };
/* i */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_105[] = { 6, 7, 7, 0, 7, 48, 15, 12, 48, 207, 192 };
/* j */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_106[] = { 6, 8, 7, 0, 7, 12, 3, 195, 12, 60, 222, 0 };
/* k */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_107[] = { 6, 7, 7, 0, 7, 195, 13, 188, 243, 108, 192 };
/* l */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_108[] = { 6, 7, 7, 0, 7, 240, 195, 12, 48, 207, 192 };
/* m */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_109[] = { 7, 5, 8, 0, 5, 237, 175, 94, 60, 96 };
/* n */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_110[] = { 6, 5, 7, 0, 5, 251, 60, 243, 204 };
/* o */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_111[] = { 6, 5, 7, 0, 5, 123, 60, 243, 120 };
/* p */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_112[] = { 6, 6, 7, 0, 5, 251, 60, 254, 195, 0 };
/* q */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_113[] = { 6, 6, 7, 0, 5, 127, 60, 223, 12, 48 };
/* r */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_114[] = { 6, 5, 7, 0, 5, 207, 126, 48, 192 };
/* s */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_115[] = { 6, 5, 7, 0, 5, 123, 7, 131, 248 };
/* t */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_116[] = { 5, 6, 7, 1, 6, 103, 216, 198, 28 };
/* u */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_117[] = { 6, 5, 7, 0, 5, 207, 60, 243, 120 };
/* v */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_118[] = { 6, 5, 7, 0, 5, 207, 60, 222, 48 };
/* w */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_119[] = { 7, 5, 8, 0, 5, 199, 143, 94, 182, 192 };
/* x */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_120[] = { 6, 5, 7, 0, 5, 205, 227, 30, 204 };
/* y */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_121[] = { 6, 6, 7, 0, 5, 207, 60, 223, 13, 224 };
/* z */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_122[] = { 6, 5, 7, 0, 5, 252, 99, 24, 252 };
/* { */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_123[] = { 5, 7, 7, 1, 7, 59, 25, 134, 48, 224 };
/* | */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_124[] = { 2, 7, 7, 2, 7, 255, 252 };
/* } */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_125[] = { 5, 7, 7, 0, 7, 225, 140, 51, 27, 128 };
/* ~ */ static const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_126[] = { 7, 2, 8, 0, 7, 119, 184 };
const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_nonprintable[] = { 6, 7, 7, 0, 7, 132, 207, 57, 207, 252, 255 };
const uint8_t * const Font_PixelOperatorMono8_Bold_8[126 + 1 - 32] = {
Font_PixelOperatorMono8_Bold_8_glyph_32,
Font_PixelOperatorMono8_Bold_8_glyph_33,
Font_PixelOperatorMono8_Bold_8_glyph_34,
Font_PixelOperatorMono8_Bold_8_glyph_35,
Font_PixelOperatorMono8_Bold_8_glyph_36,
Font_PixelOperatorMono8_Bold_8_glyph_37,
Font_PixelOperatorMono8_Bold_8_glyph_38,
Font_PixelOperatorMono8_Bold_8_glyph_39,
Font_PixelOperatorMono8_Bold_8_glyph_40,
Font_PixelOperatorMono8_Bold_8_glyph_41,
Font_PixelOperatorMono8_Bold_8_glyph_42,
Font_PixelOperatorMono8_Bold_8_glyph_43,
Font_PixelOperatorMono8_Bold_8_glyph_44,
Font_PixelOperatorMono8_Bold_8_glyph_45,
Font_PixelOperatorMono8_Bold_8_glyph_46,
Font_PixelOperatorMono8_Bold_8_glyph_47,
Font_PixelOperatorMono8_Bold_8_glyph_48,
Font_PixelOperatorMono8_Bold_8_glyph_49,
Font_PixelOperatorMono8_Bold_8_glyph_50,
Font_PixelOperatorMono8_Bold_8_glyph_51,
Font_PixelOperatorMono8_Bold_8_glyph_52,
Font_PixelOperatorMono8_Bold_8_glyph_53,
Font_PixelOperatorMono8_Bold_8_glyph_54,
Font_PixelOperatorMono8_Bold_8_glyph_55,
Font_PixelOperatorMono8_Bold_8_glyph_56,
Font_PixelOperatorMono8_Bold_8_glyph_57,
Font_PixelOperatorMono8_Bold_8_glyph_58,
Font_PixelOperatorMono8_Bold_8_glyph_59,
Font_PixelOperatorMono8_Bold_8_glyph_60,
Font_PixelOperatorMono8_Bold_8_glyph_61,
Font_PixelOperatorMono8_Bold_8_glyph_62,
Font_PixelOperatorMono8_Bold_8_glyph_63,
Font_PixelOperatorMono8_Bold_8_glyph_64,
Font_PixelOperatorMono8_Bold_8_glyph_65,
Font_PixelOperatorMono8_Bold_8_glyph_66,
Font_PixelOperatorMono8_Bold_8_glyph_67,
Font_PixelOperatorMono8_Bold_8_glyph_68,
Font_PixelOperatorMono8_Bold_8_glyph_69,
Font_PixelOperatorMono8_Bold_8_glyph_70,
Font_PixelOperatorMono8_Bold_8_glyph_71,
Font_PixelOperatorMono8_Bold_8_glyph_72,
Font_PixelOperatorMono8_Bold_8_glyph_73,
Font_PixelOperatorMono8_Bold_8_glyph_74,
Font_PixelOperatorMono8_Bold_8_glyph_75,
Font_PixelOperatorMono8_Bold_8_glyph_76,
Font_PixelOperatorMono8_Bold_8_glyph_77,
Font_PixelOperatorMono8_Bold_8_glyph_78,
Font_PixelOperatorMono8_Bold_8_glyph_79,
Font_PixelOperatorMono8_Bold_8_glyph_80,
Font_PixelOperatorMono8_Bold_8_glyph_81,
Font_PixelOperatorMono8_Bold_8_glyph_82,
Font_PixelOperatorMono8_Bold_8_glyph_83,
Font_PixelOperatorMono8_Bold_8_glyph_84,
Font_PixelOperatorMono8_Bold_8_glyph_85,
Font_PixelOperatorMono8_Bold_8_glyph_86,
Font_PixelOperatorMono8_Bold_8_glyph_87,
Font_PixelOperatorMono8_Bold_8_glyph_88,
Font_PixelOperatorMono8_Bold_8_glyph_89,
Font_PixelOperatorMono8_Bold_8_glyph_90,
Font_PixelOperatorMono8_Bold_8_glyph_91,
Font_PixelOperatorMono8_Bold_8_glyph_92,
Font_PixelOperatorMono8_Bold_8_glyph_93,
Font_PixelOperatorMono8_Bold_8_glyph_94,
Font_PixelOperatorMono8_Bold_8_glyph_95,
Font_PixelOperatorMono8_Bold_8_glyph_96,
Font_PixelOperatorMono8_Bold_8_glyph_97,
Font_PixelOperatorMono8_Bold_8_glyph_98,
Font_PixelOperatorMono8_Bold_8_glyph_99,
Font_PixelOperatorMono8_Bold_8_glyph_100,
Font_PixelOperatorMono8_Bold_8_glyph_101,
Font_PixelOperatorMono8_Bold_8_glyph_102,
Font_PixelOperatorMono8_Bold_8_glyph_103,
Font_PixelOperatorMono8_Bold_8_glyph_104,
Font_PixelOperatorMono8_Bold_8_glyph_105,
Font_PixelOperatorMono8_Bold_8_glyph_106,
Font_PixelOperatorMono8_Bold_8_glyph_107,
Font_PixelOperatorMono8_Bold_8_glyph_108,
Font_PixelOperatorMono8_Bold_8_glyph_109,
Font_PixelOperatorMono8_Bold_8_glyph_110,
Font_PixelOperatorMono8_Bold_8_glyph_111,
Font_PixelOperatorMono8_Bold_8_glyph_112,
Font_PixelOperatorMono8_Bold_8_glyph_113,
Font_PixelOperatorMono8_Bold_8_glyph_114,
Font_PixelOperatorMono8_Bold_8_glyph_115,
Font_PixelOperatorMono8_Bold_8_glyph_116,
Font_PixelOperatorMono8_Bold_8_glyph_117,
Font_PixelOperatorMono8_Bold_8_glyph_118,
Font_PixelOperatorMono8_Bold_8_glyph_119,
Font_PixelOperatorMono8_Bold_8_glyph_120,
Font_PixelOperatorMono8_Bold_8_glyph_121,
Font_PixelOperatorMono8_Bold_8_glyph_122,
Font_PixelOperatorMono8_Bold_8_glyph_123,
Font_PixelOperatorMono8_Bold_8_glyph_124,
Font_PixelOperatorMono8_Bold_8_glyph_125,
Font_PixelOperatorMono8_Bold_8_glyph_126,
};

@ -0,0 +1,10 @@
#include <stdint.h>
#if TREZOR_FONT_BPP != 1
#error Wrong TREZOR_FONT_BPP (expected 1)
#endif
#define Font_PixelOperatorMono8_Bold_8_HEIGHT 8
#define Font_PixelOperatorMono8_Bold_8_MAX_HEIGHT 8
#define Font_PixelOperatorMono8_Bold_8_BASELINE 1
extern const uint8_t* const Font_PixelOperatorMono8_Bold_8[126 + 1 - 32];
extern const uint8_t Font_PixelOperatorMono8_Bold_8_glyph_nonprintable[];

@ -0,0 +1,203 @@
#include <stdint.h>
// clang-format off
// - the first two bytes are width and height of the glyph
// - the third, fourth and fifth bytes are advance, bearingX and bearingY of the horizontal metrics of the glyph
// - the rest is packed 1-bit glyph data
/* */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_32[] = { 0, 0, 4, 0, 0 };
/* ! */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_33[] = { 1, 5, 3, 0, 5, 248 };
/* " */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_34[] = { 3, 2, 3, 0, 5, 180 };
/* # */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_35[] = { 5, 5, 4, 0, 5, 83, 148, 229, 0 };
/* $ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_36[] = { 4, 8, 4, 0, 7, 4, 252, 125, 244, 0 };
/* % */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_37[] = { 4, 5, 4, 0, 5, 206, 67, 0 };
/* & */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_38[] = { 3, 5, 3, 0, 5, 243, 94 };
/* ' */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_39[] = { 1, 2, 3, 0, 5, 192 };
/* ( */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_40[] = { 2, 5, 3, 0, 5, 234, 64 };
/* ) */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_41[] = { 2, 5, 4, 0, 5, 213, 128 };
/* * */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_42[] = { 3, 4, 3, 0, 5, 91, 32 };
/* + */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_43[] = { 3, 3, 4, 0, 4, 93, 0 };
/* , */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_44[] = { 2, 2, 4, 0, 1, 80 };
/* - */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_45[] = { 2, 1, 3, 0, 3, 192 };
/* . */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_46[] = { 2, 1, 3, 0, 1, 0 };
/* / */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_47[] = { 2, 5, 3, 0, 5, 86, 128 };
/* 0 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_48[] = { 3, 5, 3, 0, 5, 247, 222 };
/* 1 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_49[] = { 2, 5, 4, 0, 5, 117, 64 };
/* 2 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_50[] = { 3, 5, 3, 0, 5, 229, 78 };
/* 3 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_51[] = { 3, 5, 4, 0, 5, 229, 158 };
/* 4 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_52[] = { 3, 5, 3, 0, 5, 63, 146 };
/* 5 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_53[] = { 3, 5, 3, 0, 5, 248, 158 };
/* 6 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_54[] = { 3, 5, 3, 0, 5, 243, 94 };
/* 7 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_55[] = { 3, 5, 3, 0, 5, 229, 72 };
/* 8 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_56[] = { 3, 5, 3, 0, 5, 247, 222 };
/* 9 */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_57[] = { 3, 5, 3, 0, 5, 245, 158 };
/* : */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_58[] = { 2, 4, 3, 0, 4, 0, 0 };
/* ; */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_59[] = { 2, 5, 4, 0, 4, 65, 64 };
/* < */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_60[] = { 3, 3, 3, 0, 4, 72, 0 };
/* = */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_61[] = { 2, 2, 3, 0, 4, 240 };
/* > */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_62[] = { 3, 3, 4, 0, 4, 72, 0 };
/* ? */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_63[] = { 3, 5, 4, 0, 5, 229, 36 };
/* @ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_64[] = { 4, 5, 4, 0, 5, 255, 250, 96 };
/* A */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_65[] = { 3, 5, 3, 0, 5, 247, 218 };
/* B */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_66[] = { 3, 5, 3, 0, 5, 247, 222 };
/* C */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_67[] = { 3, 5, 3, 0, 5, 242, 78 };
/* D */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_68[] = { 3, 5, 3, 0, 5, 246, 222 };
/* E */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_69[] = { 3, 5, 3, 0, 5, 243, 78 };
/* F */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_70[] = { 3, 5, 3, 0, 5, 243, 72 };
/* G */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_71[] = { 3, 5, 3, 0, 5, 242, 222 };
/* H */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_72[] = { 3, 5, 3, 0, 5, 183, 218 };
/* I */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_73[] = { 1, 5, 3, 0, 5, 248 };
/* J */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_74[] = { 3, 5, 4, 0, 5, 36, 158 };
/* K */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_75[] = { 3, 5, 3, 0, 5, 187, 74 };
/* L */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_76[] = { 3, 5, 3, 0, 5, 146, 78 };
/* M */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_77[] = { 4, 5, 4, 0, 5, 159, 153, 144 };
/* N */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_78[] = { 3, 5, 3, 0, 5, 183, 218 };
/* O */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_79[] = { 3, 5, 3, 0, 5, 246, 222 };
/* P */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_80[] = { 3, 5, 3, 0, 5, 247, 72 };
/* Q */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_81[] = { 3, 5, 3, 0, 5, 246, 250 };
/* R */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_82[] = { 3, 5, 3, 0, 5, 247, 74 };
/* S */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_83[] = { 3, 5, 3, 0, 5, 241, 30 };
/* T */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_84[] = { 3, 5, 4, 0, 5, 233, 36 };
/* U */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_85[] = { 3, 5, 3, 0, 5, 182, 222 };
/* V */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_86[] = { 3, 5, 3, 0, 5, 182, 212 };
/* W */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_87[] = { 4, 5, 4, 0, 5, 157, 221, 240 };
/* X */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_88[] = { 3, 5, 3, 0, 5, 189, 90 };
/* Y */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_89[] = { 3, 5, 3, 0, 5, 181, 36 };
/* Z */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_90[] = { 3, 5, 3, 0, 5, 229, 78 };
/* [ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_91[] = { 2, 5, 3, 0, 5, 234, 192 };
/* \ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_92[] = { 2, 5, 3, 0, 5, 165, 64 };
/* ] */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_93[] = { 2, 5, 4, 0, 5, 213, 192 };
/* ^ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_94[] = { 4, 2, 4, 0, 5, 96, 0 };
/* _ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_95[] = { 4, 1, 4, 0, 0, 96 };
/* ` */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_96[] = { 2, 2, 3, 0, 6, 128 };
/* a */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_97[] = { 3, 4, 3, 0, 4, 238, 240 };
/* b */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_98[] = { 3, 5, 3, 0, 5, 158, 222 };
/* c */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_99[] = { 3, 4, 3, 0, 4, 242, 112 };
/* d */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_100[] = { 3, 5, 3, 0, 5, 62, 222 };
/* e */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_101[] = { 3, 4, 3, 0, 4, 254, 112 };
/* f */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_102[] = { 4, 5, 4, 0, 5, 102, 68, 64 };
/* g */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_103[] = { 3, 5, 3, 0, 4, 247, 158 };
/* h */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_104[] = { 3, 5, 3, 0, 5, 158, 218 };
/* i */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_105[] = { 1, 5, 3, 0, 5, 248 };
/* j */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_106[] = { 3, 6, 4, 0, 5, 36, 147, 192 };
/* k */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_107[] = { 3, 5, 3, 0, 5, 151, 106 };
/* l */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_108[] = { 1, 5, 3, 0, 5, 248 };
/* m */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_109[] = { 4, 4, 4, 0, 4, 189, 217, 0 };
/* n */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_110[] = { 3, 4, 3, 0, 4, 246, 208 };
/* o */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_111[] = { 3, 4, 3, 0, 4, 246, 240 };
/* p */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_112[] = { 3, 5, 3, 0, 4, 246, 248 };
/* q */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_113[] = { 3, 5, 3, 0, 4, 246, 242 };
/* r */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_114[] = { 3, 4, 3, 0, 4, 178, 64 };
/* s */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_115[] = { 3, 4, 3, 0, 4, 252, 240 };
/* t */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_116[] = { 4, 5, 4, 0, 5, 70, 68, 96 };
/* u */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_117[] = { 3, 4, 3, 0, 4, 182, 240 };
/* v */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_118[] = { 3, 4, 3, 0, 4, 182, 160 };
/* w */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_119[] = { 4, 4, 4, 0, 4, 157, 219, 0 };
/* x */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_120[] = { 3, 4, 3, 0, 4, 169, 80 };
/* y */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_121[] = { 3, 5, 3, 0, 4, 183, 158 };
/* z */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_122[] = { 3, 4, 3, 0, 4, 224, 112 };
/* { */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_123[] = { 3, 5, 4, 0, 5, 105, 38 };
/* | */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_124[] = { 1, 5, 3, 0, 5, 248 };
/* } */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_125[] = { 3, 5, 4, 0, 5, 201, 44 };
/* ~ */ static const uint8_t Font_PixelOperatorMono_Bold_8_glyph_126[] = { 4, 2, 4, 0, 6, 74, 0 };
const uint8_t Font_PixelOperatorMono_Bold_8_glyph_nonprintable[] = { 3, 5, 4, 0, 5, 26, 219 };
const uint8_t * const Font_PixelOperatorMono_Bold_8[126 + 1 - 32] = {
Font_PixelOperatorMono_Bold_8_glyph_32,
Font_PixelOperatorMono_Bold_8_glyph_33,
Font_PixelOperatorMono_Bold_8_glyph_34,
Font_PixelOperatorMono_Bold_8_glyph_35,
Font_PixelOperatorMono_Bold_8_glyph_36,
Font_PixelOperatorMono_Bold_8_glyph_37,
Font_PixelOperatorMono_Bold_8_glyph_38,
Font_PixelOperatorMono_Bold_8_glyph_39,
Font_PixelOperatorMono_Bold_8_glyph_40,
Font_PixelOperatorMono_Bold_8_glyph_41,
Font_PixelOperatorMono_Bold_8_glyph_42,
Font_PixelOperatorMono_Bold_8_glyph_43,
Font_PixelOperatorMono_Bold_8_glyph_44,
Font_PixelOperatorMono_Bold_8_glyph_45,
Font_PixelOperatorMono_Bold_8_glyph_46,
Font_PixelOperatorMono_Bold_8_glyph_47,
Font_PixelOperatorMono_Bold_8_glyph_48,
Font_PixelOperatorMono_Bold_8_glyph_49,
Font_PixelOperatorMono_Bold_8_glyph_50,
Font_PixelOperatorMono_Bold_8_glyph_51,
Font_PixelOperatorMono_Bold_8_glyph_52,
Font_PixelOperatorMono_Bold_8_glyph_53,
Font_PixelOperatorMono_Bold_8_glyph_54,
Font_PixelOperatorMono_Bold_8_glyph_55,
Font_PixelOperatorMono_Bold_8_glyph_56,
Font_PixelOperatorMono_Bold_8_glyph_57,
Font_PixelOperatorMono_Bold_8_glyph_58,
Font_PixelOperatorMono_Bold_8_glyph_59,
Font_PixelOperatorMono_Bold_8_glyph_60,
Font_PixelOperatorMono_Bold_8_glyph_61,
Font_PixelOperatorMono_Bold_8_glyph_62,
Font_PixelOperatorMono_Bold_8_glyph_63,
Font_PixelOperatorMono_Bold_8_glyph_64,
Font_PixelOperatorMono_Bold_8_glyph_65,
Font_PixelOperatorMono_Bold_8_glyph_66,
Font_PixelOperatorMono_Bold_8_glyph_67,
Font_PixelOperatorMono_Bold_8_glyph_68,
Font_PixelOperatorMono_Bold_8_glyph_69,
Font_PixelOperatorMono_Bold_8_glyph_70,
Font_PixelOperatorMono_Bold_8_glyph_71,
Font_PixelOperatorMono_Bold_8_glyph_72,
Font_PixelOperatorMono_Bold_8_glyph_73,
Font_PixelOperatorMono_Bold_8_glyph_74,
Font_PixelOperatorMono_Bold_8_glyph_75,
Font_PixelOperatorMono_Bold_8_glyph_76,
Font_PixelOperatorMono_Bold_8_glyph_77,
Font_PixelOperatorMono_Bold_8_glyph_78,
Font_PixelOperatorMono_Bold_8_glyph_79,
Font_PixelOperatorMono_Bold_8_glyph_80,
Font_PixelOperatorMono_Bold_8_glyph_81,
Font_PixelOperatorMono_Bold_8_glyph_82,
Font_PixelOperatorMono_Bold_8_glyph_83,
Font_PixelOperatorMono_Bold_8_glyph_84,
Font_PixelOperatorMono_Bold_8_glyph_85,
Font_PixelOperatorMono_Bold_8_glyph_86,
Font_PixelOperatorMono_Bold_8_glyph_87,
Font_PixelOperatorMono_Bold_8_glyph_88,
Font_PixelOperatorMono_Bold_8_glyph_89,
Font_PixelOperatorMono_Bold_8_glyph_90,
Font_PixelOperatorMono_Bold_8_glyph_91,
Font_PixelOperatorMono_Bold_8_glyph_92,
Font_PixelOperatorMono_Bold_8_glyph_93,
Font_PixelOperatorMono_Bold_8_glyph_94,
Font_PixelOperatorMono_Bold_8_glyph_95,
Font_PixelOperatorMono_Bold_8_glyph_96,
Font_PixelOperatorMono_Bold_8_glyph_97,
Font_PixelOperatorMono_Bold_8_glyph_98,
Font_PixelOperatorMono_Bold_8_glyph_99,
Font_PixelOperatorMono_Bold_8_glyph_100,
Font_PixelOperatorMono_Bold_8_glyph_101,
Font_PixelOperatorMono_Bold_8_glyph_102,
Font_PixelOperatorMono_Bold_8_glyph_103,
Font_PixelOperatorMono_Bold_8_glyph_104,
Font_PixelOperatorMono_Bold_8_glyph_105,
Font_PixelOperatorMono_Bold_8_glyph_106,
Font_PixelOperatorMono_Bold_8_glyph_107,
Font_PixelOperatorMono_Bold_8_glyph_108,
Font_PixelOperatorMono_Bold_8_glyph_109,
Font_PixelOperatorMono_Bold_8_glyph_110,
Font_PixelOperatorMono_Bold_8_glyph_111,
Font_PixelOperatorMono_Bold_8_glyph_112,
Font_PixelOperatorMono_Bold_8_glyph_113,
Font_PixelOperatorMono_Bold_8_glyph_114,
Font_PixelOperatorMono_Bold_8_glyph_115,
Font_PixelOperatorMono_Bold_8_glyph_116,
Font_PixelOperatorMono_Bold_8_glyph_117,
Font_PixelOperatorMono_Bold_8_glyph_118,
Font_PixelOperatorMono_Bold_8_glyph_119,
Font_PixelOperatorMono_Bold_8_glyph_120,
Font_PixelOperatorMono_Bold_8_glyph_121,
Font_PixelOperatorMono_Bold_8_glyph_122,
Font_PixelOperatorMono_Bold_8_glyph_123,
Font_PixelOperatorMono_Bold_8_glyph_124,
Font_PixelOperatorMono_Bold_8_glyph_125,
Font_PixelOperatorMono_Bold_8_glyph_126,
};

@ -0,0 +1,10 @@
#include <stdint.h>
#if TREZOR_FONT_BPP != 1
#error Wrong TREZOR_FONT_BPP (expected 1)
#endif
#define Font_PixelOperatorMono_Bold_8_HEIGHT 8
#define Font_PixelOperatorMono_Bold_8_MAX_HEIGHT 8
#define Font_PixelOperatorMono_Bold_8_BASELINE 1
extern const uint8_t* const Font_PixelOperatorMono_Bold_8[126 + 1 - 32];
extern const uint8_t Font_PixelOperatorMono_Bold_8_glyph_nonprintable[];

@ -26,6 +26,14 @@ mod trace;
#[cfg(feature = "ui")]
#[macro_use]
pub mod ui;
#[cfg(not(feature = "micropython"))]
pub mod strbuffer;
#[cfg(not(feature = "micropython"))]
pub use strbuffer::StrBuffer;
#[cfg(feature = "micropython")]
pub use micropython::buffer::StrBuffer;
#[cfg(feature = "debug")]
#[panic_handler]

@ -0,0 +1,93 @@
use core::{convert::TryFrom, ops::Deref, ptr, slice, str};
use crate::ui::component::text::paragraphs::ParagraphStrType;
/// Represents an immutable UTF-8 string managed by MicroPython GC.
/// This either means static data, or a valid GC object.
///
/// # Safety
///
/// We assume that MicroPython is handling strings according to Python
/// semantics, i.e., that string data is immutable.
/// Furthermore, we assume that string data is always either static or a GC head
/// pointer, i.e., we can never obtain a pointer into the middle of a GC string.
///
/// Given the above assumptions about MicroPython strings, working with
/// StrBuffers in Rust is safe.
///
/// The `off` field represents offset from the `ptr` and allows us to do
/// substring slices while keeping the head pointer as required by GC.
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct StrBuffer {
ptr: *const u8,
len: u16,
off: u16,
}
impl StrBuffer {
pub fn empty() -> Self {
Self::from("")
}
fn as_bytes(&self) -> &[u8] {
if self.ptr.is_null() {
&[]
} else {
unsafe { slice::from_raw_parts(self.ptr.add(self.off.into()), self.len.into()) }
}
}
pub fn offset(&self, skip_bytes: usize) -> Self {
let off: u16 = unwrap!(skip_bytes.try_into());
assert!(off <= self.len);
assert!(self.as_ref().is_char_boundary(skip_bytes));
Self {
ptr: self.ptr,
// Does not overflow because `off <= self.len`.
len: self.len - off,
// `self.off + off` could only overflow if `self.off + self.len` could overflow, and
// given that `off` only advances by as much as `len` decreases, that should not be
// possible either.
off: self.off + off,
}
}
}
impl Default for StrBuffer {
fn default() -> Self {
Self::empty()
}
}
impl Deref for StrBuffer {
type Target = str;
fn deref(&self) -> &Self::Target {
self.as_ref()
}
}
impl AsRef<str> for StrBuffer {
fn as_ref(&self) -> &str {
// SAFETY:
// - If constructed from a Rust `&str`, this is safe.
unsafe { str::from_utf8_unchecked(self.as_bytes()) }
}
}
impl From<&'static str> for StrBuffer {
fn from(val: &'static str) -> Self {
Self {
ptr: val.as_ptr(),
len: unwrap!(val.len().try_into()),
off: 0,
}
}
}
impl ParagraphStrType for StrBuffer {
fn skip_prefix(&self, chars: usize) -> Self {
self.offset(chars)
}
}

@ -19,6 +19,12 @@ pub struct ToifInfo {
pub format: ToifFormat,
}
pub fn refresh() {
unsafe {
ffi::display_refresh();
}
}
pub fn backlight(val: i32) -> i32 {
unsafe { ffi::display_backlight(val) }
}

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
time::{Duration, Instant},
ui::{
animation::Animation,
@ -9,6 +8,7 @@ use crate::{
geometry::Rect,
util::animation_disabled,
},
StrBuffer,
};
enum State {

@ -6,7 +6,6 @@ pub mod empty;
pub mod image;
pub mod label;
pub mod map;
#[cfg(feature = "micropython")]
pub mod marquee;
pub mod maybe;
pub mod pad;
@ -22,7 +21,6 @@ pub use empty::Empty;
pub use image::Image;
pub use label::Label;
pub use map::Map;
#[cfg(feature = "micropython")]
pub use marquee::Marquee;
pub use maybe::Maybe;
pub use pad::Pad;

@ -1,6 +1,5 @@
use crate::ui::lerp::Lerp;
#[macro_export]
macro_rules! alpha {
($n: expr) => {
@ -12,7 +11,6 @@ macro_rules! alpha {
};
}
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct Color(u16);

@ -40,6 +40,10 @@ pub use icon::{Icon, IconAndName};
#[cfg(any(feature = "model_tt", feature = "model_tr"))]
pub use loader::{loader, loader_indeterminate, LOADER_MAX, LOADER_MIN};
pub fn refresh() {
display::refresh();
}
pub fn backlight() -> u16 {
display::backlight(-1) as u16
}
@ -147,9 +151,26 @@ pub fn icon_rect(r: Rect, toif_data: &[u8], fg_color: Color, bg_color: Color) {
);
}
pub fn icon_rust_top_left(top_left: Point, data: &[u8], fg_color: Color, bg_color: Color) {
let (toif_size, _) = toif_info_ensure(data, ToifFormat::GrayScaleEH);
let r = Rect::from_top_left_and_size(top_left, toif_size);
icon_rust_rect(r, data, fg_color, bg_color);
}
pub fn icon_rust_top_right(top_left: Point, data: &[u8], fg_color: Color, bg_color: Color) {
let (toif_size, _) = toif_info_ensure(data, ToifFormat::GrayScaleEH);
let r = Rect::from_top_right_and_size(top_left, toif_size);
icon_rust_rect(r, data, fg_color, bg_color);
}
pub fn icon_rust(center: Point, data: &[u8], fg_color: Color, bg_color: Color) {
let (toif_size, toif_data) = toif_info_ensure(data, ToifFormat::GrayScaleEH);
let (toif_size, _) = toif_info_ensure(data, ToifFormat::GrayScaleEH);
let r = Rect::from_center_and_size(center, toif_size);
icon_rust_rect(r, data, fg_color, bg_color);
}
pub fn icon_rust_rect(r: Rect, data: &[u8], fg_color: Color, bg_color: Color) {
let (_, toif_data) = toif_info_ensure(data, ToifFormat::GrayScaleEH);
let area = r.translate(get_offset());
let clamped = area.clamp(constant::screen());
@ -301,7 +322,12 @@ impl<T: AsRef<str>> TextOverlay<T> {
let p_rel = Point::new(p.x - self.area.x0, p.y - self.area.y0);
for g in self.text.as_ref().bytes().filter_map(|c| self.font.get_glyph(c)) {
for g in self
.text
.as_ref()
.bytes()
.filter_map(|c| self.font.get_glyph(c))
{
let top = self.max_height - self.baseline - g.bearing_y;
let char_area = Rect::new(
Point::new(tot_adv + g.bearing_x, top),

@ -5,12 +5,12 @@ use crate::ui::{
},
constant::screen,
display,
display::Color,
display::{Color, Font},
geometry::{Point, Rect},
model_tr::{
component::{Button, ButtonMsg::Clicked},
bootloader::theme::WHITE,
component::{ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos},
constant::{HEIGHT, WIDTH},
theme::WHITE,
},
};
@ -28,32 +28,32 @@ impl ReturnToC for ConfirmMsg {
}
}
pub struct Confirm {
pub struct Confirm<'a> {
bg: Pad,
bg_color: Color,
icon: Option<&'static [u8]>,
message: Child<Paragraphs<ParagraphVecShort<&'static str>>>,
left: Child<Button<&'static str>>,
right: Child<Button<&'static str>>,
label: &'static str,
message: Child<Paragraphs<ParagraphVecShort<&'a str>>>,
buttons: ButtonController,
confirm_left: bool,
}
impl Confirm {
impl<'a> Confirm<'a> {
pub fn new(
bg_color: Color,
icon: Option<&'static [u8]>,
message: Paragraphs<ParagraphVecShort<&'static str>>,
left: Button<&'static str>,
right: Button<&'static str>,
label: &'static str,
message: Paragraphs<ParagraphVecShort<&'a str>>,
text: &'static str,
confirm_left: bool,
) -> Self {
let mut instance = Self {
bg: Pad::with_background(bg_color),
bg_color,
icon,
label,
message: Child::new(message),
left: Child::new(left),
right: Child::new(right),
buttons: ButtonController::new(ButtonLayout::cancel_none_text(text.into())),
confirm_left,
};
instance.bg.clear();
@ -61,43 +61,49 @@ impl Confirm {
}
}
impl Component for Confirm {
impl<'a> Component for Confirm<'a> {
type Msg = ConfirmMsg;
fn place(&mut self, bounds: Rect) -> Rect {
self.bg
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.message
.place(Rect::new(Point::new(10, 0), Point::new(118, 50)));
.place(Rect::new(Point::new(0, 9), Point::new(128, 54)));
let button_area = bounds.split_bottom(12).1;
self.left.place(button_area);
self.right.place(button_area);
self.buttons.place(button_area);
bounds
}
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
if let Some(Clicked) = self.left.event(ctx, event) {
return if self.confirm_left {
Some(Self::Msg::Confirm)
} else {
Some(Self::Msg::Cancel)
};
};
if let Some(Clicked) = self.right.event(ctx, event) {
return if self.confirm_left {
Some(Self::Msg::Cancel)
} else {
Some(Self::Msg::Confirm)
};
};
None
match self.buttons.event(ctx, event) {
Some(ButtonControllerMsg::Triggered(ButtonPos::Left)) => Some(ConfirmMsg::Cancel),
Some(ButtonControllerMsg::Triggered(ButtonPos::Right)) => Some(ConfirmMsg::Confirm),
_ => None,
}
// if let Some(Clicked) = self.left.event(ctx, event) {
// return if self.confirm_left {
// Some(Self::Msg::Confirm)
// } else {
// Some(Self::Msg::Cancel)
// };
// };
// if let Some(Clicked) = self.right.event(ctx, event) {
// return if self.confirm_left {
// Some(Self::Msg::Cancel)
// } else {
// Some(Self::Msg::Confirm)
// };
// };
//None
}
fn paint(&mut self) {
self.bg.paint();
display::text_top_left(Point::zero(), self.label, Font::BOLD, WHITE, self.bg_color);
if let Some(icon) = self.icon {
display::icon(
Point::new(screen().center().x, 45),
@ -108,12 +114,10 @@ impl Component for Confirm {
}
self.message.paint();
self.left.paint();
self.right.paint();
self.buttons.paint();
}
fn bounds(&self, sink: &mut dyn FnMut(Rect)) {
self.left.bounds(sink);
self.right.bounds(sink);
self.buttons.bounds(sink);
}
}

@ -0,0 +1,152 @@
use crate::ui::{
component::{
text::paragraphs::{ParagraphVecShort, Paragraphs},
Child, Component, ComponentExt, Event, EventCtx, Pad,
},
display,
display::{Color, Font},
geometry::{Point, Rect},
model_tr::{
bootloader::theme::WHITE,
component::{ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos},
constant::{HEIGHT, WIDTH},
},
};
use super::ReturnToC;
#[derive(Copy, Clone)]
pub enum ConfirmSeedMsg {
Cancel = 1,
Confirm = 2,
}
impl ReturnToC for ConfirmSeedMsg {
fn return_to_c(self) -> u32 {
self as u32
}
}
pub struct ConfirmSeed<'a> {
bg: Pad,
bg_color: Color,
label: &'static str,
message: Child<Paragraphs<ParagraphVecShort<&'a str>>>,
message2: Child<Paragraphs<ParagraphVecShort<&'a str>>>,
buttons: ButtonController,
buttons2: ButtonController,
confirm_left: bool,
page: i16,
}
impl<'a> ConfirmSeed<'a> {
pub fn new(
bg_color: Color,
label: &'static str,
message: Paragraphs<ParagraphVecShort<&'a str>>,
message2: Paragraphs<ParagraphVecShort<&'a str>>,
text: &'static str,
confirm_left: bool,
) -> Self {
let mut instance = Self {
bg: Pad::with_background(bg_color),
bg_color,
label,
message: Child::new(message),
message2: Child::new(message2),
buttons: ButtonController::new(ButtonLayout::cancel_none_arrow()),
buttons2: ButtonController::new(ButtonLayout::up_and_text(text.into())),
confirm_left,
page: 0,
};
instance.bg.clear();
instance
}
}
impl<'a> Component for ConfirmSeed<'a> {
type Msg = ConfirmSeedMsg;
fn place(&mut self, bounds: Rect) -> Rect {
self.bg
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.message
.place(Rect::new(Point::new(0, 9), Point::new(128, 54)));
self.message2
.place(Rect::new(Point::new(0, 9), Point::new(128, 54)));
let button_area = bounds.split_bottom(12).1;
self.buttons.place(button_area);
self.buttons2.place(button_area);
bounds
}
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
if self.page == 0 {
match self.buttons.event(ctx, event) {
Some(ButtonControllerMsg::Triggered(ButtonPos::Left)) => {
Some(ConfirmSeedMsg::Cancel)
}
Some(ButtonControllerMsg::Triggered(ButtonPos::Right)) => {
self.page = 1;
ctx.request_paint();
self.message2.request_complete_repaint(ctx);
self.buttons2.request_complete_repaint(ctx);
self.bg.clear();
None
}
_ => None,
}
} else {
match self.buttons2.event(ctx, event) {
Some(ButtonControllerMsg::Triggered(ButtonPos::Left)) => {
self.page = 0;
ctx.request_paint();
self.message.request_complete_repaint(ctx);
self.buttons.request_complete_repaint(ctx);
self.bg.clear();
None
}
Some(ButtonControllerMsg::Triggered(ButtonPos::Right)) => {
Some(ConfirmSeedMsg::Confirm)
}
_ => None,
}
}
// if let Some(Clicked) = self.left.event(ctx, event) {
// return if self.confirm_left {
// Some(Self::Msg::Confirm)
// } else {
// Some(Self::Msg::Cancel)
// };
// };
// if let Some(Clicked) = self.right.event(ctx, event) {
// return if self.confirm_left {
// Some(Self::Msg::Cancel)
// } else {
// Some(Self::Msg::Confirm)
// };
// };
//None
}
fn paint(&mut self) {
self.bg.paint();
display::text_top_left(Point::zero(), self.label, Font::BOLD, WHITE, self.bg_color);
if self.page == 0 {
self.message.paint();
self.buttons.paint();
} else {
self.message2.paint();
self.buttons2.paint();
}
}
fn bounds(&self, sink: &mut dyn FnMut(Rect)) {
self.buttons.bounds(sink);
}
}

@ -4,19 +4,15 @@ use crate::ui::{
Child, Component, Event, EventCtx, Pad,
},
geometry::{LinearPlacement, Point, Rect},
model_tr::{
bootloader::{
theme::{BLD_BG, TEXT_NORMAL},
title::Title,
ReturnToC,
},
component::ButtonMsg::Clicked,
model_tr::bootloader::{
theme::{BLD_BG, TEXT_NORMAL},
title::Title,
ReturnToC,
},
};
use crate::ui::model_tr::{
bootloader::theme::bld_button_default,
component::{Button, ButtonPos},
component::{ButtonController, ButtonControllerMsg, ButtonLayout, ButtonPos},
constant::{HEIGHT, WIDTH},
};
@ -35,8 +31,7 @@ impl ReturnToC for IntroMsg {
pub struct Intro {
bg: Pad,
title: Child<Title>,
host: Child<Button<&'static str>>,
menu: Child<Button<&'static str>>,
buttons: ButtonController,
text: Child<Paragraphs<ParagraphVecShort<&'static str>>>,
}
@ -53,15 +48,9 @@ impl Intro {
let mut instance = Self {
bg: Pad::with_background(BLD_BG),
title: Child::new(Title::new(bld_version)),
host: Child::new(Button::with_text(
ButtonPos::Left,
"INSTALL FIRMWARE",
bld_button_default(),
)),
menu: Child::new(Button::with_text(
ButtonPos::Right,
"MENU",
bld_button_default(),
buttons: ButtonController::new(ButtonLayout::text_none_text(
"INSTALL FW".into(),
"MENU".into(),
)),
text: Child::new(p1),
};
@ -78,24 +67,28 @@ impl Component for Intro {
self.bg
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.title
.place(Rect::new(Point::new(10, 0), Point::new(128, 8)));
.place(Rect::new(Point::new(0, 0), Point::new(128, 8)));
let button_area = bounds.split_bottom(12).1;
self.host.place(button_area);
self.menu.place(button_area);
self.buttons.place(button_area);
self.text
.place(Rect::new(Point::new(10, 20), Point::new(118, 50)));
.place(Rect::new(Point::new(0, 25), Point::new(128, 50)));
bounds
}
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
if let Some(Clicked) = self.menu.event(ctx, event) {
return Some(Self::Msg::Menu);
};
if let Some(Clicked) = self.host.event(ctx, event) {
return Some(Self::Msg::Host);
};
let event = self.buttons.event(ctx, event);
match event {
Some(ButtonControllerMsg::Triggered(ButtonPos::Left)) => {
return Some(Self::Msg::Host);
}
Some(ButtonControllerMsg::Triggered(ButtonPos::Right)) => {
return Some(Self::Msg::Menu);
}
_ => {}
}
None
}
@ -103,14 +96,12 @@ impl Component for Intro {
self.bg.paint();
self.title.paint();
self.text.paint();
self.host.paint();
self.menu.paint();
self.buttons.paint();
}
fn bounds(&self, sink: &mut dyn FnMut(Rect)) {
self.title.bounds(sink);
self.text.bounds(sink);
self.host.bounds(sink);
self.menu.bounds(sink);
self.buttons.bounds(sink);
}
}

@ -1,9 +1,17 @@
#[cfg(feature = "ui_debug")]
use crate::trace::{Trace, Tracer};
use crate::ui::{
component::{Child, Component, Event, EventCtx, Pad},
geometry::{Point, Rect},
component::{Child, Component, ComponentExt, Event, EventCtx},
constant::screen,
display,
display::Font,
geometry::{Offset, Rect},
model_tr::{
bootloader::{theme::BLD_BG, title::Title, ReturnToC},
constant::{HEIGHT, WIDTH},
bootloader::{
theme::{BLD_BG, BLD_FG, ICON_EXIT, ICON_REDO, ICON_TRASH},
ReturnToC,
},
component::{Choice, ChoiceFactory, ChoicePage, ChoicePageMsg},
},
};
@ -20,36 +28,96 @@ impl ReturnToC for MenuMsg {
}
}
const CHOICE_LENGTH: usize = 3;
pub struct MenuChoice {
text1: &'static str,
text2: &'static str,
icon: &'static [u8],
}
impl MenuChoice {
pub fn new(text1: &'static str, text2: &'static str, icon: &'static [u8]) -> Self {
Self { text1, text2, icon }
}
}
impl Choice for MenuChoice {
fn paint_center(&self, _area: Rect, _inverse: bool) {
display::icon(
screen().center() + Offset::y(-20),
self.icon,
BLD_FG,
BLD_BG,
);
display::text_center(
screen().center() + Offset::y(0),
self.text1,
Font::NORMAL,
BLD_FG,
BLD_BG,
);
display::text_center(
screen().center() + Offset::y(10),
self.text2,
Font::NORMAL,
BLD_FG,
BLD_BG,
);
}
}
#[cfg(feature = "ui_debug")]
impl Trace for MenuChoice {
fn trace(&self, t: &mut dyn Tracer) {
t.open("MenuChoice");
t.close();
}
}
pub struct MenuChoiceFactory;
impl MenuChoiceFactory {
const CHOICES: [(&'static str, &'static str, &'static [u8]); CHOICE_LENGTH] = [
("Wipe", "Trezor", ICON_TRASH),
("Reboot", "Trezor", ICON_REDO),
("Exit", "Menu", ICON_EXIT),
];
pub fn new() -> Self {
Self {}
}
}
impl ChoiceFactory for MenuChoiceFactory {
type Item = MenuChoice;
fn count(&self) -> usize {
CHOICE_LENGTH
}
fn get(&self, choice_index: usize) -> MenuChoice {
MenuChoice::new(
MenuChoiceFactory::CHOICES[choice_index as usize].0,
MenuChoiceFactory::CHOICES[choice_index as usize].1,
MenuChoiceFactory::CHOICES[choice_index as usize].2,
)
}
}
pub struct Menu {
bg: Pad,
title: Child<Title>,
// close: Child<Button<&'static str>>,
// reboot: Child<Button<&'static str>>,
// reset: Child<Button<&'static str>>,
pg: Child<ChoicePage<MenuChoiceFactory>>,
}
impl Menu {
pub fn new(bld_version: &'static str) -> Self {
// let content_reboot = IconText::new("REBOOT", REBOOT);
// let content_reset = IconText::new("FACTORY RESET", ERASE);
let mut instance = Self {
bg: Pad::with_background(BLD_BG),
title: Child::new(Title::new(bld_version)),
// close: Child::new(
// Button::with_icon(CLOSE)
// .styled(button_bld_menu())
// .with_expanded_touch_area(Insets::uniform(13)),
// ),
// reboot: Child::new(
// Button::with_icon_and_text(content_reboot).styled(button_bld_menu_item()),
// ),
// reset: Child::new(
// Button::with_icon_and_text(content_reset).styled(button_bld_menu_item()),
// ),
};
instance.bg.clear();
instance
pub fn new() -> Self {
let choices = MenuChoiceFactory::new();
Self {
pg: ChoicePage::new(choices)
.with_carousel(true)
.with_only_one_item(true)
.into_child(),
}
}
}
@ -57,48 +125,24 @@ impl Component for Menu {
type Msg = MenuMsg;
fn place(&mut self, bounds: Rect) -> Rect {
self.bg
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.title
.place(Rect::new(Point::new(10, 0), Point::new(128, 8)));
// self.close.place(Rect::new(
// Point::new(187, 15),
// Point::new(187 + 38, 15 + 38),
// ));
// self.reboot
// .place(Rect::new(Point::new(16, 66), Point::new(16 + 209, 66 + 48)));
// self.reset.place(Rect::new(
// Point::new(16, 122),
// Point::new(16 + 209, 122 + 48),
// ));
self.pg.place(bounds);
bounds
}
fn event(&mut self, _ctx: &mut EventCtx, _event: Event) -> Option<Self::Msg> {
// if let Some(Clicked) = self.close.event(ctx, event) {
// return Some(Self::Msg::Close);
// }
// if let Some(Clicked) = self.reboot.event(ctx, event) {
// return Some(Self::Msg::Reboot);
// }
// if let Some(Clicked) = self.reset.event(ctx, event) {
// return Some(Self::Msg::FactoryReset);
// }
None
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
match self.pg.event(ctx, event) {
Some(ChoicePageMsg::Choice(0)) => Some(MenuMsg::FactoryReset),
Some(ChoicePageMsg::Choice(1)) => Some(MenuMsg::Reboot),
Some(ChoicePageMsg::Choice(2)) => Some(MenuMsg::Close),
_ => None,
}
}
fn paint(&mut self) {
self.bg.paint();
self.title.paint();
// self.close.paint();
// self.reboot.paint();
// self.reset.paint();
self.pg.paint();
}
fn bounds(&self, _sink: &mut dyn FnMut(Rect)) {
// self.close.bounds(sink);
// self.reboot.bounds(sink);
// self.reset.bounds(sink);
fn bounds(&self, sink: &mut dyn FnMut(Rect)) {
self.pg.bounds(sink)
}
}

@ -3,12 +3,13 @@ use crate::{
ui::{
component::{Component, Never},
display::{self, Font},
geometry::Point,
model_tr::constant,
},
};
use heapless::String;
mod confirm;
mod confirm_seed;
mod intro;
mod menu;
mod theme;
@ -19,19 +20,20 @@ use crate::ui::{
text::paragraphs::{Paragraph, ParagraphVecShort, Paragraphs, VecExt},
Event, EventCtx,
},
constant::{screen, BACKLIGHT_NORMAL, WIDTH},
display::{fade_backlight_duration, Color, TextOverlay},
constant::{screen, BACKLIGHT_NORMAL},
display::{fade_backlight_duration, Color},
event::ButtonEvent,
geometry::{LinearPlacement, Offset, Rect},
model_tr::{
bootloader::{
confirm::Confirm,
confirm_seed::ConfirmSeed,
intro::Intro,
menu::Menu,
theme::{bld_button_cancel, bld_button_default, BLD_BG, BLD_FG},
theme::{BLD_BG, BLD_FG, ICON_ALERT, ICON_SPINNER, LOGO_EMPTY},
},
component::{Button, ButtonPos, ResultScreen},
theme::LOGO_EMPTY,
component::ResultScreen,
theme::ICON_SUCCESS,
},
util::{from_c_array, from_c_str},
};
@ -78,6 +80,7 @@ where
{
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
fade_backlight_duration(BACKLIGHT_NORMAL as _, 500);
while button_eval().is_some() {}
@ -93,6 +96,7 @@ where
}
frame.paint();
display::refresh();
}
}
}
@ -108,72 +112,78 @@ extern "C" fn screen_install_confirm(
let text = unwrap!(unsafe { from_c_array(vendor_str, vendor_str_len as usize) });
let version = unwrap!(unsafe { from_c_str(version) });
const ICON: Option<&'static [u8]> = None; //Some(RECEIVE);
let msg = if downgrade {
"Downgrade firmware by"
let title = if downgrade {
"DOWNGRADE FIRMWARE"
} else if vendor {
"Change vendor to"
"FW VENDOR CHANGE"
} else {
"Update firmware by"
"UPDATE FIRMWARE"
};
let mut msg: String<30> = String::new();
msg.push_str("Firmware version ").unwrap();
msg.push_str(version).unwrap();
let mut message = ParagraphVecShort::new();
message.add(Paragraph::new(&theme::TEXT_NORMAL, msg).centered());
message.add(Paragraph::new(&theme::TEXT_NORMAL, text).centered());
message.add(Paragraph::new(&theme::TEXT_NORMAL, version).centered());
message.add(Paragraph::new(&theme::TEXT_NORMAL, msg.as_ref()));
message.add(Paragraph::new(&theme::TEXT_NORMAL, "by"));
message.add(Paragraph::new(&theme::TEXT_NORMAL, text));
if vendor || downgrade {
message.add(Paragraph::new(&theme::TEXT_BOLD, "Seed will be erased!").centered());
let mut m = ParagraphVecShort::new();
m.add(Paragraph::new(&theme::TEXT_NORMAL, "Seed will be erased!"));
let message2 = Paragraphs::new(m)
.with_placement(LinearPlacement::vertical().align_at_center())
.with_spacing(0);
let mut frame = ConfirmSeed::new(
BLD_BG,
title,
Paragraphs::new(message)
.with_placement(LinearPlacement::vertical().align_at_center())
.with_spacing(0),
message2,
"INSTALL",
false,
);
run(&mut frame)
} else {
let mut frame = Confirm::new(
BLD_BG,
None,
title,
Paragraphs::new(message)
.with_placement(LinearPlacement::vertical().align_at_center())
.with_spacing(0),
"INSTALL",
false,
);
run(&mut frame)
}
let left = Button::with_text(ButtonPos::Left, "CANCEL", bld_button_cancel());
let right = Button::with_text(ButtonPos::Right, "INSTALL", bld_button_default());
let mut frame = Confirm::new(
BLD_BG,
ICON,
Paragraphs::new(message).with_placement(LinearPlacement::vertical().align_at_center()),
left,
right,
false,
);
run(&mut frame)
}
#[no_mangle]
extern "C" fn screen_wipe_confirm() -> u32 {
const ICON: Option<&'static [u8]> = None; //Some(ERASE_BIG);
let mut messages = ParagraphVecShort::new();
messages.add(
Paragraph::new(
&theme::TEXT_NORMAL,
"Do you really want to wipe the device?",
)
.centered(),
);
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Seed will be erased!").centered());
// messages.add(Paragraph::new(
// &theme::TEXT_NORMAL,
// "Do you really want to wipe the device?",
// ));
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Seed will be erased!"));
let message =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let left = Button::with_text(ButtonPos::Left, "WIPE", bld_button_default());
let right = Button::with_text(ButtonPos::Right, "CANCEL", bld_button_cancel());
let mut frame = Confirm::new(BLD_BG, ICON, message, left, right, true);
let mut frame = Confirm::new(BLD_BG, None, "WIPE TREZOR?", message, "WIPE", true);
run(&mut frame)
}
#[no_mangle]
extern "C" fn screen_menu(bld_version: *const cty::c_char) -> u32 {
let bld_version = unwrap!(unsafe { from_c_str(bld_version) });
run(&mut Menu::new(bld_version))
extern "C" fn screen_menu(_bld_version: *const cty::c_char) -> u32 {
run(&mut Menu::new())
}
#[no_mangle]
@ -192,33 +202,66 @@ extern "C" fn screen_intro(
fn screen_progress(
text: &str,
text2: &str,
progress: u16,
initialize: bool,
fg_color: Color,
bg_color: Color,
_icon: Option<(&[u8], Color)>,
icon: Option<(&[u8], Color)>,
) -> u32 {
if initialize {
display::rect_fill(constant::screen(), bg_color);
}
let loader_area = Rect::new(Point::new(5, 24), Point::new(WIDTH - 5, 24 + 16));
let mut text = TextOverlay::new(text, Font::NORMAL);
text.place(loader_area.center() + Offset::y(Font::NORMAL.text_height() / 2));
let fill_to = (loader_area.width() as u32 * progress as u32) / 1000;
display::bar_with_text_and_fill(loader_area, Some(text), fg_color, bg_color, 0, fill_to as _);
let progress = if progress < 20 { 20 } else { progress };
display::rect_rounded2_partial(
Rect::new(
screen().top_center() + Offset::new(-9, 3),
screen().top_center() + Offset::new(9, 18 + 3),
),
fg_color,
bg_color,
((100_u32 * progress as u32) / 1000) as _,
icon,
);
display::text_center(
screen().center() + Offset::y(8),
text,
Font::BOLD,
fg_color,
bg_color,
);
display::text_center(
screen().center() + Offset::y(20),
text2,
Font::BOLD,
fg_color,
bg_color,
);
// display::text_center(
// Point::new(constant::WIDTH / 2, 100),
// text,
// Font::NORMAL,
// let loader_area = Rect::new(Point::new(5, HEIGHT - 16), Point::new(WIDTH - 5,
// HEIGHT));
//
// let mut text = TextOverlay::new(text, Font::NORMAL);
// text.place(loader_area.center() + Offset::y(Font::NORMAL.text_height() / 2));
//
// let fill_to = (loader_area.width() as u32 * progress as u32) / 1000;
//
// if let Some(icon) = icon {
// display::icon(screen().center(), icon.0, icon.1, BLD_BG);
// }
//
// display::bar_with_text_and_fill(
// loader_area,
// Some(&text),
// fg_color,
// bg_color,
// 0,
// fill_to as _,
// );
// display::loader(progress, -20, fg_color, bg_color, icon);
display::refresh();
0
}
@ -231,24 +274,26 @@ extern "C" fn screen_install_progress(
_initial_setup: bool,
) -> u32 {
screen_progress(
"INSTALLING FIRMWARE",
"Installing",
"Firmware",
progress,
initialize,
BLD_FG,
BLD_BG,
None, //Some((theme::RECEIVE, fg_color)),
Some((ICON_SUCCESS.0, BLD_FG)),
)
}
#[no_mangle]
extern "C" fn screen_wipe_progress(progress: u16, initialize: bool) -> u32 {
screen_progress(
"WIPING DEVICE",
"Wiping",
"Trezor",
progress,
initialize,
theme::BLD_FG,
BLD_FG,
BLD_BG,
None, //Some((theme::ERASE_BIG, theme::BLD_FG)),
Some((ICON_SUCCESS.0, BLD_FG)),
)
}
@ -263,14 +308,14 @@ extern "C" fn screen_connect() -> u32 {
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}
#[no_mangle]
extern "C" fn screen_wipe_success() -> u32 {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Device wiped").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "successfully.").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Device wiped").centered());
let m_top =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
@ -282,17 +327,17 @@ extern "C" fn screen_wipe_success() -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, m_top, m_bottom, true);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, m_top, m_bottom, true);
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}
#[no_mangle]
extern "C" fn screen_wipe_fail() -> u32 {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Device wipe was").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "not successful.").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Wipe failed").centered());
let m_top =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
@ -304,9 +349,10 @@ extern "C" fn screen_wipe_fail() -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, m_top, m_bottom, true);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, m_top, m_bottom, true);
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}
@ -318,8 +364,7 @@ extern "C" fn screen_boot_empty(_firmware_present: bool) {
#[no_mangle]
extern "C" fn screen_install_fail() -> u32 {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Firmware installation was").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "not successful.").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Install failed").centered());
let m_top =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
@ -330,16 +375,16 @@ extern "C" fn screen_install_fail() -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, m_top, m_bottom, true);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_ALERT, m_top, m_bottom, true);
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}
fn screen_install_success_bld(msg: &'static str, complete_draw: bool) -> u32 {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Firmware installed").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "successfully.").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Installed").centered());
let m_top =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
@ -350,16 +395,16 @@ fn screen_install_success_bld(msg: &'static str, complete_draw: bool) -> u32 {
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, m_top, m_bottom, complete_draw);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, m_top, m_bottom, complete_draw);
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}
fn screen_install_success_initial(msg: &'static str, complete_draw: bool) -> u32 {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Firmware installed").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "successfully.").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Installed").centered());
let m_top =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
@ -370,9 +415,10 @@ fn screen_install_success_initial(msg: &'static str, complete_draw: bool) -> u32
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, m_top, m_bottom, complete_draw);
let mut frame = ResultScreen::new(BLD_FG, BLD_BG, ICON_SPINNER, m_top, m_bottom, complete_draw);
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}
@ -393,13 +439,14 @@ extern "C" fn screen_install_success(
#[no_mangle]
extern "C" fn screen_welcome() -> u32 {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&theme::TEXT_BOLD, "Get started with").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "your trezor at").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "Get started with").centered());
messages.add(Paragraph::new(&theme::TEXT_NORMAL, "your trezor at").centered());
messages.add(Paragraph::new(&theme::TEXT_BOLD, "trezor.io/start").centered());
let mut frame =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
frame.place(SCREEN_ADJ);
frame.paint();
display::refresh();
0
}

@ -1,12 +1,10 @@
use crate::ui::{
component::text::TextStyle,
display::{Color, Font},
model_tr::{
component::{ButtonStyle, ButtonStyleSheet},
theme::{BG, BLACK, FG, WHITE},
},
};
pub const WHITE: Color = Color::white();
pub const BLACK: Color = Color::black();
pub const BLD_BG: Color = BLACK;
pub const BLD_FG: Color = WHITE;
@ -16,35 +14,14 @@ pub const RADIUS: u8 = 2;
// Size of icons in the UI (i.e. inside buttons).
pub const ICON_SIZE: i32 = 16;
pub fn bld_button_default() -> ButtonStyleSheet {
ButtonStyleSheet {
normal: &ButtonStyle {
font: Font::NORMAL,
text_color: BG,
border_horiz: true,
},
active: &ButtonStyle {
font: Font::NORMAL,
text_color: FG,
border_horiz: true,
},
}
}
pub fn bld_button_cancel() -> ButtonStyleSheet {
ButtonStyleSheet {
normal: &ButtonStyle {
font: Font::NORMAL,
text_color: FG,
border_horiz: false,
},
active: &ButtonStyle {
font: Font::NORMAL,
text_color: BG,
border_horiz: false,
},
}
}
pub const LOGO_EMPTY: &[u8] = include_res!("model_tr/res/trezor_empty.toif");
pub const ICON_TRASH: &[u8] = include_res!("model_tr/res/trash.toif");
pub const ICON_ALERT: &[u8] = include_res!("model_tr/res/alert.toif");
pub const ICON_SPINNER: &[u8] = include_res!("model_tr/res/spinner.toif");
pub const ICON_REDO: &[u8] = include_res!("model_tr/res/redo.toif");
pub const ICON_DOWNLOAD: &[u8] = include_res!("model_tr/res/download.toif");
pub const ICON_EXIT: &[u8] = include_res!("model_tr/res/exit.toif");
pub const ICON_WARN_TITLE: &[u8] = include_res!("model_tr/res/bld_header_warn.toif");
pub const TEXT_NORMAL: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::NORMAL, BLD_FG, BLD_BG, BLD_FG, BLD_FG);
pub const TEXT_BOLD: TextStyle = TextStyle::new(Font::BOLD, BLD_FG, BLD_BG, BLD_FG, BLD_FG);

@ -1,8 +1,9 @@
use crate::ui::{
component::{Component, Event, EventCtx, Never},
constant::WIDTH,
display::{self, Font},
geometry::{Point, Rect},
model_tr::bootloader::theme::{BLD_BG, BLD_FG},
geometry::{Offset, Point, Rect},
model_tr::bootloader::theme::{BLD_BG, BLD_FG, ICON_WARN_TITLE},
};
pub struct Title {
@ -32,20 +33,30 @@ impl Component for Title {
}
fn paint(&mut self) {
display::text_top_left(
self.area.top_left(),
display::icon_rust_top_left(Point::new(-1, 0), ICON_WARN_TITLE, BLD_FG, BLD_BG);
let font = Font::BOLD;
display::text_center(
self.area.top_center() + Offset::y(font.text_height()) - Offset::y(font.baseline())
+ Offset::y(2),
"BOOTLOADER",
Font::NORMAL,
font,
BLD_FG,
BLD_BG,
);
display::text_top_left(
Point::new(self.area.top_left().x + 65, self.area.top_left().y),
display::icon_rust_top_right(Point::new(WIDTH, 0), ICON_WARN_TITLE, BLD_FG, BLD_BG);
display::text_center(
self.area.top_center() + Offset::y(font.text_height()) - Offset::y(font.baseline())
+ Offset::y(11),
self.version,
Font::NORMAL,
font,
BLD_FG,
BLD_BG,
);
display::icon_rust_top_left(Point::new(-1, 0), ICON_WARN_TITLE, BLD_FG, BLD_BG);
}
fn bounds(&self, _sink: &mut dyn FnMut(Rect)) {}

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
time::Duration,
ui::{
component::{Component, Event, EventCtx},
@ -7,6 +6,7 @@ use crate::{
display::{self, Color, Font, Icon},
geometry::{Offset, Point, Rect},
},
StrBuffer,
};
use super::theme;
@ -640,6 +640,15 @@ impl ButtonLayout {
)
}
/// Arrow up on left and text on the right.
pub fn up_and_text(text: StrBuffer) -> Self {
Self::new(
Some(ButtonDetails::up_arrow_icon()),
None,
Some(ButtonDetails::text(text)),
)
}
/// Only armed text in the middle.
pub fn none_armed_none(text: StrBuffer) -> Self {
Self::new(None, Some(ButtonDetails::armed_text(text)), None)

@ -1,11 +1,11 @@
use super::{theme, ScrollBar};
use crate::{
micropython::buffer::StrBuffer,
ui::{
component::{Child, Component, ComponentExt, Event, EventCtx},
geometry::{Insets, Rect},
model_tr::component::{scrollbar::SCROLLBAR_SPACE, title::Title},
},
StrBuffer,
};
/// Component for holding another component and displaying a title.

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
time::{Duration, Instant},
ui::{
component::{Component, Event, EventCtx},
@ -7,6 +6,7 @@ use crate::{
geometry::Rect,
model_tr::component::{loader::Loader, ButtonPos, LoaderMsg, LoaderStyleSheet},
},
StrBuffer,
};
pub enum HoldToConfirmMsg {

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
ui::{
component::{Component, Event, EventCtx, Pad},
display::Font,
@ -7,6 +6,7 @@ use crate::{
geometry::{Offset, Point, Rect},
model_tr::constant,
},
StrBuffer,
};
use super::{common::display_center, theme};

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
trezorhal::random,
ui::{
component::{text::common::TextBox, Child, Component, ComponentExt, Event, EventCtx},
@ -7,6 +6,7 @@ use crate::{
geometry::Rect,
model_tr::theme,
},
StrBuffer,
};
use super::super::{

@ -1,9 +1,9 @@
use crate::{
micropython::buffer::StrBuffer,
ui::{
component::{Component, Event, EventCtx},
geometry::Rect,
},
StrBuffer,
};
use super::super::{ButtonLayout, ChoiceFactory, ChoiceItem, ChoicePage, ChoicePageMsg};

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
time::{Duration, Instant},
ui::{
animation::Animation,
@ -9,6 +8,7 @@ use crate::{
model_tr::theme,
util::animation_disabled,
},
StrBuffer,
};
pub enum LoaderMsg {

@ -2,10 +2,11 @@ mod button;
mod button_controller;
mod changing_text;
mod common;
mod confirm;
mod dialog;
#[cfg(feature = "micropython")]
mod flow;
#[cfg(feature = "micropython")]
mod flow_pages;
#[cfg(feature = "micropython")]
mod flow_pages_helpers;
mod frame;
mod hold_to_confirm;
@ -14,11 +15,12 @@ mod input_methods;
mod loader;
mod no_btn_dialog;
mod page;
mod result;
mod progress;
mod result;
mod result_anim;
mod result_popup;
mod scrollbar;
#[cfg(feature = "micropython")]
mod share_words;
mod show_more;
mod title;
@ -29,13 +31,13 @@ pub use button::{
Button, ButtonAction, ButtonActions, ButtonContent, ButtonDetails, ButtonLayout, ButtonMsg,
ButtonPos, ButtonStyle, ButtonStyleSheet,
};
pub use confirm::{HoldToConfirm, HoldToConfirmMsg};
pub use dialog::{Dialog, DialogMsg};
pub use hold_to_confirm::{HoldToConfirm, HoldToConfirmMsg};
pub use button_controller::{ButtonController, ButtonControllerMsg};
pub use changing_text::ChangingTextLine;
#[cfg(feature = "micropython")]
pub use flow::{Flow, FlowMsg};
#[cfg(feature = "micropython")]
pub use flow_pages::{FlowPages, Page};
pub use frame::{Frame, ScrollableContent, ScrollableFrame};
pub use homescreen::{Homescreen, HomescreenMsg, Lockscreen};
@ -49,6 +51,7 @@ pub use input_methods::{
wordlist::{WordlistEntry, WordlistEntryMsg, WordlistType},
};
pub use loader::{Loader, LoaderMsg, LoaderStyle, LoaderStyleSheet};
#[cfg(feature = "micropython")]
pub use no_btn_dialog::{NoBtnDialog, NoBtnDialogMsg};
pub use page::ButtonPage;
pub use progress::Progress;
@ -56,5 +59,6 @@ pub use result::ResultScreen;
pub use result_anim::{ResultAnim, ResultAnimMsg};
pub use result_popup::{ResultPopup, ResultPopupMsg};
pub use scrollbar::ScrollBar;
#[cfg(feature = "micropython")]
pub use share_words::ShareWords;
pub use show_more::{CancelInfoConfirmMsg, ShowMore};

@ -2,7 +2,6 @@ use core::mem;
use crate::{
error::Error,
micropython::buffer::StrBuffer,
ui::{
component::{
base::ComponentExt,
@ -15,6 +14,7 @@ use crate::{
model_tr::constant,
util::animation_disabled,
},
StrBuffer,
};
use super::theme;

@ -1,28 +1,31 @@
use crate::ui::{
component::{
text::paragraphs::{ParagraphVecShort, Paragraphs},
text::paragraphs::{ParagraphStrType, ParagraphVecShort, Paragraphs},
Child, Component, Event, EventCtx, Never, Pad,
},
constant::{HEIGHT, WIDTH},
constant::{screen, HEIGHT, WIDTH},
display,
display::Color,
geometry::{Point, Rect},
geometry::{Offset, Point, Rect},
};
pub struct ResultScreen {
pub struct ResultScreen<T> {
bg: Pad,
small_pad: Pad,
fg_color: Color,
bg_color: Color,
message_top: Child<Paragraphs<ParagraphVecShort<&'static str>>>,
message_bottom: Child<Paragraphs<ParagraphVecShort<&'static str>>>,
icon: &'static [u8],
message_top: Child<Paragraphs<ParagraphVecShort<T>>>,
message_bottom: Child<Paragraphs<ParagraphVecShort<T>>>,
}
impl ResultScreen {
impl<T: ParagraphStrType> ResultScreen<T> {
pub fn new(
fg_color: Color,
bg_color: Color,
message_top: Paragraphs<ParagraphVecShort<&'static str>>,
message_bottom: Paragraphs<ParagraphVecShort<&'static str>>,
icon: &'static [u8],
message_top: Paragraphs<ParagraphVecShort<T>>,
message_bottom: Paragraphs<ParagraphVecShort<T>>,
complete_draw: bool,
) -> Self {
let mut instance = Self {
@ -30,6 +33,7 @@ impl ResultScreen {
small_pad: Pad::with_background(bg_color),
fg_color,
bg_color,
icon,
message_top: Child::new(message_top),
message_bottom: Child::new(message_bottom),
};
@ -43,7 +47,7 @@ impl ResultScreen {
}
}
impl Component for ResultScreen {
impl<T: ParagraphStrType> Component for ResultScreen<T> {
type Msg = Never;
fn place(&mut self, bounds: Rect) -> Rect {
@ -51,7 +55,7 @@ impl Component for ResultScreen {
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, HEIGHT)));
self.message_top
.place(Rect::new(Point::new(0, 0), Point::new(WIDTH, 30)));
.place(Rect::new(Point::new(0, 26), Point::new(WIDTH, 40)));
let bottom_area = Rect::new(Point::new(0, 40), Point::new(WIDTH, HEIGHT));
@ -69,16 +73,13 @@ impl Component for ResultScreen {
self.bg.paint();
self.small_pad.paint();
// display::icon(
// Point::new(screen().center().x, 45),
// self.icon,
// self.fg_color,
// self.bg_color,
// );
// display::rect_fill(
// Rect::from_top_left_and_size(Point::new(12, 149), Offset::new(216, 1)),
// self.fg_color,
// );
display::icon(
screen().top_center() + Offset::y(12),
self.icon,
self.fg_color,
self.bg_color,
);
self.message_top.paint();
self.message_bottom.paint();
}

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
time::Instant,
ui::{
component::{
@ -13,6 +12,7 @@ use crate::{
theme,
},
},
StrBuffer,
};
use super::{ButtonController, ButtonControllerMsg, ButtonLayout};

@ -1,5 +1,4 @@
use crate::{
micropython::buffer::StrBuffer,
time::Instant,
ui::{
component::{Component, Event, EventCtx, Marquee, Never},
@ -7,6 +6,7 @@ use crate::{
geometry::{Offset, Rect},
model_tr::theme,
},
StrBuffer,
};
pub struct Title {

@ -1,46 +1,68 @@
use crate::ui::{
component::{
text::paragraphs::{Paragraph, ParagraphVecShort, Paragraphs, VecExt},
Component,
use crate::{
ui::{
component::{
text::paragraphs::{Paragraph, ParagraphVecShort, Paragraphs, VecExt},
Component,
},
display::Color,
geometry::LinearPlacement,
model_tr::{
component::ResultScreen,
constant,
theme::{ICON_FAIL, TEXT_BOLD, TEXT_NORMAL},
},
util::from_c_str,
},
geometry::LinearPlacement,
model_tr::{
component::ResultScreen,
constant,
theme::{BLACK, TEXT_BOLD, TEXT_NORMAL, WHITE},
},
util::from_c_str,
StrBuffer,
};
#[cfg(not(feature = "micropython"))]
fn get_str(text: &str) -> &str {
text
}
#[cfg(feature = "micropython")]
fn get_str(text: &'static str) -> StrBuffer {
text.into()
}
#[no_mangle]
extern "C" fn screen_fatal_error(msg: *const cty::c_char, file: *const cty::c_char) -> u32 {
let m_top = if msg.is_null() {
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&TEXT_BOLD, "FATAL ERROR!").centered());
messages.add(Paragraph::new(&TEXT_BOLD, get_str("FATAL ERROR!")).centered());
messages.add(Paragraph::new(&TEXT_NORMAL, unwrap!(unsafe { from_c_str(file) })).centered());
messages.add(
Paragraph::new(&TEXT_NORMAL, get_str(unwrap!(unsafe { from_c_str(file) }))).centered(),
);
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center())
} else {
let msg = unwrap!(unsafe { from_c_str(msg) });
let msg = get_str(unwrap!(unsafe { from_c_str(msg) }));
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&TEXT_BOLD, "FATAL ERROR!").centered());
messages.add(Paragraph::new(&TEXT_BOLD, get_str("FATAL ERROR!")).centered());
messages.add(Paragraph::new(&TEXT_NORMAL, msg).centered());
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center())
};
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&TEXT_BOLD, "PLEASE CONTACT").centered());
messages.add(Paragraph::new(&TEXT_BOLD, "TREZOR SUPPORT").centered());
messages.add(Paragraph::new(&TEXT_BOLD, get_str("PLEASE CONTACT")).centered());
messages.add(Paragraph::new(&TEXT_BOLD, get_str("TREZOR SUPPORT")).centered());
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(WHITE, BLACK, m_top, m_bottom, true);
let mut frame = ResultScreen::new(
Color::white(),
Color::black(),
ICON_FAIL.0,
m_top,
m_bottom,
true,
);
frame.place(constant::screen());
frame.paint();
0
@ -48,7 +70,7 @@ extern "C" fn screen_fatal_error(msg: *const cty::c_char, file: *const cty::c_ch
#[no_mangle]
extern "C" fn screen_error_shutdown(label: *const cty::c_char, msg: *const cty::c_char) -> u32 {
let label = unwrap!(unsafe { from_c_str(label) });
let label = get_str(unwrap!(unsafe { from_c_str(label) }));
let m_top = if msg.is_null() {
let mut messages = ParagraphVecShort::new();
@ -56,7 +78,7 @@ extern "C" fn screen_error_shutdown(label: *const cty::c_char, msg: *const cty::
messages.add(Paragraph::new(&TEXT_BOLD, label).centered());
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center())
} else {
let msg = unwrap!(unsafe { from_c_str(msg) });
let msg = get_str(unwrap!(unsafe { from_c_str(msg) }));
let mut messages = ParagraphVecShort::new();
@ -67,12 +89,19 @@ extern "C" fn screen_error_shutdown(label: *const cty::c_char, msg: *const cty::
let mut messages = ParagraphVecShort::new();
messages.add(Paragraph::new(&TEXT_BOLD, "PLEASE UNPLUG").centered());
messages.add(Paragraph::new(&TEXT_BOLD, "THE DEVICE").centered());
messages.add(Paragraph::new(&TEXT_BOLD, get_str("PLEASE UNPLUG")).centered());
messages.add(Paragraph::new(&TEXT_BOLD, get_str("THE DEVICE")).centered());
let m_bottom =
Paragraphs::new(messages).with_placement(LinearPlacement::vertical().align_at_center());
let mut frame = ResultScreen::new(WHITE, BLACK, m_top, m_bottom, true);
let mut frame = ResultScreen::new(
Color::white(),
Color::black(),
ICON_FAIL.0,
m_top,
m_bottom,
true,
);
frame.place(constant::screen());
frame.paint();
0

@ -69,6 +69,7 @@ pub const ICON_DELETE: IconAndName =
IconAndName::new(include_res!("model_tr/res/delete.toif"), "delete"); // 10*7
pub const ICON_EYE: IconAndName =
IconAndName::new(include_res!("model_tr/res/eye_round.toif"), "eye"); // 12*7
pub const ICON_FAIL: IconAndName = IconAndName::new(include_res!("model_tr/res/fail.toif"), "fail");
pub const ICON_LOCK: IconAndName = IconAndName::new(include_res!("model_tr/res/lock.toif"), "lock"); // 10*10
pub const ICON_NEXT_PAGE: IconAndName =
IconAndName::new(include_res!("model_tr/res/next_page.toif"), "next_page"); // 10*8

@ -195,14 +195,16 @@ def process_face(
process_face("Roboto", "Regular", 20)
process_face("Roboto", "Bold", 20)
process_face("TTHoves", "Regular", 18, ext="otf")
process_face("TTHoves", "DemiBold", 18, ext="otf")
process_face("TTHoves", "Bold", 16, ext="otf")
# process_face("TTHoves", "Regular", 18, ext="otf")
# process_face("TTHoves", "DemiBold", 18, ext="otf")
# process_face("TTHoves", "Bold", 16, ext="otf")
process_face("RobotoMono", "Regular", 20)
process_face("PixelOperator", "Regular", 8, bpp=1, shave_bearingX=1)
process_face("PixelOperator", "Bold", 8, bpp=1, shave_bearingX=1)
process_face("PixelOperator8", "Bold", 8, bpp=1, shave_bearingX=1)
process_face("PixelOperatorMono", "Regular", 8, bpp=1, shave_bearingX=1)
process_face("PixelOperatorMono8", "Bold", 8, bpp=1, shave_bearingX=1)
# For model R
process_face("Unifont", "Regular", 16, bpp=1, shave_bearingX=1, ext="otf")

Loading…
Cancel
Save