mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 01:18:28 +00:00
feat(core): expose display pixeldata accessors from C
This commit is contained in:
parent
61482d0795
commit
57b12c2807
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user