mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-24 07:28:34 +00:00
feat(core): add hardware support for T3W1
This commit is contained in:
parent
e83487d6b9
commit
1b677d77ae
@ -254,7 +254,7 @@ def cargo_build():
|
||||
else:
|
||||
features = ["model_tt"]
|
||||
|
||||
if TREZOR_MODEL in ('T',):
|
||||
if TREZOR_MODEL in ('T', 'T3W1'):
|
||||
features.append('touch')
|
||||
features.append('backlight')
|
||||
if TREZOR_MODEL in ('R', '1'):
|
||||
|
BIN
core/embed/firmware/bootloaders/bootloader_T3W1.bin
Normal file
BIN
core/embed/firmware/bootloaders/bootloader_T3W1.bin
Normal file
Binary file not shown.
1
core/embed/firmware/memory_T3W1.ld
Symbolic link
1
core/embed/firmware/memory_T3W1.ld
Symbolic link
@ -0,0 +1 @@
|
||||
./memory_T.ld
|
@ -5,6 +5,7 @@ use core::convert::TryInto;
|
||||
pub enum PhysicalButton {
|
||||
Left,
|
||||
Right,
|
||||
Power,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
@ -24,6 +25,7 @@ impl ButtonEvent {
|
||||
let button = match button {
|
||||
0 => PhysicalButton::Left,
|
||||
1 => PhysicalButton::Right,
|
||||
2 => PhysicalButton::Power,
|
||||
_ => return Err(error::Error::OutOfRange),
|
||||
};
|
||||
let result = match event & 0xFF {
|
||||
|
@ -12,6 +12,13 @@
|
||||
#define USE_BACKLIGHT 1
|
||||
#define USE_DISP_I8080_8BIT_DW 1
|
||||
|
||||
#include "displays/panels/lx154a2422.h"
|
||||
#include "displays/st7789v.h"
|
||||
#define DISPLAY_IDENTIFY 1
|
||||
#define DISPLAY_TE_PORT GPIOD
|
||||
#define DISPLAY_TE_PIN GPIO_PIN_12
|
||||
#define TRANSFORM_TOUCH_COORDS lx154a2422_transform_touch_coords
|
||||
|
||||
#define BACKLIGHT_PWM_FREQ 50000
|
||||
#define BACKLIGHT_PWM_TIM TIM1
|
||||
#define BACKLIGHT_PWM_TIM_CLK_EN __HAL_RCC_TIM1_CLK_ENABLE
|
||||
@ -37,7 +44,16 @@
|
||||
#define I2C_INSTANCE_1_RESET_FLG RCC_APB1RSTR_I2C1RST
|
||||
|
||||
#define TOUCH_I2C_NUM 0
|
||||
#define TOUCH_RST_PORT GPIOC
|
||||
#define TOUCH_RST_PIN GPIO_PIN_5
|
||||
#define TOUCH_INT_PORT GPIOC
|
||||
#define TOUCH_INT_PIN GPIO_PIN_4
|
||||
#define TOUCH_ON_PORT GPIOB
|
||||
#define TOUCH_ON_PIN GPIO_PIN_10
|
||||
|
||||
#include "displays/st7789v.h"
|
||||
#define SD_DETECT_PORT GPIOC
|
||||
#define SD_DETECT_PIN GPIO_PIN_13
|
||||
#define SD_ENABLE_PORT GPIOC
|
||||
#define SD_ENABLE_PIN GPIO_PIN_0
|
||||
|
||||
#endif //_TREZOR_T_H
|
||||
|
71
core/embed/trezorhal/boards/trezor_t3w1_d1.h
Normal file
71
core/embed/trezorhal/boards/trezor_t3w1_d1.h
Normal file
@ -0,0 +1,71 @@
|
||||
#ifndef _TREZOR_T3W1_H
|
||||
#define _TREZOR_T3W1_H
|
||||
|
||||
#define DISPLAY_RESX 240
|
||||
#define DISPLAY_RESY 320
|
||||
|
||||
#define USE_SD_CARD 1
|
||||
#define USE_I2C 1
|
||||
#define USE_TOUCH 1
|
||||
#define USE_BUTTON 1
|
||||
#define USE_SBU 1
|
||||
#define USE_RGB_COLORS 1
|
||||
#define USE_BACKLIGHT 1
|
||||
#define USE_DISP_I8080_16BIT_DW 1
|
||||
|
||||
#define DISPLAY_PANEL_INIT_SEQ lhs200kb_if21_init_seq
|
||||
#define DISPLAY_PANEL_ROTATE lhs200kb_if21_rotate
|
||||
#define TRANSFORM_TOUCH_COORDS lhs200kb_if21_transform_touch_coords
|
||||
|
||||
#include "displays/panels/lhs200kb-if21.h"
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
#define BACKLIGHT_PWM_FREQ 50000
|
||||
#define BACKLIGHT_PWM_TIM TIM1
|
||||
#define BACKLIGHT_PWM_TIM_CLK_EN __HAL_RCC_TIM1_CLK_ENABLE
|
||||
#define BACKLIGHT_PWM_TIM_AF GPIO_AF1_TIM1
|
||||
#define BACKLIGHT_PWM_TIM_OCMODE TIM_OCMODE_PWM2
|
||||
#define BACKLIGHT_PWM_TIM_CHANNEL TIM_CHANNEL_1
|
||||
#define BACKLIGHT_PWM_TIM_CCR CCR1
|
||||
#define BACKLIGHT_PWM_PIN GPIO_PIN_7
|
||||
#define BACKLIGHT_PWM_PORT GPIOA
|
||||
#define BACKLIGHT_PWM_PORT_CLK_EN __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
|
||||
#define I2C_COUNT 1
|
||||
#define I2C_INSTANCE_1 I2C2
|
||||
#define I2C_INSTANCE_1_CLK_EN __HAL_RCC_I2C2_CLK_ENABLE
|
||||
#define I2C_INSTANCE_1_CLK_DIS __HAL_RCC_I2C2_CLK_DISABLE
|
||||
#define I2C_INSTANCE_1_PIN_AF GPIO_AF4_I2C2
|
||||
#define I2C_INSTANCE_1_SDA_PORT GPIOB
|
||||
#define I2C_INSTANCE_1_SDA_PIN GPIO_PIN_11
|
||||
#define I2C_INSTANCE_1_SDA_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
#define I2C_INSTANCE_1_SCL_PORT GPIOB
|
||||
#define I2C_INSTANCE_1_SCL_PIN GPIO_PIN_10
|
||||
#define I2C_INSTANCE_1_SCL_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE
|
||||
#define I2C_INSTANCE_1_RESET_FLG RCC_APB1RSTR_I2C2RST
|
||||
|
||||
#define TOUCH_I2C_NUM 0
|
||||
#define TOUCH_RST_PORT GPIOC
|
||||
#define TOUCH_RST_PIN GPIO_PIN_5
|
||||
#define TOUCH_INT_PORT GPIOC
|
||||
#define TOUCH_INT_PIN GPIO_PIN_4
|
||||
#define TOUCH_ON_PORT GPIOB
|
||||
#define TOUCH_ON_PIN GPIO_PIN_8
|
||||
|
||||
#define SD_DETECT_PORT GPIOB
|
||||
#define SD_DETECT_PIN GPIO_PIN_0
|
||||
#define SD_ENABLE_PORT GPIOE
|
||||
#define SD_ENABLE_PIN GPIO_PIN_1
|
||||
|
||||
#define GPIO_1_PORT GPIOC
|
||||
#define GPIO_1_PIN GPIO_PIN_1
|
||||
#define GPIO_2_PORT GPIOC
|
||||
#define GPIO_2_PIN GPIO_PIN_6
|
||||
#define GPIO_3_PORT GPIOC
|
||||
#define GPIO_3_PIN GPIO_PIN_7
|
||||
|
||||
#define BTN_POWER_CLK_ENA __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
#define BTN_POWER_PORT GPIOE
|
||||
#define BTN_POWER_PIN GPIO_PIN_0
|
||||
|
||||
#endif //_TREZOR_T3W1_H
|
@ -20,6 +20,9 @@
|
||||
#ifndef TREZORHAL_BUTTON_H
|
||||
#define TREZORHAL_BUTTON_H
|
||||
|
||||
#include TREZOR_BOARD
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define BTN_EVT_DOWN (1U << 24)
|
||||
@ -27,10 +30,19 @@
|
||||
|
||||
#define BTN_LEFT 0
|
||||
#define BTN_RIGHT 1
|
||||
#define BTN_POWER 2
|
||||
|
||||
void button_init(void);
|
||||
uint32_t button_read(void);
|
||||
char button_state_left(void);
|
||||
char button_state_right(void);
|
||||
|
||||
#ifdef BTN_LEFT_CLK_ENA
|
||||
bool button_state_left(void);
|
||||
#endif
|
||||
#ifdef BTN_RIGHT_CLK_ENA
|
||||
bool button_state_right(void);
|
||||
#endif
|
||||
#ifdef BTN_POWER_CLK_ENA
|
||||
bool button_state_power(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,28 +1,54 @@
|
||||
|
||||
#include "stdbool.h"
|
||||
|
||||
#include STM32_HAL_H
|
||||
#include "button.h"
|
||||
#include TREZOR_BOARD
|
||||
|
||||
static char last_left = 0, last_right = 0;
|
||||
|
||||
void button_init(void) {
|
||||
BTN_LEFT_CLK_ENA();
|
||||
BTN_RIGHT_CLK_ENA();
|
||||
|
||||
static void init_btn(GPIO_TypeDef *port, uint16_t pin) {
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = BTN_LEFT_PIN;
|
||||
HAL_GPIO_Init(BTN_LEFT_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = BTN_RIGHT_PIN;
|
||||
HAL_GPIO_Init(BTN_RIGHT_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = pin;
|
||||
HAL_GPIO_Init(port, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
#ifdef BTN_LEFT_CLK_ENA
|
||||
static bool last_left = 0;
|
||||
bool button_state_left(void) { return last_left; }
|
||||
#endif
|
||||
|
||||
#ifdef BTN_RIGHT_CLK_ENA
|
||||
static bool last_right = 0;
|
||||
bool button_state_right(void) { return last_right; }
|
||||
#endif
|
||||
|
||||
#ifdef BTN_POWER_CLK_ENA
|
||||
static bool last_power = 0;
|
||||
bool button_state_power(void) { return last_power; }
|
||||
#endif
|
||||
|
||||
void button_init(void) {
|
||||
#ifdef BTN_LEFT_CLK_ENA
|
||||
BTN_LEFT_CLK_ENA();
|
||||
init_btn(BTN_LEFT_PORT, BTN_LEFT_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef BTN_RIGHT_CLK_ENA
|
||||
BTN_RIGHT_CLK_ENA();
|
||||
init_btn(BTN_RIGHT_PORT, BTN_RIGHT_PIN);
|
||||
#endif
|
||||
|
||||
#ifdef BTN_POWER_CLK_ENA
|
||||
BTN_POWER_CLK_ENA();
|
||||
init_btn(BTN_POWER_PORT, BTN_POWER_PIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t button_read(void) {
|
||||
char left = (GPIO_PIN_RESET == HAL_GPIO_ReadPin(BTN_LEFT_PORT, BTN_LEFT_PIN));
|
||||
char right =
|
||||
(GPIO_PIN_RESET == HAL_GPIO_ReadPin(BTN_RIGHT_PORT, BTN_RIGHT_PIN));
|
||||
#ifdef BTN_LEFT_CLK_ENA
|
||||
bool left = (GPIO_PIN_RESET == HAL_GPIO_ReadPin(BTN_LEFT_PORT, BTN_LEFT_PIN));
|
||||
if (last_left != left) {
|
||||
last_left = left;
|
||||
if (left) {
|
||||
@ -31,6 +57,10 @@ uint32_t button_read(void) {
|
||||
return BTN_EVT_UP | BTN_LEFT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef BTN_RIGHT_CLK_ENA
|
||||
bool right =
|
||||
(GPIO_PIN_RESET == HAL_GPIO_ReadPin(BTN_RIGHT_PORT, BTN_RIGHT_PIN));
|
||||
if (last_right != right) {
|
||||
last_right = right;
|
||||
if (right) {
|
||||
@ -39,9 +69,19 @@ uint32_t button_read(void) {
|
||||
return BTN_EVT_UP | BTN_RIGHT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef BTN_POWER_CLK_ENA
|
||||
bool power =
|
||||
(GPIO_PIN_RESET == HAL_GPIO_ReadPin(BTN_POWER_PORT, BTN_POWER_PIN));
|
||||
if (last_power != power) {
|
||||
last_power = power;
|
||||
if (power) {
|
||||
return BTN_EVT_DOWN | BTN_POWER;
|
||||
} else {
|
||||
return BTN_EVT_UP | BTN_POWER;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char button_state_left(void) { return last_left; }
|
||||
|
||||
char button_state_right(void) { return last_right; }
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef TT_OLD2_H_
|
||||
#define TT_OLD2_H_
|
||||
#ifndef _154A_H_
|
||||
#define _154A_H_
|
||||
|
||||
// ILI9341 IC controller
|
||||
|
||||
|
151
core/embed/trezorhal/stm32f4/displays/panels/lhs200kb-if21.c
Normal file
151
core/embed/trezorhal/stm32f4/displays/panels/lhs200kb-if21.c
Normal file
@ -0,0 +1,151 @@
|
||||
|
||||
#include TREZOR_BOARD
|
||||
#include "display_interface.h"
|
||||
#include "displays/st7789v.h"
|
||||
#include "touch.h"
|
||||
|
||||
void lhs200kb_if21_init_seq() {
|
||||
CMD(0x36);
|
||||
DATA(0x00);
|
||||
|
||||
CMD(0x35);
|
||||
DATA(0x00);
|
||||
|
||||
CMD(0x3A);
|
||||
DATA(0x05);
|
||||
|
||||
CMD(0xB2);
|
||||
DATA(0x0C);
|
||||
DATA(0x0C);
|
||||
DATA(0x00);
|
||||
DATA(0x33);
|
||||
DATA(0x33);
|
||||
|
||||
CMD(0xB7);
|
||||
DATA(0x78);
|
||||
|
||||
CMD(0xBB);
|
||||
DATA(0x2F);
|
||||
|
||||
CMD(0xC0);
|
||||
DATA(0x2C);
|
||||
|
||||
CMD(0xC2);
|
||||
DATA(0x01);
|
||||
|
||||
CMD(0xC3);
|
||||
DATA(0x19);
|
||||
|
||||
CMD(0xC4);
|
||||
DATA(0x20);
|
||||
|
||||
CMD(0xC6);
|
||||
DATA(0x0F);
|
||||
|
||||
CMD(0xD0);
|
||||
DATA(0xA4);
|
||||
DATA(0xA1);
|
||||
|
||||
CMD(0xD6);
|
||||
DATA(0xA1);
|
||||
|
||||
CMD(0xE0);
|
||||
DATA(0xF0);
|
||||
DATA(0x08);
|
||||
DATA(0x0F);
|
||||
DATA(0x0B);
|
||||
DATA(0x0B);
|
||||
DATA(0x07);
|
||||
DATA(0x34);
|
||||
DATA(0x43);
|
||||
DATA(0x4B);
|
||||
DATA(0x38);
|
||||
DATA(0x14);
|
||||
DATA(0x13);
|
||||
DATA(0x2C);
|
||||
DATA(0x31);
|
||||
|
||||
CMD(0xE1);
|
||||
DATA(0xF0);
|
||||
DATA(0x0C);
|
||||
DATA(0x11);
|
||||
DATA(0x09);
|
||||
DATA(0x08);
|
||||
DATA(0x24);
|
||||
DATA(0x34);
|
||||
DATA(0x33);
|
||||
DATA(0x4A);
|
||||
DATA(0x3A);
|
||||
DATA(0x16);
|
||||
DATA(0x16);
|
||||
DATA(0x2E);
|
||||
DATA(0x32);
|
||||
|
||||
CMD(0x21);
|
||||
|
||||
CMD(0x29);
|
||||
}
|
||||
|
||||
void lhs200kb_if21_rotate(int degrees, buffer_offset_t* offset) {
|
||||
uint16_t shift = 0;
|
||||
char BX = 0, BY = 0;
|
||||
|
||||
#define RGB (1 << 3)
|
||||
#define ML (1 << 4) // vertical refresh order
|
||||
#define MH (1 << 2) // horizontal refresh order
|
||||
#define MV (1 << 5)
|
||||
#define MX (1 << 6)
|
||||
#define MY (1 << 7)
|
||||
// MADCTL: Memory Data Access Control - reference:
|
||||
// section 8.12 in the ST7789V manual
|
||||
uint8_t display_command_parameter = 0;
|
||||
switch (degrees) {
|
||||
case 0:
|
||||
display_command_parameter = 0;
|
||||
BY = 0;
|
||||
break;
|
||||
case 90:
|
||||
display_command_parameter = MV | MX | MH | ML;
|
||||
BX = 1;
|
||||
shift = 1;
|
||||
break;
|
||||
case 180:
|
||||
display_command_parameter = MX | MY | MH | ML;
|
||||
BY = 0;
|
||||
shift = 1;
|
||||
break;
|
||||
case 270:
|
||||
display_command_parameter = MV | MY;
|
||||
BX = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
CMD(0x36);
|
||||
DATA(display_command_parameter);
|
||||
|
||||
if (shift) {
|
||||
// GATECTRL: Gate Control; NL = 320 gate lines, first scan line is
|
||||
// gate 0.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x27);
|
||||
DATA(0x00);
|
||||
DATA(0x10);
|
||||
} else {
|
||||
// GATECTRL: Gate Control; NL = 320 gate lines, first scan line is
|
||||
// gate 0.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x27);
|
||||
DATA(0x00);
|
||||
DATA(0x10);
|
||||
}
|
||||
|
||||
// reset the column and page extents
|
||||
display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1);
|
||||
|
||||
offset->x = BX ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
offset->y = BY ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
}
|
||||
|
||||
uint32_t lhs200kb_if21_transform_touch_coords(uint16_t x, uint16_t y) {
|
||||
return touch_pack_xy(y, MAX_DISPLAY_RESY - x);
|
||||
}
|
12
core/embed/trezorhal/stm32f4/displays/panels/lhs200kb-if21.h
Normal file
12
core/embed/trezorhal/stm32f4/displays/panels/lhs200kb-if21.h
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
#ifndef CORE_LHS200KB_IF21_H
|
||||
#define CORE_LHS200KB_IF21_H
|
||||
// ST7789_V IC controller
|
||||
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
void lhs200kb_if21_init_seq(void);
|
||||
void lhs200kb_if21_rotate(int degrees, buffer_offset_t* offset);
|
||||
uint32_t lhs200kb_if21_transform_touch_coords(uint16_t x, uint16_t y);
|
||||
|
||||
#endif // CORE_LHS200KB_IF21_H
|
@ -1,5 +1,5 @@
|
||||
#ifndef TT_OLD3_H_
|
||||
#define TT_OLD3_H_
|
||||
#ifndef LX154A2411_H_
|
||||
#define LX154A2411_H_
|
||||
|
||||
// ST7789_V IC controller
|
||||
void lx154a2411_gamma(void);
|
||||
|
@ -1,5 +1,7 @@
|
||||
|
||||
#include "display_interface.h"
|
||||
#include "displays/st7789v.h"
|
||||
#include "touch.h"
|
||||
|
||||
void lx154a2422_gamma(void) {
|
||||
// positive voltage correction
|
||||
@ -80,3 +82,67 @@ void lx154a2422_init_seq(void) {
|
||||
|
||||
lx154a2422_gamma();
|
||||
}
|
||||
|
||||
void lx154a2422_rotate(int degrees, buffer_offset_t* offset) {
|
||||
uint16_t shift = 0;
|
||||
char BX = 0, BY = 0;
|
||||
|
||||
#define RGB (1 << 3)
|
||||
#define ML (1 << 4) // vertical refresh order
|
||||
#define MH (1 << 2) // horizontal refresh order
|
||||
#define MV (1 << 5)
|
||||
#define MX (1 << 6)
|
||||
#define MY (1 << 7)
|
||||
// MADCTL: Memory Data Access Control - reference:
|
||||
// section 8.12 in the ST7789V manual
|
||||
uint8_t display_command_parameter = 0;
|
||||
switch (degrees) {
|
||||
case 0:
|
||||
display_command_parameter = 0;
|
||||
BY = 0;
|
||||
break;
|
||||
case 90:
|
||||
display_command_parameter = MV | MX | MH | ML;
|
||||
BX = 1;
|
||||
shift = 1;
|
||||
break;
|
||||
case 180:
|
||||
display_command_parameter = MX | MY | MH | ML;
|
||||
BY = 0;
|
||||
shift = 1;
|
||||
break;
|
||||
case 270:
|
||||
display_command_parameter = MV | MY;
|
||||
BX = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
CMD(0x36);
|
||||
DATA(display_command_parameter);
|
||||
|
||||
if (shift) {
|
||||
// GATECTRL: Gate Control; NL = 240 gate lines, first scan line is
|
||||
// gate 80.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x1D);
|
||||
DATA(0x00);
|
||||
DATA(0x11);
|
||||
} else {
|
||||
// GATECTRL: Gate Control; NL = 240 gate lines, first scan line is
|
||||
// gate 80.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x1D);
|
||||
DATA(0x0A);
|
||||
DATA(0x11);
|
||||
}
|
||||
|
||||
// reset the column and page extents
|
||||
display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1);
|
||||
|
||||
offset->x = BX ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
offset->y = BY ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
}
|
||||
|
||||
uint32_t lx154a2422_transform_touch_coords(uint16_t x, uint16_t y) {
|
||||
return touch_pack_xy(x, y);
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
#ifndef LX154A2422_H_
|
||||
#define LX154A2422_H_
|
||||
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
void lx154a2422_init_seq(void);
|
||||
void lx154a2422_gamma(void);
|
||||
void lx154a2422_rotate(int degrees, buffer_offset_t* offset);
|
||||
uint32_t lx154a2422_transform_touch_coords(uint16_t x, uint16_t y);
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "display_interface.h"
|
||||
#include "displays/st7789v.h"
|
||||
|
||||
void tf15411a_init_seq(void) {
|
||||
@ -91,3 +92,67 @@ void tf15411a_init_seq(void) {
|
||||
DATA(0x37);
|
||||
DATA(0x8F);
|
||||
}
|
||||
|
||||
void tf15411a_rotate(int degrees, buffer_offset_t* offset) {
|
||||
uint16_t shift = 0;
|
||||
char BX = 0, BY = 0;
|
||||
|
||||
#define RGB (1 << 3)
|
||||
#define ML (1 << 4) // vertical refresh order
|
||||
#define MH (1 << 2) // horizontal refresh order
|
||||
#define MV (1 << 5)
|
||||
#define MX (1 << 6)
|
||||
#define MY (1 << 7)
|
||||
// MADCTL: Memory Data Access Control - reference:
|
||||
// section 9.3 in the ILI9341 manual
|
||||
// section 6.2.18 in the GC9307 manual
|
||||
// section 8.12 in the ST7789V manual
|
||||
uint8_t display_command_parameter = 0;
|
||||
switch (degrees) {
|
||||
case 0:
|
||||
display_command_parameter = 0;
|
||||
BY = 1;
|
||||
break;
|
||||
case 90:
|
||||
display_command_parameter = MV | MX | MH | ML;
|
||||
BX = 0;
|
||||
shift = 1;
|
||||
break;
|
||||
case 180:
|
||||
display_command_parameter = MX | MY | MH | ML;
|
||||
BY = 1;
|
||||
shift = 1;
|
||||
break;
|
||||
case 270:
|
||||
display_command_parameter = MV | MY;
|
||||
BX = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
display_command_parameter ^= RGB | MY; // XOR RGB and MY settings
|
||||
|
||||
CMD(0x36);
|
||||
DATA(display_command_parameter);
|
||||
|
||||
if (shift) {
|
||||
// GATECTRL: Gate Control; NL = 240 gate lines, first scan line is
|
||||
// gate 80.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x1D);
|
||||
DATA(0x00);
|
||||
DATA(0x11);
|
||||
} else {
|
||||
// GATECTRL: Gate Control; NL = 240 gate lines, first scan line is
|
||||
// gate 80.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x1D);
|
||||
DATA(0x0A);
|
||||
DATA(0x11);
|
||||
}
|
||||
|
||||
// reset the column and page extents
|
||||
display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1);
|
||||
|
||||
offset->x = BX ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
offset->y = BY ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
#ifndef TT_OLD1_H_
|
||||
#define TT_OLD1_H_
|
||||
#ifndef TF15411A_H_
|
||||
#define TF15411A_H_
|
||||
|
||||
// GC9307 IC controller
|
||||
|
||||
void tf15411a_init_seq(void);
|
||||
void tf15411a_rotate(int degrees, buffer_offset_t* offset);
|
||||
|
||||
#endif
|
||||
|
@ -67,11 +67,14 @@ __IO DISP_MEM_TYPE *const DISPLAY_DATA_ADDRESS =
|
||||
#define DISPLAY_ID_ILI9341V 0x009341U
|
||||
|
||||
static int DISPLAY_ORIENTATION = -1;
|
||||
static buffer_offset_t BUFFER_OFFSET = {0};
|
||||
|
||||
void display_pixeldata(uint16_t c) { PIXELDATA(c); }
|
||||
|
||||
void display_pixeldata_dirty(void) {}
|
||||
|
||||
#ifdef DISPLAY_IDENTIFY
|
||||
|
||||
static uint32_t read_display_id(uint8_t command) {
|
||||
volatile uint8_t c = 0;
|
||||
uint32_t id = 0;
|
||||
@ -107,6 +110,9 @@ static uint32_t display_identify(void) {
|
||||
id_set = 1;
|
||||
return id;
|
||||
}
|
||||
#else
|
||||
static uint32_t display_identify(void) { return DISPLAY_ID_ST7789V; }
|
||||
#endif
|
||||
|
||||
bool display_is_inverted() {
|
||||
bool inv_on = false;
|
||||
@ -151,8 +157,6 @@ static void display_unsleep(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static struct { uint16_t x, y; } BUFFER_OFFSET;
|
||||
|
||||
void display_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
|
||||
x0 += BUFFER_OFFSET.x;
|
||||
x1 += BUFFER_OFFSET.x;
|
||||
@ -185,70 +189,16 @@ int display_orientation(int degrees) {
|
||||
// 2 bytes per pixel because we're using RGB 5-6-5 format
|
||||
PIXELDATA(0x0000);
|
||||
}
|
||||
|
||||
uint16_t shift = 0;
|
||||
char BX = 0, BY = 0;
|
||||
#ifdef TREZOR_MODEL_T
|
||||
uint32_t id = display_identify();
|
||||
if ((id == DISPLAY_ID_ILI9341V) || (id == DISPLAY_ID_GC9307) ||
|
||||
(id == DISPLAY_ID_ST7789V)) {
|
||||
#define RGB (1 << 3)
|
||||
#define ML (1 << 4) // vertical refresh order
|
||||
#define MH (1 << 2) // horizontal refresh order
|
||||
#define MV (1 << 5)
|
||||
#define MX (1 << 6)
|
||||
#define MY (1 << 7)
|
||||
// MADCTL: Memory Data Access Control - reference:
|
||||
// section 9.3 in the ILI9341 manual
|
||||
// section 6.2.18 in the GC9307 manual
|
||||
// section 8.12 in the ST7789V manual
|
||||
uint8_t display_command_parameter = 0;
|
||||
switch (degrees) {
|
||||
case 0:
|
||||
display_command_parameter = 0;
|
||||
BY = (id == DISPLAY_ID_GC9307);
|
||||
break;
|
||||
case 90:
|
||||
display_command_parameter = MV | MX | MH | ML;
|
||||
BX = (id != DISPLAY_ID_GC9307);
|
||||
shift = 1;
|
||||
break;
|
||||
case 180:
|
||||
display_command_parameter = MX | MY | MH | ML;
|
||||
BY = (id == DISPLAY_ID_GC9307);
|
||||
shift = 1;
|
||||
break;
|
||||
case 270:
|
||||
display_command_parameter = MV | MY;
|
||||
BX = (id != DISPLAY_ID_GC9307);
|
||||
break;
|
||||
}
|
||||
if (id == DISPLAY_ID_GC9307) {
|
||||
display_command_parameter ^= RGB | MY; // XOR RGB and MY settings
|
||||
}
|
||||
CMD(0x36);
|
||||
DATA(display_command_parameter);
|
||||
|
||||
if (shift) {
|
||||
// GATECTRL: Gate Control; NL = 240 gate lines, first scan line is
|
||||
// gate 80.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x1D);
|
||||
DATA(0x00);
|
||||
DATA(0x11);
|
||||
} else {
|
||||
// GATECTRL: Gate Control; NL = 240 gate lines, first scan line is
|
||||
// gate 80.; gate scan direction 319 -> 0
|
||||
CMD(0xE4);
|
||||
DATA(0x1D);
|
||||
DATA(0x0A);
|
||||
DATA(0x11);
|
||||
}
|
||||
|
||||
// reset the column and page extents
|
||||
display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1);
|
||||
if (id == DISPLAY_ID_GC9307) {
|
||||
tf15411a_rotate(degrees, &BUFFER_OFFSET);
|
||||
} else {
|
||||
lx154a2422_rotate(degrees, &BUFFER_OFFSET);
|
||||
}
|
||||
BUFFER_OFFSET.x = BX ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
BUFFER_OFFSET.y = BY ? (MAX_DISPLAY_RESY - DISPLAY_RESY) : 0;
|
||||
#else
|
||||
DISPLAY_PANEL_ROTATE(degrees, &BUFFER_OFFSET);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return DISPLAY_ORIENTATION;
|
||||
@ -357,13 +307,15 @@ void display_init(void) {
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_RESET);
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
|
||||
// LCD_FMARK/PD12 (tearing effect)
|
||||
#ifdef DISPLAY_TE_PIN
|
||||
// LCD_FMARK (tearing effect)
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStructure.Alternate = 0;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_12;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = DISPLAY_TE_PIN;
|
||||
HAL_GPIO_Init(DISPLAY_TE_PORT, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
@ -422,15 +374,18 @@ void display_reinit(void) {
|
||||
}
|
||||
|
||||
void display_sync(void) {
|
||||
#ifdef DISPLAY_TE_PIN
|
||||
uint32_t id = display_identify();
|
||||
if (id && (id != DISPLAY_ID_GC9307)) {
|
||||
// synchronize with the panel synchronization signal
|
||||
// in order to avoid visual tearing effects
|
||||
while (GPIO_PIN_SET == HAL_GPIO_ReadPin(GPIOD, GPIO_PIN_12)) {
|
||||
while (GPIO_PIN_SET == HAL_GPIO_ReadPin(DISPLAY_TE_PORT, DISPLAY_TE_PIN)) {
|
||||
}
|
||||
while (GPIO_PIN_RESET == HAL_GPIO_ReadPin(GPIOD, GPIO_PIN_12)) {
|
||||
while (GPIO_PIN_RESET ==
|
||||
HAL_GPIO_ReadPin(DISPLAY_TE_PORT, DISPLAY_TE_PIN)) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void display_refresh(void) {}
|
||||
|
@ -2,6 +2,12 @@
|
||||
#define _ST7789V_H
|
||||
|
||||
#include STM32_HAL_H
|
||||
|
||||
typedef struct {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
} buffer_offset_t;
|
||||
|
||||
#include TREZOR_BOARD
|
||||
|
||||
// ILI9341V, GC9307 and ST7789V drivers support 240px x 320px display resolution
|
||||
|
@ -141,6 +141,7 @@ void periph_init(void) {
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
|
||||
// enable the PVD (programmable voltage detector).
|
||||
// select the "2.7V" threshold (level 5).
|
||||
|
@ -44,6 +44,7 @@
|
||||
*/
|
||||
|
||||
#include STM32_HAL_H
|
||||
#include TREZOR_BOARD
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -68,7 +69,7 @@ void DMA2_Stream3_IRQHandler(void) {
|
||||
}
|
||||
|
||||
static inline void sdcard_default_pin_state(void) {
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET); // SD_ON/PC0
|
||||
HAL_GPIO_WritePin(SD_ENABLE_PORT, SD_ENABLE_PIN, GPIO_PIN_SET); // SD_ON
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_8, GPIO_PIN_RESET); // SD_DAT0/PC8
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_9, GPIO_PIN_RESET); // SD_DAT1/PC9
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_10, GPIO_PIN_RESET); // SD_DAT2/PC10
|
||||
@ -82,8 +83,8 @@ static inline void sdcard_default_pin_state(void) {
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = SD_ENABLE_PIN;
|
||||
HAL_GPIO_Init(SD_ENABLE_PORT, &GPIO_InitStructure);
|
||||
|
||||
// configure SD GPIO
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
@ -99,12 +100,13 @@ static inline void sdcard_default_pin_state(void) {
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_13;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = SD_DETECT_PIN;
|
||||
HAL_GPIO_Init(SD_DETECT_PORT, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
static inline void sdcard_active_pin_state(void) {
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET); // SD_ON/PC0
|
||||
HAL_GPIO_WritePin(SD_ENABLE_PORT, SD_ENABLE_PIN,
|
||||
GPIO_PIN_RESET); // SD_ON/PC0
|
||||
HAL_Delay(10); // we need to wait until the circuit fully kicks-in
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
@ -210,7 +212,8 @@ void sdcard_power_off(void) {
|
||||
}
|
||||
|
||||
secbool sdcard_is_present(void) {
|
||||
return sectrue * (GPIO_PIN_RESET == HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13));
|
||||
return sectrue *
|
||||
(GPIO_PIN_RESET == HAL_GPIO_ReadPin(SD_DETECT_PORT, SD_DETECT_PIN));
|
||||
}
|
||||
|
||||
uint64_t sdcard_get_capacity_in_bytes(void) {
|
||||
|
@ -47,15 +47,14 @@
|
||||
|
||||
static void touch_default_pin_state(void) {
|
||||
// set power off and other pins as per section 3.5 of FT6236 datasheet
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10,
|
||||
GPIO_PIN_SET); // CTP_ON/PB10 (active low) i.e.- CTPM power
|
||||
HAL_GPIO_WritePin(TOUCH_ON_PORT, TOUCH_ON_PIN,
|
||||
GPIO_PIN_SET); // CTP_ON (active low) i.e.- CTPM power
|
||||
// off when set/high/log 1
|
||||
HAL_GPIO_WritePin(
|
||||
GPIOC, GPIO_PIN_4,
|
||||
GPIO_PIN_RESET); // CTP_INT/PC4 normally an input, but drive low as an
|
||||
// output while powered off
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5,
|
||||
GPIO_PIN_RESET); // CTP_REST/PC5 (active low) i.e.- CTPM
|
||||
HAL_GPIO_WritePin(TOUCH_INT_PORT, TOUCH_INT_PIN,
|
||||
GPIO_PIN_RESET); // CTP_INT normally an input, but drive
|
||||
// low as an output while powered off
|
||||
HAL_GPIO_WritePin(TOUCH_RST_PORT, TOUCH_RST_PIN,
|
||||
GPIO_PIN_RESET); // CTP_REST (active low) i.e.- CTPM
|
||||
// held in reset until released
|
||||
|
||||
// set above pins to OUTPUT / NOPULL
|
||||
@ -64,10 +63,12 @@ static void touch_default_pin_state(void) {
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_10;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_4 | GPIO_PIN_5;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = TOUCH_INT_PIN;
|
||||
HAL_GPIO_Init(TOUCH_INT_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = TOUCH_RST_PIN;
|
||||
HAL_GPIO_Init(TOUCH_RST_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = TOUCH_ON_PIN;
|
||||
HAL_GPIO_Init(TOUCH_ON_PORT, &GPIO_InitStructure);
|
||||
|
||||
// in-case power was on, or CTPM was active make sure to wait long enough
|
||||
// for these changes to take effect. a reset needs to be low for
|
||||
@ -77,20 +78,21 @@ static void touch_default_pin_state(void) {
|
||||
}
|
||||
|
||||
static void touch_active_pin_state(void) {
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); // CTP_ON/PB10
|
||||
HAL_GPIO_WritePin(TOUCH_ON_PORT, TOUCH_ON_PIN, GPIO_PIN_RESET); // CTP_ON
|
||||
HAL_Delay(10); // we need to wait until the circuit fully kicks-in
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
// PC4 capacitive touch panel module (CTPM) interrupt (INT) input
|
||||
// capacitive touch panel module (CTPM) interrupt (INT) input
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_4;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_4);
|
||||
GPIO_InitStructure.Pin = TOUCH_INT_PIN;
|
||||
HAL_GPIO_Init(TOUCH_INT_PORT, &GPIO_InitStructure);
|
||||
__HAL_GPIO_EXTI_CLEAR_FLAG(TOUCH_INT_PIN);
|
||||
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, GPIO_PIN_SET); // release CTPM reset
|
||||
HAL_GPIO_WritePin(TOUCH_RST_PORT, TOUCH_RST_PIN,
|
||||
GPIO_PIN_SET); // release CTPM reset
|
||||
HAL_Delay(310); // "Time of starting to report point after resetting" min is
|
||||
// 300ms, giving an extra 10ms
|
||||
}
|
||||
@ -115,6 +117,7 @@ void touch_power_on(void) {
|
||||
|
||||
// turn on CTP circuitry
|
||||
touch_active_pin_state();
|
||||
|
||||
HAL_Delay(50);
|
||||
}
|
||||
|
||||
@ -131,9 +134,9 @@ void touch_init(void) {
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_4;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_4);
|
||||
GPIO_InitStructure.Pin = TOUCH_INT_PIN;
|
||||
HAL_GPIO_Init(TOUCH_INT_PORT, &GPIO_InitStructure);
|
||||
__HAL_GPIO_EXTI_CLEAR_FLAG(TOUCH_INT_PIN);
|
||||
|
||||
touch_set_mode();
|
||||
touch_sensitivity(0x06);
|
||||
@ -161,9 +164,9 @@ uint32_t touch_is_detected(void) {
|
||||
// Reference section 1.2 of "Application Note for FT6x06 CTPM". we
|
||||
// configure the touch controller to use "interrupt trigger mode".
|
||||
|
||||
uint32_t event = __HAL_GPIO_EXTI_GET_FLAG(GPIO_PIN_4);
|
||||
uint32_t event = __HAL_GPIO_EXTI_GET_FLAG(TOUCH_INT_PIN);
|
||||
if (event != 0) {
|
||||
__HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_4);
|
||||
__HAL_GPIO_EXTI_CLEAR_FLAG(TOUCH_INT_PIN);
|
||||
}
|
||||
|
||||
return event;
|
||||
@ -239,8 +242,8 @@ uint32_t touch_read(void) {
|
||||
// first touch) (tested with FT6206)
|
||||
const uint32_t event_flag = touch_data[3] & 0xC0;
|
||||
if (touch_data[1] == GESTURE_NO_GESTURE) {
|
||||
xy = touch_pack_xy((X_POS_MSB << 8) | X_POS_LSB,
|
||||
(Y_POS_MSB << 8) | Y_POS_LSB);
|
||||
xy = TRANSFORM_TOUCH_COORDS((X_POS_MSB << 8) | X_POS_LSB,
|
||||
(Y_POS_MSB << 8) | Y_POS_LSB);
|
||||
if ((number_of_touch_points == 1) && (event_flag == EVENT_PRESS_DOWN)) {
|
||||
touching = 1;
|
||||
return TOUCH_START | xy;
|
||||
|
20
core/embed/vendorheader/T3W1/vendor_dev_DO_NOT_SIGN.json
Normal file
20
core/embed/vendorheader/T3W1/vendor_dev_DO_NOT_SIGN.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"header_len": 4608,
|
||||
"text": "DEV ONLY, DO NOT USE!",
|
||||
"hw_model": null,
|
||||
"expiry": 0,
|
||||
"version": [0, 0],
|
||||
"sig_m": 2,
|
||||
"trust": {
|
||||
"allow_run_with_secret": false,
|
||||
"show_vendor_string": false,
|
||||
"require_user_click": false,
|
||||
"red_background": false,
|
||||
"delay": 0
|
||||
},
|
||||
"pubkeys": [
|
||||
"e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351",
|
||||
"d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869",
|
||||
"772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef"
|
||||
]
|
||||
}
|
BIN
core/embed/vendorheader/T3W1/vendor_dev_DO_NOT_SIGN.toif
Normal file
BIN
core/embed/vendorheader/T3W1/vendor_dev_DO_NOT_SIGN.toif
Normal file
Binary file not shown.
20
core/embed/vendorheader/T3W1/vendor_unsafe.json
Normal file
20
core/embed/vendorheader/T3W1/vendor_unsafe.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"header_len": 4608,
|
||||
"text": "UNSAFE, DO NOT USE!",
|
||||
"hw_model": "T3W1",
|
||||
"expiry": 0,
|
||||
"version": [0, 1],
|
||||
"sig_m": 2,
|
||||
"trust": {
|
||||
"allow_run_with_secret": false,
|
||||
"show_vendor_string": true,
|
||||
"require_user_click": true,
|
||||
"red_background": true,
|
||||
"delay": 1
|
||||
},
|
||||
"pubkeys": [
|
||||
"e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351",
|
||||
"d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869",
|
||||
"772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef"
|
||||
]
|
||||
}
|
BIN
core/embed/vendorheader/T3W1/vendor_unsafe.toif
Normal file
BIN
core/embed/vendorheader/T3W1/vendor_unsafe.toif
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
core/embed/vendorheader/T3W1/vendorheader_unsafe_signed_dev.bin
Normal file
BIN
core/embed/vendorheader/T3W1/vendorheader_unsafe_signed_dev.bin
Normal file
Binary file not shown.
BIN
core/embed/vendorheader/T3W1/vendorheader_unsafe_signed_prod.bin
Normal file
BIN
core/embed/vendorheader/T3W1/vendorheader_unsafe_signed_prod.bin
Normal file
Binary file not shown.
BIN
core/embed/vendorheader/T3W1/vendorheader_unsafe_unsigned.bin
Normal file
BIN
core/embed/vendorheader/T3W1/vendorheader_unsafe_unsigned.bin
Normal file
Binary file not shown.
@ -16,7 +16,7 @@ for arg in "$@"; do
|
||||
fi
|
||||
done
|
||||
|
||||
MODELS=(T2T1 T2B1 D001)
|
||||
MODELS=(T2T1 T2B1 T3W1 D001)
|
||||
|
||||
for MODEL in ${MODELS[@]}; do
|
||||
cd $MODEL
|
||||
|
@ -4,6 +4,8 @@ import subprocess
|
||||
import zlib
|
||||
from pathlib import Path
|
||||
|
||||
import subprocess
|
||||
|
||||
from boards import (
|
||||
discovery,
|
||||
trezor_1,
|
||||
|
@ -29,6 +29,7 @@ class Model(Enum):
|
||||
T1B1 = b"T1B1"
|
||||
T2T1 = b"T2T1"
|
||||
T2B1 = b"T2B1"
|
||||
T3W1 = b"T3W1"
|
||||
D001 = b"D001"
|
||||
|
||||
# legacy aliases
|
||||
@ -230,6 +231,7 @@ MODEL_MAP = {
|
||||
Model.T1B1: LEGACY_V3,
|
||||
Model.T2T1: T2T1,
|
||||
Model.T2B1: T2B1,
|
||||
Model.T3W1: TREZOR_CORE_DEV,
|
||||
Model.D001: TREZOR_CORE_DEV,
|
||||
}
|
||||
|
||||
@ -237,6 +239,7 @@ MODEL_MAP_DEV = {
|
||||
Model.T1B1: LEGACY_V3_DEV,
|
||||
Model.T2T1: TREZOR_CORE_DEV,
|
||||
Model.T2B1: TREZOR_CORE_DEV,
|
||||
Model.T3W1: TREZOR_CORE_DEV,
|
||||
Model.D001: TREZOR_CORE_DEV,
|
||||
}
|
||||
|
||||
@ -244,6 +247,7 @@ MODEL_HASH_PARAMS_MAP = {
|
||||
Model.T1B1: LEGACY_HASH_PARAMS,
|
||||
Model.T2T1: T2T1_HASH_PARAMS,
|
||||
Model.T2B1: T2T1_HASH_PARAMS,
|
||||
Model.T3W1: T2T1_HASH_PARAMS,
|
||||
Model.D001: T2T1_HASH_PARAMS,
|
||||
}
|
||||
|
||||
|
@ -72,15 +72,25 @@ DISC1 = TrezorModel(
|
||||
default_mapping=mapping.DEFAULT_MAPPING,
|
||||
)
|
||||
|
||||
T3W1 = TrezorModel(
|
||||
name="T3W1",
|
||||
internal_name="T3W1",
|
||||
minimum_version=(2, 1, 0),
|
||||
vendors=VENDORS,
|
||||
usb_ids=((0x1209, 0x53C1), (0x1209, 0x53C0)),
|
||||
default_mapping=mapping.DEFAULT_MAPPING,
|
||||
)
|
||||
|
||||
# ==== model based names ====
|
||||
|
||||
TREZOR_ONE = T1B1
|
||||
TREZOR_T = T2T1
|
||||
TREZOR_R = T2B1
|
||||
TREZOR_SAFE3 = T2B1
|
||||
TREZOR_T3W1 = T3W1
|
||||
TREZOR_DISC1 = DISC1
|
||||
|
||||
TREZORS = {T1B1, T2T1, T2B1, DISC1}
|
||||
TREZORS = {T1B1, T2T1, T2B1, T3W1, DISC1}
|
||||
|
||||
|
||||
def by_name(name: Optional[str]) -> Optional[TrezorModel]:
|
||||
|
Loading…
Reference in New Issue
Block a user