1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-19 01:26:06 +00:00

feat(core): add define to invert display colors on ST7789V

This commit is contained in:
Pavol Rusnak 2021-02-25 20:13:30 +01:00
parent 850aa56691
commit 814db111b2
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 20 additions and 8 deletions

View File

@ -237,6 +237,7 @@ static void check_bootloader_version(void) {
int main(void) {
drbg_init();
// display_init_seq();
touch_init();
touch_power_on();

View File

@ -19,6 +19,8 @@
#include STM32_HAL_H
#define DISPLAY_ST7789V_INVERT_COLORS 0
// FSMC/FMC Bank 1 - NOR/PSRAM 1
#define DISPLAY_MEMORY_BASE 0x60000000
#define DISPLAY_MEMORY_PIN 16
@ -34,14 +36,17 @@
#define LED_PWM_TIM_PERIOD (10000)
#define DISPLAY_ID_ST7789V \
0x858552U // section "9.1.3 RDDID (04h): Read Display ID" of ST7789V
// datasheet
#define DISPLAY_ID_GC9307 \
0x009307U // section "6.2.1. Read display identification information (04h)"
// of GC9307 datasheet
#define DISPLAY_ID_ILI9341V \
0x009341U // section "8.3.23 Read ID4 (D3h)" of ILI9341V datasheet
// section "9.1.3 RDDID (04h): Read Display ID"
// of ST7789V datasheet
#define DISPLAY_ID_ST7789V 0x858552U
// section "6.2.1. Read display identification information (04h)"
// of GC9307 datasheet
#define DISPLAY_ID_GC9307 0x009307U
// section "8.3.23 Read ID4 (D3h)"
// of ILI9341V datasheet
#define DISPLAY_ID_ILI9341V 0x009341U
static uint32_t read_display_id(uint8_t command) {
volatile uint8_t c = 0;
@ -251,6 +256,8 @@ void display_init_seq(void) {
DATA(0x37);
DATA(0x8F);
} else if (id == DISPLAY_ID_ST7789V) {
// most recent manual:
// https://www.newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf
CMD(0x35);
DATA(0x00); // TEON: Tearing Effect Line On; V-blanking only
CMD(0x3A);
@ -269,6 +276,9 @@ void display_init_seq(void) {
DATA(0x0A);
DATA(0x11); // GATECTRL: Gate Control; NL = 240 gate lines, first scan line
// is gate 80.; gate scan direction 319 -> 0
// INVOFF (20h): Display Inversion Off
// INVON (21h): Display Inversion On
CMD(0x20 | DISPLAY_ST7789V_INVERT_COLORS);
// the above config is the most important and definitely necessary
CMD(0xD0);
DATA(0xA4);

View File

@ -86,6 +86,7 @@ int main(void) {
#endif
#if TREZOR_MODEL == T
// display_init_seq();
sdcard_init();
touch_init();
touch_power_on();