mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-19 01:26:06 +00:00
feat(core): change display type for model R
[no changelog]
This commit is contained in:
parent
a9ad39b88d
commit
0d733d8e22
@ -1,6 +1,7 @@
|
||||
# pylint: disable=E0602
|
||||
|
||||
import os
|
||||
import tools
|
||||
|
||||
TREZOR_MODEL = ARGUMENTS.get('TREZOR_MODEL', 'T')
|
||||
|
||||
@ -51,7 +52,6 @@ CPPPATH_MOD += [
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
f'embed/extmod/modtrezorui/display-stm32_{TREZOR_MODEL}.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/fonts/font_bitmap.c',
|
||||
]
|
||||
@ -101,6 +101,8 @@ SOURCE_TREZORHAL = [
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
|
||||
|
||||
tools.configure_board(TREZOR_MODEL, env, CPPDEFINES_MOD, SOURCE_TREZORHAL)
|
||||
|
||||
env.Replace(
|
||||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
|
@ -69,7 +69,6 @@ SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/buffers.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
f'embed/extmod/modtrezorui/display-stm32_{TREZOR_MODEL}.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/fonts/font_bitmap.c',
|
||||
'vendor/micropython/lib/uzlib/adler32.c',
|
||||
@ -155,6 +154,8 @@ tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
|
||||
|
||||
tools.configure_board(TREZOR_MODEL, env, CPPDEFINES_MOD, SOURCE_TREZORHAL)
|
||||
|
||||
env.Replace(
|
||||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
|
@ -66,7 +66,6 @@ CPPPATH_MOD += [
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
f'embed/extmod/modtrezorui/display-stm32_{TREZOR_MODEL}.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/fonts/font_bitmap.c',
|
||||
'vendor/micropython/lib/uzlib/adler32.c',
|
||||
@ -138,6 +137,8 @@ tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
|
||||
|
||||
tools.configure_board(TREZOR_MODEL, env, CPPDEFINES_MOD, SOURCE_TREZORHAL)
|
||||
|
||||
env.Replace(
|
||||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
|
@ -175,7 +175,6 @@ SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/buffers.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
f'embed/extmod/modtrezorui/display-stm32_{TREZOR_MODEL}.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/fonts/font_bitmap.c',
|
||||
'embed/extmod/modtrezorui/modtrezorui.c',
|
||||
@ -434,6 +433,8 @@ SOURCE_QSTR = SOURCE_MOD + SOURCE_MICROPYTHON + SOURCE_MICROPYTHON_SPEED
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s -DPYOPT=%s -DBITCOIN_ONLY=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0'), PYOPT, BITCOIN_ONLY))
|
||||
|
||||
tools.configure_board(TREZOR_MODEL, env, CPPDEFINES_MOD, SOURCE_TREZORHAL)
|
||||
|
||||
env.Tool('micropython')
|
||||
|
||||
env.Replace(
|
||||
@ -449,7 +450,7 @@ env.Replace(
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=TREZOR_MODEL, )
|
||||
TREZOR_MODEL=TREZOR_MODEL,)
|
||||
|
||||
if TREZOR_MODEL in ('T', 'R'):
|
||||
CPU_ASFLAGS = '-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16'
|
||||
@ -731,6 +732,8 @@ def cargo_build():
|
||||
'-Z build-std-features=panic_immediate_abort',
|
||||
]
|
||||
|
||||
env.get('ENV')['TREZOR_MODEL'] = TREZOR_MODEL
|
||||
|
||||
return f'cd embed/rust; cargo build {profile} ' + ' '.join(cargo_opts)
|
||||
|
||||
rust = env.Command(
|
||||
|
@ -41,7 +41,6 @@ CPPPATH_MOD += [
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
f'embed/extmod/modtrezorui/display-stm32_{TREZOR_MODEL}.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/fonts/font_bitmap.c',
|
||||
'embed/extmod/modtrezorui/qr-code-generator/qrcodegen.c',
|
||||
@ -107,6 +106,8 @@ tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
|
||||
|
||||
tools.configure_board(TREZOR_MODEL, env, CPPDEFINES_MOD, SOURCE_TREZORHAL)
|
||||
|
||||
env.Replace(
|
||||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
|
@ -36,7 +36,6 @@ CPPPATH_MOD += [
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
f'embed/extmod/modtrezorui/display-stm32_{TREZOR_MODEL}.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/font_bitmap.c',
|
||||
'vendor/micropython/lib/uzlib/adler32.c',
|
||||
@ -100,6 +99,8 @@ tools.add_font('MONO', FONT_MONO, CPPDEFINES_MOD, SOURCE_MOD)
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0')))
|
||||
|
||||
tools.configure_board(TREZOR_MODEL, env, CPPDEFINES_MOD, SOURCE_TREZORHAL)
|
||||
|
||||
env.Replace(
|
||||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
|
@ -171,7 +171,6 @@ SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorui/buffers.c',
|
||||
'embed/extmod/modtrezorui/colors.c',
|
||||
'embed/extmod/modtrezorui/display.c',
|
||||
'embed/extmod/modtrezorui/display-unix.c',
|
||||
'embed/extmod/modtrezorui/fonts/fonts.c',
|
||||
'embed/extmod/modtrezorui/fonts/font_bitmap.c',
|
||||
'embed/extmod/modtrezorui/modtrezorui.c',
|
||||
@ -333,6 +332,7 @@ SOURCE_MICROPYTHON = [
|
||||
|
||||
SOURCE_UNIX = [
|
||||
'embed/unix/common.c',
|
||||
'embed/unix/display-unix.c',
|
||||
'embed/unix/flash.c',
|
||||
'embed/unix/main.c',
|
||||
'embed/unix/main_main.c',
|
||||
@ -445,6 +445,7 @@ env.Replace(
|
||||
CPPDEFINES=[
|
||||
'TREZOR_EMULATOR',
|
||||
'TREZOR_MODEL_'+TREZOR_MODEL,
|
||||
'TREZOR_BOARD=\\"board-unix.h\\"',
|
||||
('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
ASPPFLAGS='$CFLAGS $CCFLAGS', )
|
||||
@ -676,6 +677,8 @@ def cargo_build():
|
||||
if DMA2D:
|
||||
features.append('dma2d')
|
||||
|
||||
env.get('ENV')['TREZOR_MODEL'] = TREZOR_MODEL
|
||||
|
||||
return f'cd embed/rust; cargo build --profile {RUST_PROFILE} --target-dir=../../build/unix/rust --no-default-features --features "{" ".join(features)}" --target {TARGET}'
|
||||
|
||||
rust = env.Command(
|
||||
|
@ -119,6 +119,9 @@ void ui_screen_boot(const vendor_header *const vhdr,
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 25, ver_str, -1,
|
||||
FONT_NORMAL, COLOR_BL_BG, boot_background);
|
||||
}
|
||||
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_boot_wait(int wait_seconds) {
|
||||
@ -127,6 +130,8 @@ 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();
|
||||
}
|
||||
|
||||
void ui_screen_boot_click(void) {
|
||||
@ -134,6 +139,8 @@ 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();
|
||||
}
|
||||
|
||||
// welcome UI
|
||||
@ -141,6 +148,8 @@ 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_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_welcome_second(void) {
|
||||
@ -148,6 +157,8 @@ void ui_screen_welcome_second(void) {
|
||||
display_icon((DISPLAY_RESX - 200) / 2, (DISPLAY_RESY - 60) / 2, 200, 60,
|
||||
toi_icon_safeplace + 12, sizeof(toi_icon_safeplace) - 12,
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_welcome_third(void) {
|
||||
@ -157,6 +168,8 @@ void ui_screen_welcome_third(void) {
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_WELCOME_FG, COLOR_WELCOME_BG);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
// info UI
|
||||
@ -176,6 +189,8 @@ static int display_vendor_string(const char *text, int textlen,
|
||||
COLOR_BL_BG);
|
||||
return 145;
|
||||
}
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_firmware_info(const vendor_header *const vhdr,
|
||||
@ -196,6 +211,8 @@ void ui_screen_firmware_info(const vendor_header *const vhdr,
|
||||
}
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL,
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_firmware_fingerprint(const image_header *const hdr) {
|
||||
@ -219,6 +236,8 @@ void ui_screen_firmware_fingerprint(const image_header *const hdr) {
|
||||
display_icon(9 + (222 - 19) / 2, 184 + (50 - 16) / 2, 20, 16,
|
||||
toi_icon_confirm + 12, sizeof(toi_icon_confirm) - 12,
|
||||
COLOR_BL_BG, COLOR_BL_DONE);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
// install UI
|
||||
@ -237,6 +256,8 @@ void ui_screen_install_confirm_upgrade(const vendor_header *const vhdr,
|
||||
const char *ver_str = format_ver("to version %d.%d.%d?", hdr->version);
|
||||
display_text(55, next_y, ver_str, -1, FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
ui_confirm_cancel_buttons();
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_install_confirm_newvendor_or_downgrade_wipe(
|
||||
@ -258,6 +279,8 @@ void ui_screen_install_confirm_newvendor_or_downgrade_wipe(
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL,
|
||||
COLOR_BL_FAIL, COLOR_BL_BG);
|
||||
ui_confirm_cancel_buttons();
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_install_start(void) {
|
||||
@ -267,16 +290,24 @@ void ui_screen_install_start(void) {
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Installing firmware", -1, FONT_NORMAL, COLOR_BL_FG,
|
||||
COLOR_BL_BG);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_erase(int pos, int len) {
|
||||
display_loader(250 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_upload(int pos) {
|
||||
display_loader(pos, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_install, sizeof(toi_icon_install), COLOR_BL_FG);
|
||||
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
// wipe UI
|
||||
@ -296,6 +327,8 @@ void ui_screen_wipe_confirm(void) {
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL,
|
||||
COLOR_BL_FAIL, COLOR_BL_BG);
|
||||
ui_confirm_cancel_buttons();
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_wipe(void) {
|
||||
@ -304,11 +337,16 @@ void ui_screen_wipe(void) {
|
||||
sizeof(toi_icon_wipe), COLOR_BL_FG);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping device", -1,
|
||||
FONT_NORMAL, COLOR_BL_FG, COLOR_BL_BG);
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void ui_screen_wipe_progress(int pos, int len) {
|
||||
display_loader(1000 * pos / len, false, -20, COLOR_BL_PROCESS, COLOR_BL_BG,
|
||||
toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BL_FG);
|
||||
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
// done UI
|
||||
@ -333,6 +371,9 @@ void ui_screen_done(int restart_seconds, secbool full_redraw) {
|
||||
}
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, str, -1, FONT_NORMAL,
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
// error UI
|
||||
@ -344,6 +385,9 @@ void ui_screen_fail(void) {
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24,
|
||||
"Failed! Please, reconnect.", -1, FONT_NORMAL,
|
||||
COLOR_BL_FG, COLOR_BL_BG);
|
||||
|
||||
PIXELDATA_DIRTY();
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
// general functions
|
||||
|
@ -255,6 +255,8 @@ int main(void) {
|
||||
dma2d_init();
|
||||
#endif
|
||||
|
||||
display_reinit();
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
set_core_clock(CLOCK_180_MHZ);
|
||||
display_set_little_endian();
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "display_defs.h"
|
||||
#include TREZOR_BOARD
|
||||
|
||||
#define BUFFER_PIXELS DISPLAY_RESX
|
||||
|
||||
@ -56,4 +56,4 @@ line_buffer_16bpp_t* buffers_get_line_buffer_16bpp(uint16_t idx, bool clear);
|
||||
line_buffer_4bpp_t* buffers_get_line_buffer_4bpp(uint16_t idx, bool clear);
|
||||
buffer_text_t* buffers_get_text_buffer(uint16_t idx, bool clear);
|
||||
|
||||
#endif //_BUFFERS_H
|
||||
#endif // _BUFFERS_H
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include "buffers.h"
|
||||
#include "colors.h"
|
||||
#include "display_defs.h"
|
||||
#include TREZOR_BOARD
|
||||
#include "display_interface.h"
|
||||
#include "fonts/fonts.h"
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _DISPLAY_DEFS_H
|
||||
#define _DISPLAY_DEFS_H
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
|
||||
// ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution
|
||||
#define MAX_DISPLAY_RESX 240
|
||||
#define MAX_DISPLAY_RESY 320
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 240
|
||||
#define TREZOR_FONT_BPP 4
|
||||
|
||||
#elif defined TREZOR_MODEL_1
|
||||
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 64
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 64
|
||||
#define TREZOR_FONT_BPP 1
|
||||
|
||||
#elif defined TREZOR_MODEL_R
|
||||
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 128
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 128
|
||||
#define TREZOR_FONT_BPP 1
|
||||
|
||||
#else
|
||||
#error Unknown Trezor model
|
||||
#endif
|
||||
|
||||
#endif //_DISPLAY_DEFS_H
|
@ -22,36 +22,15 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common.h"
|
||||
#include TREZOR_BOARD
|
||||
|
||||
#if !defined TREZOR_EMULATOR
|
||||
#include STM32_HAL_H
|
||||
#endif
|
||||
|
||||
#if (defined TREZOR_MODEL_T) && !(defined TREZOR_EMULATOR)
|
||||
|
||||
extern __IO uint8_t *const DISPLAY_CMD_ADDRESS;
|
||||
extern __IO uint8_t *const DISPLAY_DATA_ADDRESS;
|
||||
|
||||
#define CMD(X) (*DISPLAY_CMD_ADDRESS = (X))
|
||||
#define DATA(X) (*DISPLAY_DATA_ADDRESS = (X))
|
||||
#define PIXELDATA(X) \
|
||||
DATA((X)&0xFF); \
|
||||
DATA((X) >> 8)
|
||||
|
||||
#else
|
||||
#ifndef PIXELDATA
|
||||
#define PIXELDATA(c) display_pixeldata(c)
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_EMULATOR
|
||||
extern uint8_t *const DISPLAY_DATA_ADDRESS;
|
||||
#endif
|
||||
|
||||
void display_pixeldata(uint16_t c);
|
||||
|
||||
#if (defined TREZOR_MODEL_1) && !(defined TREZOR_EMULATOR)
|
||||
void PIXELDATA_DIRTY();
|
||||
#else
|
||||
// noop
|
||||
#ifndef PIXELDATA_DIRTY
|
||||
#define PIXELDATA_DIRTY()
|
||||
#endif
|
||||
|
||||
@ -63,13 +42,9 @@ int display_get_orientation(void);
|
||||
int display_backlight(int val);
|
||||
|
||||
void display_init(void);
|
||||
void display_reinit(void);
|
||||
void display_refresh(void);
|
||||
const char *display_save(const char *prefix);
|
||||
void display_clear_save(void);
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
void display_set_little_endian(void);
|
||||
void display_set_big_endian(void);
|
||||
#endif
|
||||
|
||||
#endif //_DISPLAY_INTERFACE_H
|
||||
|
@ -109,26 +109,25 @@ int main(void) {
|
||||
SCB->SHCSR |= (SCB_SHCSR_USGFAULTENA_Msk | SCB_SHCSR_BUSFAULTENA_Msk);
|
||||
#endif
|
||||
|
||||
display_reinit();
|
||||
|
||||
#if defined TREZOR_MODEL_1
|
||||
display_init();
|
||||
display_clear();
|
||||
button_init();
|
||||
#endif
|
||||
|
||||
#if defined TREZOR_MODEL_R
|
||||
button_init();
|
||||
display_clear();
|
||||
rgb_led_init();
|
||||
#endif
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
set_core_clock(CLOCK_180_MHZ);
|
||||
touch_init();
|
||||
display_set_little_endian();
|
||||
sdcard_init();
|
||||
display_clear();
|
||||
#endif
|
||||
|
||||
display_clear();
|
||||
|
||||
#if !defined TREZOR_MODEL_1
|
||||
// jump to unprivileged mode
|
||||
// http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/CHDBIBGJ.html
|
||||
|
@ -378,6 +378,7 @@ int main(void) {
|
||||
sbu_init();
|
||||
usb_init_all();
|
||||
|
||||
display_reinit();
|
||||
display_clear();
|
||||
draw_border(1, 3);
|
||||
|
||||
|
@ -19,6 +19,19 @@ fn model() -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn board() -> String {
|
||||
if !is_firmware() {
|
||||
return String::from("board-unix.h");
|
||||
}
|
||||
|
||||
match env::var("TREZOR_BOARD") {
|
||||
Ok(board) => {
|
||||
format!("boards/{}", board)
|
||||
}
|
||||
Err(_) => String::from("boards/trezor_t.h"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Generates Rust module that exports QSTR constants used in firmware.
|
||||
#[cfg(feature = "micropython")]
|
||||
fn generate_qstr_bindings() {
|
||||
@ -64,6 +77,7 @@ fn prepare_bindings() -> bindgen::Builder {
|
||||
"-I../../vendor/micropython/lib/uzlib",
|
||||
"-I../extmod/modtrezorui", // for display.h
|
||||
format!("-DTREZOR_MODEL_{}", model()).as_str(),
|
||||
format!("-DTREZOR_BOARD=\"{}\"", board()).as_str(),
|
||||
]);
|
||||
|
||||
// Pass in correct include paths and defines.
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include TREZOR_BOARD
|
||||
#include "buffers.h"
|
||||
#include "common.h"
|
||||
#include "display.h"
|
||||
|
33
core/embed/trezorhal/boards/trezor_1.h
Normal file
33
core/embed/trezorhal/boards/trezor_1.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef _TREZOR_1_H
|
||||
#define _TREZOR_1_H
|
||||
|
||||
#include "displays/vg-2864ksweg01.h"
|
||||
|
||||
#define BTN_LEFT_PIN GPIO_PIN_5
|
||||
#define BTN_LEFT_PORT GPIOC
|
||||
#define BTN_LEFT_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
#define BTN_RIGHT_PIN GPIO_PIN_2
|
||||
#define BTN_RIGHT_PORT GPIOC
|
||||
#define BTN_RIGHT_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
|
||||
#define OLED_DC_PORT GPIOB
|
||||
#define OLED_DC_PIN GPIO_PIN_0 // PB0 | Data/Command
|
||||
#define OLED_DC_CLK_ENA __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
#define OLED_CS_PORT GPIOA
|
||||
#define OLED_CS_PIN GPIO_PIN_4 // PA4 | SPI Select
|
||||
#define OLED_CS_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define OLED_RST_PORT GPIOB
|
||||
#define OLED_RST_PIN GPIO_PIN_1 // PB1 | Reset display
|
||||
#define OLED_RST_CLK_ENA __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
|
||||
#define OLED_SPI SPI1
|
||||
#define OLED_SPI_AF GPIO_AF5_SPI1
|
||||
#define OLED_SPI_CLK_ENA __HAL_RCC_SPI1_CLK_ENABLE
|
||||
#define OLED_SPI_SCK_PORT GPIOA
|
||||
#define OLED_SPI_SCK_PIN GPIO_PIN_5 // PA5 | SPI SCK
|
||||
#define OLED_SPI_SCK_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define OLED_SPI_MOSI_PORT GPIOA
|
||||
#define OLED_SPI_MOSI_PIN GPIO_PIN_7 // PA7 | SPI MOSI
|
||||
#define OLED_SPI_MOSI_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_1_H
|
13
core/embed/trezorhal/boards/trezor_r_v3.h
Normal file
13
core/embed/trezorhal/boards/trezor_r_v3.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef _TREZOR_R_V3_H
|
||||
#define _TREZOR_R_V3_H
|
||||
|
||||
#include "displays/ug-2828tswig01.h"
|
||||
|
||||
#define BTN_LEFT_PIN GPIO_PIN_0
|
||||
#define BTN_LEFT_PORT GPIOA
|
||||
#define BTN_LEFT_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define BTN_RIGHT_PIN GPIO_PIN_15
|
||||
#define BTN_RIGHT_PORT GPIOE
|
||||
#define BTN_RIGHT_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_R_V3_H
|
33
core/embed/trezorhal/boards/trezor_r_v4.h
Normal file
33
core/embed/trezorhal/boards/trezor_r_v4.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef _TREZOR_R_V4_H
|
||||
#define _TREZOR_R_V4_H
|
||||
|
||||
#include "displays/vg-2864ksweg01.h"
|
||||
|
||||
#define BTN_LEFT_PIN GPIO_PIN_5
|
||||
#define BTN_LEFT_PORT GPIOC
|
||||
#define BTN_LEFT_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
#define BTN_RIGHT_PIN GPIO_PIN_10
|
||||
#define BTN_RIGHT_PORT GPIOB
|
||||
#define BTN_RIGHT_CLK_ENA __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
|
||||
#define OLED_DC_PORT GPIOD
|
||||
#define OLED_DC_PIN GPIO_PIN_0 // PD0 | Data/Command
|
||||
#define OLED_DC_CLK_ENA __HAL_RCC_GPIOD_CLK_ENABLE
|
||||
#define OLED_CS_PORT GPIOE
|
||||
#define OLED_CS_PIN GPIO_PIN_4 // PE4 | SPI Select
|
||||
#define OLED_CS_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
#define OLED_RST_PORT GPIOD
|
||||
#define OLED_RST_PIN GPIO_PIN_1 // PD1 | Reset display
|
||||
#define OLED_RST_CLK_ENA __HAL_RCC_GPIOD_CLK_ENABLE
|
||||
|
||||
#define OLED_SPI SPI4
|
||||
#define OLED_SPI_AF GPIO_AF5_SPI4
|
||||
#define OLED_SPI_CLK_ENA __HAL_RCC_SPI4_CLK_ENABLE
|
||||
#define OLED_SPI_SCK_PORT GPIOE
|
||||
#define OLED_SPI_SCK_PIN GPIO_PIN_2 // PE2 | SPI SCK
|
||||
#define OLED_SPI_SCK_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
#define OLED_SPI_MOSI_PORT GPIOE
|
||||
#define OLED_SPI_MOSI_PIN GPIO_PIN_6 // PE6 | SPI MOSI
|
||||
#define OLED_SPI_MOSI_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_R_V4_H
|
6
core/embed/trezorhal/boards/trezor_t.h
Normal file
6
core/embed/trezorhal/boards/trezor_t.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _TREZOR_T_H
|
||||
#define _TREZOR_T_H
|
||||
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
#endif //_TREZOR_T_H
|
@ -1,23 +1,6 @@
|
||||
#include STM32_HAL_H
|
||||
#include "button.h"
|
||||
|
||||
#if defined TREZOR_MODEL_1
|
||||
#define BTN_LEFT_PIN GPIO_PIN_5
|
||||
#define BTN_LEFT_PORT GPIOC
|
||||
#define BTN_LEFT_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
#define BTN_RIGHT_PIN GPIO_PIN_2
|
||||
#define BTN_RIGHT_PORT GPIOC
|
||||
#define BTN_RIGHT_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
#elif defined TREZOR_MODEL_R
|
||||
#define BTN_LEFT_PIN GPIO_PIN_0
|
||||
#define BTN_LEFT_PORT GPIOA
|
||||
#define BTN_LEFT_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define BTN_RIGHT_PIN GPIO_PIN_15
|
||||
#define BTN_RIGHT_PORT GPIOE
|
||||
#define BTN_RIGHT_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
#else
|
||||
#error Unknown Trezor model
|
||||
#endif
|
||||
#include TREZOR_BOARD
|
||||
|
||||
static char last_left = 0, last_right = 0;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "display_defs.h"
|
||||
#include TREZOR_BOARD
|
||||
#include "display_interface.h"
|
||||
#include "memzero.h"
|
||||
#include STM32_HAL_H
|
||||
@ -601,6 +601,11 @@ void display_init(void) {
|
||||
display_set_little_endian();
|
||||
}
|
||||
|
||||
void display_reinit(void) {
|
||||
// important for model T as this is not set in boardloader
|
||||
display_set_little_endian();
|
||||
}
|
||||
|
||||
void display_refresh(void) {
|
||||
uint32_t id = display_identify();
|
||||
if (id && (id != DISPLAY_ID_GC9307)) {
|
25
core/embed/trezorhal/displays/st7789v.h
Normal file
25
core/embed/trezorhal/displays/st7789v.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _ST7789V_H
|
||||
#define _ST7789V_H
|
||||
|
||||
#include STM32_HAL_H
|
||||
|
||||
// ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution
|
||||
#define MAX_DISPLAY_RESX 240
|
||||
#define MAX_DISPLAY_RESY 320
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 240
|
||||
#define TREZOR_FONT_BPP 4
|
||||
|
||||
extern __IO uint8_t *const DISPLAY_CMD_ADDRESS;
|
||||
extern __IO uint8_t *const DISPLAY_DATA_ADDRESS;
|
||||
|
||||
#define CMD(X) (*DISPLAY_CMD_ADDRESS = (X))
|
||||
#define DATA(X) (*DISPLAY_DATA_ADDRESS = (X))
|
||||
#define PIXELDATA(X) \
|
||||
DATA((X)&0xFF); \
|
||||
DATA((X) >> 8)
|
||||
|
||||
void display_set_little_endian(void);
|
||||
void display_set_big_endian(void);
|
||||
|
||||
#endif //_ST7789V_H
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "display_defs.h"
|
||||
#include TREZOR_BOARD
|
||||
#include "display_interface.h"
|
||||
#include "memzero.h"
|
||||
#include STM32_HAL_H
|
||||
@ -356,6 +356,8 @@ void display_refresh(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void display_reinit(void) {}
|
||||
|
||||
const char *display_save(const char *prefix) { return NULL; }
|
||||
|
||||
void display_clear_save(void) {}
|
10
core/embed/trezorhal/displays/ug-2828tswig01.h
Normal file
10
core/embed/trezorhal/displays/ug-2828tswig01.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef _UG_2828TSWIG01_H
|
||||
#define _UG_2828TSWIG01_H
|
||||
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 128
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 128
|
||||
#define TREZOR_FONT_BPP 1
|
||||
|
||||
#endif //_UG_2828TSWIG01_H
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "display_defs.h"
|
||||
#include TREZOR_BOARD
|
||||
#include "display_interface.h"
|
||||
#include STM32_HAL_H
|
||||
|
||||
@ -49,13 +49,6 @@
|
||||
#define OLED_SEGREMAP 0xA0
|
||||
#define OLED_CHARGEPUMP 0x8D
|
||||
|
||||
#define OLED_DC_PORT GPIOB
|
||||
#define OLED_DC_PIN GPIO_PIN_0 // PB0 | Data/Command
|
||||
#define OLED_CS_PORT GPIOA
|
||||
#define OLED_CS_PIN GPIO_PIN_4 // PA4 | SPI Select
|
||||
#define OLED_RST_PORT GPIOB
|
||||
#define OLED_RST_PIN GPIO_PIN_1 // PB1 | Reset display
|
||||
|
||||
static int DISPLAY_BACKLIGHT = -1;
|
||||
static int DISPLAY_ORIENTATION = -1;
|
||||
static uint8_t OLED_BUFFER[OLED_BUFSIZE];
|
||||
@ -72,7 +65,7 @@ static struct {
|
||||
} pos;
|
||||
} PIXELWINDOW;
|
||||
|
||||
static bool pixeldata_dirty = true;
|
||||
static bool pixeldata_dirty_flag = true;
|
||||
|
||||
void display_pixeldata(uint16_t c) {
|
||||
if (PIXELWINDOW.pos.x <= PIXELWINDOW.end.x &&
|
||||
@ -99,7 +92,7 @@ void display_pixeldata(uint16_t c) {
|
||||
|
||||
void display_reset_state() {}
|
||||
|
||||
void PIXELDATA_DIRTY() { pixeldata_dirty = true; }
|
||||
void pixeldata_dirty(void) { pixeldata_dirty_flag = true; }
|
||||
|
||||
void display_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
|
||||
PIXELWINDOW.start.x = x0;
|
||||
@ -140,9 +133,12 @@ static inline void spi_send(const uint8_t *data, int len) {
|
||||
}
|
||||
|
||||
void display_init(void) {
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_SPI1_CLK_ENABLE();
|
||||
OLED_DC_CLK_ENA();
|
||||
OLED_CS_CLK_ENA();
|
||||
OLED_RST_CLK_ENA();
|
||||
OLED_SPI_SCK_CLK_ENA();
|
||||
OLED_SPI_MOSI_CLK_ENA();
|
||||
OLED_SPI_CLK_ENA();
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
@ -151,22 +147,27 @@ void display_init(void) {
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStructure.Alternate = 0;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_4;
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_4;
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0 | GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = OLED_CS_PIN;
|
||||
HAL_GPIO_WritePin(OLED_CS_PORT, OLED_CS_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_Init(OLED_CS_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = OLED_DC_PIN;
|
||||
HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_Init(OLED_DC_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = OLED_RST_PIN;
|
||||
HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_Init(OLED_RST_PORT, &GPIO_InitStructure);
|
||||
|
||||
// enable SPI 1 for OLED display
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStructure.Alternate = GPIO_AF5_SPI1;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_5 | GPIO_PIN_7;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Alternate = OLED_SPI_AF;
|
||||
GPIO_InitStructure.Pin = OLED_SPI_SCK_PIN;
|
||||
HAL_GPIO_Init(OLED_SPI_SCK_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = OLED_SPI_MOSI_PIN;
|
||||
HAL_GPIO_Init(OLED_SPI_MOSI_PORT, &GPIO_InitStructure);
|
||||
|
||||
spi_handle.Instance = SPI1;
|
||||
spi_handle.Instance = OLED_SPI;
|
||||
spi_handle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
|
||||
spi_handle.Init.Direction = SPI_DIRECTION_2LINES;
|
||||
spi_handle.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||
@ -229,6 +230,8 @@ void display_init(void) {
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void display_reinit(void) { display_init(); }
|
||||
|
||||
static inline uint8_t reverse_byte(uint8_t b) {
|
||||
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
|
||||
b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
|
||||
@ -249,10 +252,10 @@ void display_refresh(void) {
|
||||
OLED_SETHIGHCOLUMN | 0x00,
|
||||
OLED_SETSTARTLINE | 0x00};
|
||||
|
||||
if (!pixeldata_dirty) {
|
||||
if (!pixeldata_dirty_flag) {
|
||||
return;
|
||||
}
|
||||
pixeldata_dirty = false;
|
||||
pixeldata_dirty_flag = false;
|
||||
|
||||
HAL_GPIO_WritePin(OLED_CS_PORT, OLED_CS_PIN, GPIO_PIN_RESET); // SPI select
|
||||
spi_send(s, 3);
|
13
core/embed/trezorhal/displays/vg-2864ksweg01.h
Normal file
13
core/embed/trezorhal/displays/vg-2864ksweg01.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef _VG_2864KSWEG01_H
|
||||
#define _VG_2864KSWEG01_H
|
||||
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 64
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 64
|
||||
#define TREZOR_FONT_BPP 1
|
||||
|
||||
void pixeldata_dirty(void);
|
||||
#define PIXELDATA_DIRTY() pixeldata_dirty();
|
||||
|
||||
#endif //_VG_2864KSWEG01_H
|
6
core/embed/unix/board-unix.h
Normal file
6
core/embed/unix/board-unix.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _BOARD_UNIX_H
|
||||
#define _BOARD_UNIX_H
|
||||
|
||||
#include "display-unix.h"
|
||||
|
||||
#endif //_BOARD_UNIX_H
|
@ -29,7 +29,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "display_defs.h"
|
||||
#include "display-unix.h"
|
||||
#include "display_interface.h"
|
||||
#include "profile.h"
|
||||
|
33
core/embed/unix/display-unix.h
Normal file
33
core/embed/unix/display-unix.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef _DISPLAY_UNIX_H
|
||||
#define _DISPLAY_UNIX_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef TREZOR_MODEL_T
|
||||
// ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution
|
||||
#define MAX_DISPLAY_RESX 240
|
||||
#define MAX_DISPLAY_RESY 320
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 240
|
||||
#define TREZOR_FONT_BPP 4
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_MODEL_R
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 64
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 64
|
||||
#define TREZOR_FONT_BPP 1
|
||||
#endif
|
||||
|
||||
#ifdef TREZOR_MODEL_1
|
||||
#define MAX_DISPLAY_RESX 128
|
||||
#define MAX_DISPLAY_RESY 64
|
||||
#define DISPLAY_RESX 128
|
||||
#define DISPLAY_RESY 64
|
||||
#define TREZOR_FONT_BPP 1
|
||||
#endif
|
||||
|
||||
extern uint8_t *const DISPLAY_DATA_ADDRESS;
|
||||
|
||||
#endif //_DISPLAY_UNIX_H
|
@ -1,11 +1,33 @@
|
||||
|
||||
def add_font(font_name, font, defines, sources):
|
||||
if font is not None:
|
||||
defines += [
|
||||
'TREZOR_FONT_' + font_name + '_ENABLE=' + font,
|
||||
'TREZOR_FONT_' + font_name + '_INCLUDE=\\"' + font.lower() + '.h\\"',
|
||||
]
|
||||
]
|
||||
sourcefile = 'embed/extmod/modtrezorui/fonts/' + font.lower() + '.c'
|
||||
if sourcefile not in sources:
|
||||
sources.append(sourcefile)
|
||||
|
||||
|
||||
def configure_board(model, env, defines, sources):
|
||||
model_r_version = 4
|
||||
|
||||
if model in ('1',):
|
||||
board = 'trezor_1.h'
|
||||
display = 'vg-2864ksweg01.c'
|
||||
elif model in ('T',):
|
||||
board = 'trezor_t.h'
|
||||
display = 'st7789v.c'
|
||||
elif model in ('R',):
|
||||
if model_r_version == 3:
|
||||
board = 'trezor_r_v3.h'
|
||||
display = "ug-2828tswig01.c"
|
||||
else:
|
||||
board = 'trezor_r_v4.h'
|
||||
display = 'vg-2864ksweg01.c'
|
||||
else:
|
||||
raise Exception("Unknown model")
|
||||
|
||||
defines += [f'TREZOR_BOARD=\\"boards/{board}\\"', ]
|
||||
sources += [f'embed/trezorhal/displays/{display}', ]
|
||||
env.get('ENV')['TREZOR_BOARD'] = board
|
||||
|
Loading…
Reference in New Issue
Block a user