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

new init sequence for display

This commit is contained in:
Pavol Rusnak 2016-10-06 00:23:57 +02:00
parent b68423a325
commit 8b22a38bce
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -133,7 +133,7 @@ static void display_unsleep(void) {
#if DISPLAY_ILI9341V || DISPLAY_ST7789V #if DISPLAY_ILI9341V || DISPLAY_ST7789V
CMD(0x11); // exit sleep CMD(0x11); // exit sleep
HAL_Delay(20); HAL_Delay(20);
CMD(0x29); // display CMD(0x29); // display on
#endif #endif
} }
@ -144,43 +144,47 @@ void display_init(void) {
HAL_Delay(20); HAL_Delay(20);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_SET);
HAL_Delay(5); HAL_Delay(5);
#if DISPLAY_ILI9341V || DISPLAY_ST7789V #if DISPLAY_ILI9341V
CMD(0x01); // software reset CMD(0x01); // software reset
HAL_Delay(20); HAL_Delay(20);
CMD(0x28); // display off CMD(0x28); // display off
CMD(0xCF); DATAS("\x00\xC1\x30", 3); CMD(0xCF); DATAS("\x00\xC1\x30", 3);
CMD(0xED); DATAS("\x64\x03\x12\x81", 4); CMD(0xED); DATAS("\x64\x03\x12\x81", 4);
CMD(0xE8); DATAS("\x85\x10\x7A", 3); CMD(0xE8); DATAS("\x85\x10\x7A", 3);
CMD(0xCB); DATAS("\x39\x2C\x00\x34\x02", 5); CMD(0xCB); DATAS("\x39\x2C\x00\x34\x02", 5);
CMD(0xF7); DATA(0x20); CMD(0xF7); DATA(0x20);
CMD(0xEA); DATAS("\x00\x00", 2); CMD(0xEA); DATAS("\x00\x00", 2);
CMD(0xC0); DATA(0x23); // power control VRH[5:0] CMD(0xC0); DATA(0x23); // power control VRH[5:0]
CMD(0xC1); DATA(0x12); // power control SAP[2:0] BT[3:0] CMD(0xC1); DATA(0x12); // power control SAP[2:0] BT[3:0]
CMD(0xC5); DATAS("\x60\x44", 2); // vcm control 1 CMD(0xC5); DATAS("\x60\x44", 2); // vcm control 1
CMD(0xC7); DATA(0x8A); // vcm control 2 CMD(0xC7); DATA(0x8A); // vcm control 2
CMD(0x3A); DATA(0x55); // memory access control (16-bit 565) CMD(0x3A); DATA(0x55); // memory access control (16-bit 565)
CMD(0xB1); DATAS("\x00\x18", 2); // framerate CMD(0xB1); DATAS("\x00\x18", 2); // framerate
#endif CMD(0xB6); DATAS("\x0A\xA2", 2); // display function control
#if DISPLAY_ILI9341V CMD(0xF6); DATAS("\x01\x30\x00", 3); // interface control
CMD(0xB6); DATAS("\x0A\xA2", 2); // display function control CMD(0xF2); DATA(0x00); // 3 gamma func disable
CMD(0xF6); DATAS("\x01\x30\x00", 3); // interface control CMD(0x26); DATA(0x01); // gamma func enable
CMD(0xF2); DATA(0x00); // 3 gamma func disable
#endif
#if DISPLAY_ILI9341V
CMD(0x26); DATA(0x01); // gamma func enable
CMD(0xE0); DATAS("\x0F\x2F\x2C\x0B\x0F\x09\x56\xD9\x4A\x0B\x14\x05\x0C\x06\x00", 15); // gamma curve 1 CMD(0xE0); DATAS("\x0F\x2F\x2C\x0B\x0F\x09\x56\xD9\x4A\x0B\x14\x05\x0C\x06\x00", 15); // gamma curve 1
CMD(0xE1); DATAS("\x00\x10\x13\x04\x10\x06\x25\x26\x3B\x04\x0B\x0A\x33\x39\x0F", 15); // gamma curve 2 CMD(0xE1); DATAS("\x00\x10\x13\x04\x10\x06\x25\x26\x3B\x04\x0B\x0A\x33\x39\x0F", 15); // gamma curve 2
CMD(0x21); // invert colors
#endif #endif
#if DISPLAY_ST7789V #if DISPLAY_ST7789V
CMD(0x26); DATA(0x01); // gamma func enable CMD(0x01); // software reset
HAL_Delay(20);
CMD(0x28); // display off
CMD(0x3A); DATA(0x55); // COLMOD: Interface Pixel format
CMD(0xB2); DATA("\x0C\x0C\x00\x33\x33"); // PORCTRK: Porch setting
CMD(0xB7); DATA(0x35); // GCTRL: Gate Control
CMD(0xBB); DATA(0x2B); // VCOMS: VCOM setting
CMD(0xC0); DATA(0x2C); // LCMCTRL: LCM Control
CMD(0xC2); DATA("\x01\xFF"); // VDVVRHEN: VDV and VRH Command Enable
CMD(0xC3); DATA(0x11); // VRHS: VRH Set
CMD(0xC4); DATA(0x20); // VDVS: VDV Set
CMD(0xC6); DATA(0x0F); // FRCTRL2: Frame Rate control in normal mode
CMD(0xD0); DATAS("\xA4\xA1"); // PWCTRL1: Power Control 1
CMD(0xE0); DATAS("\x70\x2C\x2E\x15\x10\x09\x48\x33\x53\x0B\x19\x18\x20\x25", 14); // gamma curve 1 CMD(0xE0); DATAS("\x70\x2C\x2E\x15\x10\x09\x48\x33\x53\x0B\x19\x18\x20\x25", 14); // gamma curve 1
CMD(0xE1); DATAS("\x70\x2C\x2E\x15\x10\x09\x48\x33\x53\x0B\x19\x18\x20\x25", 14); // gamma curve 2 CMD(0xE1); DATAS("\x70\x2C\x2E\x15\x10\x09\x48\x33\x53\x0B\x19\x18\x20\x25", 14); // gamma curve 2
#endif CMD(0x20); // don't invert colors
#if DISPLAY_ILI9341V
CMD(0x21); // invert colors
#endif
#if DISPLAY_ST7789V
CMD(0x20); // don't invert colors
#endif #endif
display_orientation(0); display_orientation(0);
display_backlight(0); display_backlight(0);