feat(core): set colors for monochromatic displays

pull/2263/head
tychovrahe 2 years ago committed by matejcik
parent 0e778cf16d
commit 58041036f5

@ -44,12 +44,20 @@
#define BACKLIGHT_NORMAL 150
#define COLOR_BL_BG COLOR_WHITE // background
#define COLOR_BL_FG COLOR_BLACK // foreground
#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;
}

@ -30,11 +30,18 @@
#define BACKLIGHT_NORMAL 150
#define COLOR_BL_BG COLOR_WHITE // background
#define COLOR_BL_FG COLOR_BLACK // foreground
#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

@ -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

@ -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);

@ -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,

Loading…
Cancel
Save