1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

embed: introduce display_identify

This commit is contained in:
Pavol Rusnak 2018-08-01 18:52:58 +02:00
parent 10396777b8
commit f4252d755c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 18 additions and 1 deletions

View File

@ -93,6 +93,8 @@ cstyle: ## run code style check on low-level C code
build: build_boardloader build_bootloader build_firmware build_prodtest build_unix ## build all
build_embed: build_boardloader build_bootloader build_firmware # build boardloader, bootloader, firmware
build_boardloader: ## build boardloader
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" $(BOARDLOADER_BUILD_DIR)/boardloader.bin

View File

@ -32,11 +32,26 @@
#define DISPLAY_MEMORY_PIN 16
#define CMD(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE))) = (X))
#define DATA(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE | (1 << DISPLAY_MEMORY_PIN)))) = (X))
#define ADDR (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE | (1 << DISPLAY_MEMORY_PIN)))))
#define DATA(X) (ADDR) = (X)
#define PIXELDATA(X) DATA((X) >> 8); DATA((X) & 0xFF)
#define LED_PWM_TIM_PERIOD (10000)
static uint32_t __attribute__((unused)) display_identify(void)
{
uint8_t c;
uint32_t id = 0;
CMD(0x04); // RDDID: Read Display ID
c = ADDR; id |= (c << 24);
c = ADDR; id |= (c << 16);
c = ADDR; id |= (c << 8);
c = ADDR; id |= c;
return id;
}
static void __attribute__((unused)) display_sleep(void)
{
#if DISPLAY_ILI9341V || DISPLAY_ST7789V