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

feat(core): set colors for monochromatic displays

This commit is contained in:
tychovrahe 2022-04-29 10:38:30 +02:00 committed by matejcik
parent 0e778cf16d
commit 58041036f5
5 changed files with 32 additions and 5 deletions

View File

@ -46,10 +46,18 @@
#define COLOR_BL_BG COLOR_WHITE // background
#define COLOR_BL_FG COLOR_BLACK // foreground
#ifdef RGB16
#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
#else
#define COLOR_BL_FAIL COLOR_BL_FG
#define COLOR_BL_DONE COLOR_BL_FG
#define COLOR_BL_PROCESS COLOR_BL_FG
#define COLOR_BL_GRAY COLOR_BL_FG
#endif
#define COLOR_WELCOME_BG COLOR_WHITE // welcome background
#define COLOR_WELCOME_FG COLOR_BLACK // welcome foreground
@ -84,7 +92,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 = RGB16(0xFF, 0x00, 0x00); // red
boot_background = COLOR_BL_FAIL;
} else {
boot_background = COLOR_BLACK;
}

View File

@ -32,9 +32,16 @@
#define COLOR_BL_BG COLOR_WHITE // background
#define COLOR_BL_FG COLOR_BLACK // foreground
#ifdef RGB16
#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
#else
#define COLOR_BL_FAIL COLOR_BL_FG
#define COLOR_BL_DONE COLOR_BL_FG
#define COLOR_BL_PROCESS COLOR_BL_FG
#endif
#define COLOR_WELCOME_BG COLOR_WHITE // welcome background
#define COLOR_WELCOME_FG COLOR_BLACK // welcome foreground

View File

@ -55,7 +55,10 @@
#define AVATAR_IMAGE_SIZE 144
#define LOADER_ICON_SIZE 64
#ifdef TREZOR_MODEL_T
#define RGB16(R, G, B) ((R & 0xF8) << 8) | ((G & 0xFC) << 3) | ((B & 0xF8) >> 3)
#endif
#define COLOR_WHITE 0xFFFF
#define COLOR_BLACK 0x0000

View File

@ -29,7 +29,11 @@
#include "stm32f4xx_ll_utils.h"
#ifdef RGB16
#define COLOR_FATAL_ERROR RGB16(0x7F, 0x00, 0x00)
#else
#define COLOR_FATAL_ERROR COLOR_BLACK
#endif
// from util.s
extern void shutdown_privileged(void);

View File

@ -32,7 +32,12 @@ void __shutdown(void) {
main_clean_exit(3);
}
#ifdef RGB16
#define COLOR_FATAL_ERROR RGB16(0x7F, 0x00, 0x00)
#else
// black on monochromatic displays
#define COLOR_FATAL_ERROR 0x0000
#endif
void __attribute__((noreturn))
__fatal_error(const char *expr, const char *msg, const char *file, int line,