Skip to content

Commit

Permalink
chore(core): use internal framebuffer on T3T1 (with ST7789V display c…
Browse files Browse the repository at this point in the history
…ontroller)

[no changelog]
  • Loading branch information
TychoVrahe committed Jan 2, 2024
1 parent c955e66 commit a5afc16
Show file tree
Hide file tree
Showing 21 changed files with 414 additions and 29 deletions.
2 changes: 1 addition & 1 deletion core/SConscript.bootloader
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if TREZOR_MODEL in ('1', ):
)
Return()

FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga"]
FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga", "dma2d"]

CCFLAGS_MOD = ''
CPPPATH_MOD = []
Expand Down
1 change: 1 addition & 0 deletions core/embed/boardloader/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/bootloader/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/firmware/memory_T3T1.ld
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/lib/display_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void display_init(void);
void display_reinit(void);
void display_sync(void);
void display_refresh(void);
void display_finish_actions(void);
const char *display_save(const char *prefix);
void display_clear_save(void);

Expand Down
1 change: 1 addition & 0 deletions core/embed/prodtest/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/reflash/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
13 changes: 10 additions & 3 deletions core/embed/rust/src/trezorhal/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ pub fn text_baseline(font: i32) -> i16 {
}

#[inline(always)]
#[cfg(all(feature = "disp_i8080_16bit_dw", not(feature = "disp_i8080_8bit_dw")))]
#[cfg(all(
not(feature = "framebuffer"),
feature = "disp_i8080_16bit_dw",
not(feature = "disp_i8080_8bit_dw")
))]
pub fn pixeldata(c: u16) {
unsafe {
ffi::DISPLAY_DATA_ADDRESS.write_volatile(c);
Expand All @@ -102,7 +106,7 @@ pub fn get_fb_addr() -> FrameBuffer {
}

#[inline(always)]
#[cfg(feature = "disp_i8080_8bit_dw")]
#[cfg(all(not(feature = "framebuffer"), feature = "disp_i8080_8bit_dw"))]
pub fn pixeldata(c: u16) {
unsafe {
ffi::DISPLAY_DATA_ADDRESS.write_volatile((c & 0xff) as u8);
Expand Down Expand Up @@ -135,7 +139,10 @@ pub fn pixel(fb: FrameBuffer, x: i16, y: i16, c: u32) {
}

#[inline(always)]
#[cfg(not(any(feature = "disp_i8080_16bit_dw", feature = "disp_i8080_8bit_dw")))]
#[cfg(any(
feature = "framebuffer",
not(any(feature = "disp_i8080_16bit_dw", feature = "disp_i8080_8bit_dw"))
))]
pub fn pixeldata(c: u16) {
unsafe {
ffi::display_pixeldata(c);
Expand Down
4 changes: 4 additions & 0 deletions core/embed/trezorhal/boards/trezor_t3t1_v4.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#define DISPLAY_IDENTIFY 1
#define DISPLAY_TE_PORT GPIOD
#define DISPLAY_TE_PIN GPIO_PIN_12
#define DISPLAY_TE_INTERRUPT_HANDLER EXTI12_IRQHandler
#define DISPLAY_TE_INTERRUPT_NUM EXTI12_IRQn
#define DISPLAY_TE_INTERRUPT_GPIOSEL EXTI_GPIOD
#define DISPLAY_TE_INTERRUPT_EXTI_LINE EXTI_LINE_12

#define DISPLAY_PANEL_INIT_SEQ lx154a2422_init_seq
#define DISPLAY_PANEL_ROTATE lx154a2422_rotate
Expand Down
2 changes: 2 additions & 0 deletions core/embed/trezorhal/stm32f4/backlight_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ int backlight_pwm_set(int val) {
return BACKLIGHT;
}

int backlight_pwm_get(void) { return BACKLIGHT; }

void backlight_pwm_init(void) {
// init peripherals
BACKLIGHT_PWM_PORT_CLK_EN();
Expand Down
1 change: 1 addition & 0 deletions core/embed/trezorhal/stm32f4/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ void collect_hw_entropy(void) {
// which might be incompatible with the other layers older versions,
// where this setting might be unknown
void ensure_compatible_settings(void) {
display_finish_actions();
#ifdef TREZOR_MODEL_T
display_set_big_endian();
display_orientation(0);
Expand Down
2 changes: 2 additions & 0 deletions core/embed/trezorhal/stm32f4/displays/ltdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,5 @@ void display_shift_window(uint16_t pixels) {
uint16_t display_get_window_offset(void) {
return MAX_DISPLAY_RESX - display_get_window_width();
}

void display_finish_actions(void) {}
Loading

0 comments on commit a5afc16

Please sign in to comment.