mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-03 19:31:02 +00:00
refactor(core): rework color definitions in bootloader
This commit is contained in:
parent
3294a49cec
commit
e7966cc804
@ -37,22 +37,27 @@
|
||||
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
|
||||
#define COLOR_BL_BG COLOR_WHITE // background
|
||||
#define COLOR_BL_FG COLOR_BLACK // foreground
|
||||
#define COLOR_BL_FAIL RGB16(0xFF, 0x00, 0x00) // red
|
||||
#define COLOR_BL_DONE RGB16(0x00, 0xAE, 0x0B) // green
|
||||
#define COLOR_BL_PROCESS RGB16(0x4A, 0x90, 0xE2) // blue
|
||||
#define COLOR_BL_GRAY RGB16(0x99, 0x99, 0x99) // gray
|
||||
|
||||
#define COLOR_WELCOME_BG COLOR_WHITE // welcome background
|
||||
#define COLOR_WELCOME_FG COLOR_BLACK // welcome foreground
|
||||
|
||||
// common shared functions
|
||||
|
||||
static void ui_confirm_cancel_buttons(void) {
|
||||
display_bar_radius(9, 184, 108, 50, COLOR_BL_FAIL, COLOR_WHITE, 4);
|
||||
display_bar_radius(9, 184, 108, 50, COLOR_BL_FAIL, COLOR_BL_BG, 4);
|
||||
display_icon(9 + (108 - 16) / 2, 184 + (50 - 16) / 2, 16, 16,
|
||||
toi_icon_cancel + 12, sizeof(toi_icon_cancel) - 12, COLOR_WHITE,
|
||||
toi_icon_cancel + 12, sizeof(toi_icon_cancel) - 12, COLOR_BL_BG,
|
||||
COLOR_BL_FAIL);
|
||||
display_bar_radius(123, 184, 108, 50, COLOR_BL_DONE, COLOR_WHITE, 4);
|
||||
display_bar_radius(123, 184, 108, 50, COLOR_BL_DONE, COLOR_BL_BG, 4);
|
||||
display_icon(123 + (108 - 19) / 2, 184 + (50 - 16) / 2, 20, 16,
|
||||
toi_icon_confirm + 12, sizeof(toi_icon_confirm) - 12,
|
||||
COLOR_WHITE, COLOR_BL_DONE);
|
||||
COLOR_BL_BG, COLOR_BL_DONE);
|
||||
}
|
||||
|
||||
static const char *format_ver(const char *format, uint32_t version) {
|
||||
@ -72,7 +77,7 @@ void ui_screen_boot(const vendor_header *const vhdr,
|
||||
const image_header *const hdr) {
|
||||
const int show_string = ((vhdr->vtrust & VTRUST_STRING) == 0);
|
||||
if ((vhdr->vtrust & VTRUST_RED) == 0) {
|
||||
boot_background = COLOR_BL_FAIL;
|
||||
boot_background = RGB16(0xFF, 0x00, 0x00); // red
|
||||
} else {
|
||||
boot_background = COLOR_BLACK;
|
||||
}
|
||||
@ -93,11 +98,11 @@ void ui_screen_boot(const vendor_header *const vhdr,
|
||||
|
||||
if (show_string) {
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 50, vhdr->vstr,
|
||||
vhdr->vstr_len, FONT_NORMAL, COLOR_WHITE,
|
||||
vhdr->vstr_len, FONT_NORMAL, COLOR_BL_BG,
|
||||
boot_background);
|
||||
const char *ver_str = format_ver("%d.%d.%d", fw_version);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 25, ver_str, -1,
|
||||
FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
FONT_NORMAL, COLOR_BL_BG, boot_background);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,13 +111,13 @@ void ui_screen_boot_wait(int wait_seconds) {
|
||||
mini_snprintf(wait_str, sizeof(wait_str), "starting in %d s", 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_WHITE, boot_background);
|
||||
FONT_NORMAL, COLOR_BL_BG, boot_background);
|
||||
}
|
||||
|
||||
void ui_screen_boot_click(void) {
|
||||
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5,
|
||||
"click to continue ...", -1, FONT_NORMAL, COLOR_WHITE,
|
||||
"click to continue ...", -1, FONT_NORMAL, COLOR_BL_BG,
|
||||
boot_background);
|
||||
}
|
||||
|
||||
@ -120,23 +125,23 @@ void ui_screen_boot_click(void) {
|
||||
|
||||
void ui_screen_welcome_first(void) {
|
||||
display_icon(0, 0, 240, 240, toi_icon_logo + 12, sizeof(toi_icon_logo) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
}
|
||||
|
||||
void ui_screen_welcome_second(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WELCOME_BG);
|
||||
display_icon((DISPLAY_RESX - 200) / 2, (DISPLAY_RESY - 60) / 2, 200, 60,
|
||||
toi_icon_safeplace + 12, sizeof(toi_icon_safeplace) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
}
|
||||
|
||||
void ui_screen_welcome_third(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WELCOME_BG);
|
||||
display_icon((DISPLAY_RESX - 180) / 2, (DISPLAY_RESY - 30) / 2 - 5, 180, 30,
|
||||
toi_icon_welcome + 12, sizeof(toi_icon_welcome) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
}
|
||||
|
||||
// info UI
|
||||
@ -145,44 +150,44 @@ static int display_vendor_string(const char *text, int textlen,
|
||||
uint16_t fgcolor) {
|
||||
int split = display_text_split(text, textlen, FONT_NORMAL, DISPLAY_RESX - 55);
|
||||
if (split >= textlen) {
|
||||
display_text(55, 95, text, textlen, FONT_NORMAL, fgcolor, COLOR_WHITE);
|
||||
display_text(55, 95, text, textlen, FONT_NORMAL, fgcolor, COLOR_BL_BG);
|
||||
return 120;
|
||||
} else {
|
||||
display_text(55, 95, text, split, FONT_NORMAL, fgcolor, COLOR_WHITE);
|
||||
display_text(55, 95, text, split, FONT_NORMAL, fgcolor, COLOR_BL_BG);
|
||||
if (text[split] == ' ') {
|
||||
split++;
|
||||
}
|
||||
display_text(55, 120, text + split, textlen - split, FONT_NORMAL, fgcolor,
|
||||
COLOR_WHITE);
|
||||
COLOR_BL_BG);
|
||||
return 145;
|
||||
}
|
||||
}
|
||||
|
||||
void ui_screen_firmware_info(const vendor_header *const vhdr,
|
||||
const image_header *const hdr) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
const char *ver_str = format_ver("Bootloader %d.%d.%d", VERSION_UINT32);
|
||||
display_text(16, 32, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_text(16, 32, ver_str, -1, FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BL_FG);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BL_GRAY, COLOR_WHITE);
|
||||
COLOR_BL_GRAY, COLOR_BL_BG);
|
||||
if (vhdr && hdr) {
|
||||
ver_str = format_ver("Firmware %d.%d.%d by", (hdr->version));
|
||||
display_text(55, 70, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
display_text(55, 70, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_BL_BG);
|
||||
display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BL_GRAY);
|
||||
} else {
|
||||
display_text(55, 70, "No Firmware", -1, FONT_NORMAL, COLOR_BL_GRAY,
|
||||
COLOR_WHITE);
|
||||
COLOR_BL_BG);
|
||||
}
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
void ui_screen_firmware_fingerprint(const image_header *const hdr) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Firmware fingerprint", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_text(16, 32, "Firmware fingerprint", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BL_FG);
|
||||
|
||||
static const char *hexdigits = "0123456789abcdef";
|
||||
char fingerprint_str[64];
|
||||
@ -192,103 +197,103 @@ void ui_screen_firmware_fingerprint(const image_header *const hdr) {
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
display_text_center(120, 70 + i * 25, fingerprint_str + i * 16, 16,
|
||||
FONT_MONO, COLOR_BLACK, COLOR_WHITE);
|
||||
FONT_MONO, COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
display_bar_radius(9, 184, 222, 50, COLOR_BL_DONE, COLOR_WHITE, 4);
|
||||
display_bar_radius(9, 184, 222, 50, COLOR_BL_DONE, COLOR_BL_BG, 4);
|
||||
display_icon(9 + (222 - 19) / 2, 184 + (50 - 16) / 2, 20, 16,
|
||||
toi_icon_confirm + 12, sizeof(toi_icon_confirm) - 12,
|
||||
COLOR_WHITE, COLOR_BL_DONE);
|
||||
COLOR_BL_BG, COLOR_BL_DONE);
|
||||
}
|
||||
|
||||
// install UI
|
||||
|
||||
void ui_screen_install_confirm_upgrade(const vendor_header *const vhdr,
|
||||
const image_header *const hdr) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Firmware update", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_text(16, 32, "Firmware update", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BL_FG);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Update firmware by", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
int next_y = display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BLACK);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
display_text(55, 70, "Update firmware by", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
int next_y = display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BL_FG);
|
||||
const char *ver_str = format_ver("to version %d.%d.%d?", hdr->version);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_install_confirm_newvendor_or_downgrade_wipe(
|
||||
const vendor_header *const vhdr, const image_header *const hdr,
|
||||
secbool downgrade_wipe) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_text(
|
||||
16, 32,
|
||||
(sectrue == downgrade_wipe) ? "Firmware downgrade" : "Vendor change", -1,
|
||||
FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BL_FG);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Install firmware by", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
int next_y = display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BLACK);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
display_text(55, 70, "Install firmware by", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
int next_y = display_vendor_string(vhdr->vstr, vhdr->vstr_len, COLOR_BL_FG);
|
||||
const char *ver_str = format_ver("(version %d.%d.%d)?", hdr->version);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL,
|
||||
COLOR_BL_FAIL, COLOR_WHITE);
|
||||
COLOR_BL_FAIL, COLOR_BL_BG);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_install_start(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_install,
|
||||
sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG, toi_icon_install,
|
||||
sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Installing firmware", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
"Installing firmware", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_erase(int pos, int len) {
|
||||
display_loader(250 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_loader(250 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_upload(int pos) {
|
||||
display_loader(pos, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_loader(pos, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
}
|
||||
|
||||
// wipe UI
|
||||
|
||||
void ui_screen_wipe_confirm(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Wipe device", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_text(16, 32, "Wipe device", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BL_FG);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Do you want to", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
display_text(55, 95, "wipe the device?", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
display_text(55, 70, "Do you want to", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
display_text(55, 95, "wipe the device?", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL,
|
||||
COLOR_BL_FAIL, COLOR_WHITE);
|
||||
COLOR_BL_FAIL, COLOR_BL_BG);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_wipe(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_wipe,
|
||||
sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG, toi_icon_wipe,
|
||||
sizeof(toi_icon_wipe), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping device", -1,
|
||||
FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
void ui_screen_wipe_progress(int pos, int len) {
|
||||
display_loader(1000 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
display_loader(1000 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BL_FG);
|
||||
}
|
||||
|
||||
// done UI
|
||||
@ -304,26 +309,26 @@ void ui_screen_done(int restart_seconds, secbool full_redraw) {
|
||||
str = "Done! Unplug the device.";
|
||||
}
|
||||
if (sectrue == full_redraw) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
}
|
||||
display_loader(1000, false, -20, COLOR_BL_DONE, COLOR_WHITE, toi_icon_done,
|
||||
sizeof(toi_icon_done), COLOR_BLACK);
|
||||
display_loader(1000, false, -20, COLOR_BL_DONE, COLOR_BL_BG, toi_icon_done,
|
||||
sizeof(toi_icon_done), COLOR_BL_FG);
|
||||
if (secfalse == full_redraw) {
|
||||
display_bar(0, DISPLAY_RESY - 24 - 18, 240, 23, COLOR_WHITE);
|
||||
display_bar(0, DISPLAY_RESY - 24 - 18, 240, 23, COLOR_BL_BG);
|
||||
}
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, str, -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
// error UI
|
||||
|
||||
void ui_screen_fail(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(1000, false, -20, COLOR_BL_FAIL, COLOR_WHITE, toi_icon_fail,
|
||||
sizeof(toi_icon_fail), COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_loader(1000, false, -20, COLOR_BL_FAIL, COLOR_BL_BG, toi_icon_fail,
|
||||
sizeof(toi_icon_fail), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Failed! Please, reconnect.", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
// general functions
|
||||
|
@ -30,55 +30,60 @@
|
||||
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
|
||||
#define COLOR_BL_BG COLOR_WHITE // background
|
||||
#define COLOR_BL_FG COLOR_BLACK // foreground
|
||||
#define COLOR_BL_FAIL RGB16(0xFF, 0x00, 0x00) // red
|
||||
#define COLOR_BL_DONE RGB16(0x00, 0xAE, 0x0B) // green
|
||||
#define COLOR_BL_PROCESS RGB16(0x4A, 0x90, 0xE2) // blue
|
||||
|
||||
#define COLOR_WELCOME_BG COLOR_WHITE // welcome background
|
||||
#define COLOR_WELCOME_FG COLOR_BLACK // welcome foreground
|
||||
|
||||
// welcome UI
|
||||
|
||||
void ui_screen_welcome_third(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WELCOME_BG);
|
||||
display_icon((DISPLAY_RESX - 180) / 2, (DISPLAY_RESY - 30) / 2 - 5, 180, 30,
|
||||
toi_icon_welcome + 12, sizeof(toi_icon_welcome) - 12,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
}
|
||||
|
||||
// install UI
|
||||
|
||||
void ui_screen_install_start(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_install,
|
||||
sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG, toi_icon_install,
|
||||
sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Installing firmware", -1, FONT_NORMAL, COLOR_BLACK,
|
||||
COLOR_WHITE);
|
||||
"Installing firmware", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_erase(int pos, int len) {
|
||||
display_loader(250 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_loader(250 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_upload(int pos) {
|
||||
display_loader(pos, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_loader(pos, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
}
|
||||
|
||||
// wipe UI
|
||||
|
||||
void ui_screen_wipe(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_wipe,
|
||||
sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_loader(0, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG, toi_icon_wipe,
|
||||
sizeof(toi_icon_wipe), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping device", -1,
|
||||
FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
void ui_screen_wipe_progress(int pos, int len) {
|
||||
display_loader(1000 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_WHITE,
|
||||
toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
display_loader(1000 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BL_FG);
|
||||
}
|
||||
|
||||
// done UI
|
||||
@ -94,26 +99,26 @@ void ui_screen_done(int restart_seconds, secbool full_redraw) {
|
||||
str = "Done! Unplug the device.";
|
||||
}
|
||||
if (sectrue == full_redraw) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
}
|
||||
display_loader(1000, false, -20, COLOR_BL_DONE, COLOR_WHITE, toi_icon_done,
|
||||
sizeof(toi_icon_done), COLOR_BLACK);
|
||||
display_loader(1000, false, -20, COLOR_BL_DONE, COLOR_BL_BG, toi_icon_done,
|
||||
sizeof(toi_icon_done), COLOR_BL_FG);
|
||||
if (secfalse == full_redraw) {
|
||||
display_bar(0, DISPLAY_RESY - 24 - 18, 240, 23, COLOR_WHITE);
|
||||
display_bar(0, DISPLAY_RESY - 24 - 18, 240, 23, COLOR_BL_BG);
|
||||
}
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, str, -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
// error UI
|
||||
|
||||
void ui_screen_fail(void) {
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(1000, false, -20, COLOR_BL_FAIL, COLOR_WHITE, toi_icon_fail,
|
||||
sizeof(toi_icon_fail), COLOR_BLACK);
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_BL_BG);
|
||||
display_loader(1000, false, -20, COLOR_BL_FAIL, COLOR_BL_BG, toi_icon_fail,
|
||||
sizeof(toi_icon_fail), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Failed! Please, reconnect.", -1, FONT_NORMAL,
|
||||
COLOR_BLACK, COLOR_WHITE);
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
}
|
||||
|
||||
// general functions
|
||||
|
Loading…
Reference in New Issue
Block a user