diff --git a/core/embed/trezorhal/boards/trezor_r_v6.h b/core/embed/trezorhal/boards/trezor_r_v6.h new file mode 100644 index 0000000000..5ca485d5b5 --- /dev/null +++ b/core/embed/trezorhal/boards/trezor_r_v6.h @@ -0,0 +1,36 @@ +#ifndef _TREZOR_R_V6_H +#define _TREZOR_R_V6_H + +#define USE_BUTTON 1 +#define USE_SBU 1 + +#include "displays/vg-2864ksweg01.h" + +#define BTN_LEFT_PIN GPIO_PIN_10 +#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_V6_H diff --git a/core/site_scons/boards/trezor_r_v6.py b/core/site_scons/boards/trezor_r_v6.py new file mode 100644 index 0000000000..26f11a15df --- /dev/null +++ b/core/site_scons/boards/trezor_r_v6.py @@ -0,0 +1,26 @@ +from . import get_hw_model_as_number + + +def configure(env, features_wanted, defines, sources): + features_available = [] + hw_model = get_hw_model_as_number('T2B1') + hw_revision = 6 + board = 'trezor_r_v6.h' + display = 'vg-2864ksweg01.c' + + defines += [f'TREZOR_BOARD=\\"boards/{board}\\"', ] + defines += [f'HW_MODEL={hw_model}', ] + defines += [f'HW_REVISION={hw_revision}', ] + sources += [f'embed/trezorhal/displays/{display}', ] + + if "input" in features_wanted: + sources += ['embed/trezorhal/button.c'] + features_available.append("button") + + if "sbu" in features_wanted: + sources += ['embed/trezorhal/sbu.c', ] + features_available.append("sbu") + + env.get('ENV')['TREZOR_BOARD'] = board + + return features_available diff --git a/core/site_scons/tools.py b/core/site_scons/tools.py index 09d8d2d96a..12f2166f81 100644 --- a/core/site_scons/tools.py +++ b/core/site_scons/tools.py @@ -1,7 +1,7 @@ from pathlib import Path import subprocess -from boards import trezor_1, trezor_r_v3, trezor_r_v4, trezor_t +from boards import trezor_1, trezor_r_v3, trezor_r_v4, trezor_t, trezor_r_v6 HERE = Path(__file__).parent.resolve() @@ -21,7 +21,7 @@ def add_font(font_name, font, defines, sources): def configure_board(model, features_wanted, env, defines, sources): - model_r_version = 4 + model_r_version = 6 if model in ('1',): return trezor_1.configure(env, features_wanted, defines, sources) @@ -30,8 +30,10 @@ def configure_board(model, features_wanted, env, defines, sources): elif model in ('R',): if model_r_version == 3: return trezor_r_v3.configure(env, features_wanted, defines, sources) - else: + elif model_r_version == 4: return trezor_r_v4.configure(env, features_wanted, defines, sources) + else: + return trezor_r_v6.configure(env, features_wanted, defines, sources) else: raise Exception("Unknown model")