diff --git a/core/embed/extmod/modtrezorui/display-stm32_T.h b/core/embed/extmod/modtrezorui/display-stm32_T.h index 35abfddf5..15c570f41 100644 --- a/core/embed/extmod/modtrezorui/display-stm32_T.h +++ b/core/embed/extmod/modtrezorui/display-stm32_T.h @@ -30,11 +30,14 @@ const volatile uint8_t DISPLAY_ST7789V_INVERT_COLORS = 0; #define DISPLAY_MEMORY_BASE 0x60000000 #define DISPLAY_MEMORY_PIN 16 -#define CMD(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE))) = (X)) -#define ADDR \ - (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE | \ - (1 << DISPLAY_MEMORY_PIN))))) -#define DATA(X) (ADDR) = (X) +__IO uint8_t *const DISPLAY_CMD_ADDRESS = + (__IO uint8_t *const)((uint32_t)DISPLAY_MEMORY_BASE); +__IO uint8_t *const DISPLAY_DATA_ADDRESS = + (__IO uint8_t *const)((uint32_t)DISPLAY_MEMORY_BASE | + (1 << DISPLAY_MEMORY_PIN)); + +#define CMD(X) (*DISPLAY_CMD_ADDRESS = (X)) +#define DATA(X) (*DISPLAY_DATA_ADDRESS = (X)) #define PIXELDATA(X) \ DATA((X) >> 8); \ DATA((X)&0xFF) @@ -62,12 +65,13 @@ static uint32_t read_display_id(uint8_t command) { volatile uint8_t c = 0; uint32_t id = 0; CMD(command); - c = ADDR; // first returned value is a dummy value and should be discarded - c = ADDR; + c = *DISPLAY_DATA_ADDRESS; // first returned value is a dummy value and + // should be discarded + c = *DISPLAY_DATA_ADDRESS; id |= (c << 16); - c = ADDR; + c = *DISPLAY_DATA_ADDRESS; id |= (c << 8); - c = ADDR; + c = *DISPLAY_DATA_ADDRESS; id |= c; return id; } diff --git a/core/embed/extmod/modtrezorui/display.h b/core/embed/extmod/modtrezorui/display.h index aadf72cf0..797cc6a85 100644 --- a/core/embed/extmod/modtrezorui/display.h +++ b/core/embed/extmod/modtrezorui/display.h @@ -140,4 +140,14 @@ void display_fade(int start, int end, int delay); void display_utf8_substr(const char *buf_start, size_t buf_len, int char_off, int char_len, const char **out_start, int *out_len); +// pixeldata accessors +void display_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); +void display_pixeldata(uint16_t c); +void display_pixeldata_dirty(); + +#if !(defined EMULATOR) && (defined TREZOR_MODEL_T) +extern volatile uint8_t *const DISPLAY_CMD_ADDRESS; +extern volatile uint8_t *const DISPLAY_DATA_ADDRESS; +#endif + #endif