From 4160d142b333fffb99443fefe6894f09f3b5ce23 Mon Sep 17 00:00:00 2001 From: Throows Date: Wed, 14 Jan 2026 22:39:40 +0100 Subject: [PATCH] (m5stack_tab): changed ili9881c and gt911 drivers to st7123 --- bsp/m5stack_tab5/Kconfig | 2 +- bsp/m5stack_tab5/idf_component.yml | 5 +- bsp/m5stack_tab5/include/bsp/display.h | 10 +- bsp/m5stack_tab5/m5stack_tab5.json | 31 +- .../priv_include/disp_init_data.h | 456 ++---------------- bsp/m5stack_tab5/src/m5stack_tab5.c | 35 +- 6 files changed, 77 insertions(+), 462 deletions(-) diff --git a/bsp/m5stack_tab5/Kconfig b/bsp/m5stack_tab5/Kconfig index b2575e601..a6a49999a 100644 --- a/bsp/m5stack_tab5/Kconfig +++ b/bsp/m5stack_tab5/Kconfig @@ -86,7 +86,7 @@ menu "Board Support Package(m5stack_tab5)" Whether to enable double framebuf. config BSP_LCD_DPI_BUFFER_NUMS int "Set number of frame buffers" - default 1 + default 2 range 1 3 help Let DPI LCD driver create a specified number of frame-size buffers. Only when it is set to multiple can the avoiding tearing be turned on. diff --git a/bsp/m5stack_tab5/idf_component.yml b/bsp/m5stack_tab5/idf_component.yml index 315404b9c..07c241b27 100644 --- a/bsp/m5stack_tab5/idf_component.yml +++ b/bsp/m5stack_tab5/idf_component.yml @@ -31,14 +31,13 @@ dependencies: public: true override_path: "../../components/esp_lvgl_port" - espressif/esp_lcd_ili9881c: + espressif/esp_lcd_st7123: version: "*" public: false - espressif/esp_lcd_touch_gt911: + espressif/esp_lcd_touch_st7123: version: "*" public: false - override_path: "../../components/lcd_touch/esp_lcd_touch_gt911" esp_video: version: "~1.4" diff --git a/bsp/m5stack_tab5/include/bsp/display.h b/bsp/m5stack_tab5/include/bsp/display.h index e3c757692..dc30883b7 100644 --- a/bsp/m5stack_tab5/include/bsp/display.h +++ b/bsp/m5stack_tab5/include/bsp/display.h @@ -38,8 +38,16 @@ /* LCD definition */ #define BSP_LCD_H_RES (720) #define BSP_LCD_V_RES (1280) + +#define BSP_LCD_MIPI_DSI_LCD_HSYNC (2) +#define BSP_LCD_MIPI_DSI_LCD_HBP (40) +#define BSP_LCD_MIPI_DSI_LCD_HFP (40) +#define BSP_LCD_MIPI_DSI_LCD_VSYNC (2) +#define BSP_LCD_MIPI_DSI_LCD_VBP (8) +#define BSP_LCD_MIPI_DSI_LCD_VFP (220) + #define BSP_LCD_MIPI_DSI_LANE_NUM (2) // 2 data lanes -#define BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS (1000) // 1Gbps +#define BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS (965) // ST7123 lane bitrate #define BSP_MIPI_DSI_PHY_PWR_LDO_CHAN (3) // LDO_VO3 is connected to VDD_MIPI_DPHY #define BSP_MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV (2500) diff --git a/bsp/m5stack_tab5/m5stack_tab5.json b/bsp/m5stack_tab5/m5stack_tab5.json index 9606d4323..47cc1e63b 100644 --- a/bsp/m5stack_tab5/m5stack_tab5.json +++ b/bsp/m5stack_tab5/m5stack_tab5.json @@ -88,30 +88,31 @@ "true" ], "interface": "MIPI", - "driver": "espressif/esp_lcd_ili9881c", + "driver": "espressif/esp_lcd_st7123", "BSP_LCD_H_RES": "720", "BSP_LCD_V_RES": "1280", "BSP_LCD_ROTATION_SW": "true", "BSP_LCD_BITS_PER_PIXEL": "16", "BSP_LCD_COLOR_FORMAT": "ESP_LCD_COLOR_FORMAT_RGB565", "BSP_LCD_COLOR_SPACE": "LCD_RGB_ELEMENT_ORDER_RGB", - "BSP_LCD_MIPI_DPI_CLOCK_MHZ": "60", + "BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS": "965", + "BSP_LCD_MIPI_DPI_CLOCK_MHZ": "70", "BSP_LCD_MIPI_DPI_COLOR_FORMAT": "LCD_COLOR_FMT_RGB565", - "BSP_LCD_MIPI_DPI_HBP": "140", - "BSP_LCD_MIPI_DPI_HPW": "40", + "BSP_LCD_MIPI_DPI_HBP": "40", + "BSP_LCD_MIPI_DPI_HPW": "2", "BSP_LCD_MIPI_DPI_HFP": "40", - "BSP_LCD_MIPI_DPI_VBP": "20", - "BSP_LCD_MIPI_DPI_VPW": "4", - "BSP_LCD_MIPI_DPI_VFP": "20", + "BSP_LCD_MIPI_DPI_VBP": "8", + "BSP_LCD_MIPI_DPI_VPW": "2", + "BSP_LCD_MIPI_DPI_VFP": "220", "pins": { "BSP_LCD_RST": "GPIO_NUM_NC", "BSP_LCD_BACKLIGHT": "GPIO_NUM_22", "BSP_LCD_EN": "IO_EXPANDER_PIN_NUM_4" }, - "BSP_LCD_INIT_CMDS": "// {cmd, { data }, data_size, delay}\r\n/**** CMD_Page 1 ****/\r\n{0xFF, (uint8_t[]){0x98, 0x81, 0x01}, 3, 0},\r\n{0xB7, (uint8_t[]){0x03}, 1, 0}, // set 2 lane\r\n/**** CMD_Page 3 ****/\r\n{0xFF, (uint8_t[]){0x98, 0x81, 0x03}, 3, 0},\r\n{0x01, (uint8_t[]){0x00}, 1, 0},\r\n{0x02, (uint8_t[]){0x00}, 1, 0},\r\n{0x03, (uint8_t[]){0x73}, 1, 0},\r\n{0x04, (uint8_t[]){0x00}, 1, 0},\r\n{0x05, (uint8_t[]){0x00}, 1, 0},\r\n{0x06, (uint8_t[]){0x08}, 1, 0},\r\n{0x07, (uint8_t[]){0x00}, 1, 0},\r\n{0x08, (uint8_t[]){0x00}, 1, 0},\r\n{0x09, (uint8_t[]){0x1B}, 1, 0},\r\n{0x0a, (uint8_t[]){0x01}, 1, 0},\r\n{0x0b, (uint8_t[]){0x01}, 1, 0},\r\n{0x0c, (uint8_t[]){0x0D}, 1, 0},\r\n{0x0d, (uint8_t[]){0x01}, 1, 0},\r\n{0x0e, (uint8_t[]){0x01}, 1, 0},\r\n{0x0f, (uint8_t[]){0x26}, 1, 0},\r\n{0x10, (uint8_t[]){0x26}, 1, 0},\r\n{0x11, (uint8_t[]){0x00}, 1, 0},\r\n{0x12, (uint8_t[]){0x00}, 1, 0},\r\n{0x13, (uint8_t[]){0x02}, 1, 0},\r\n{0x14, (uint8_t[]){0x00}, 1, 0},\r\n{0x15, (uint8_t[]){0x00}, 1, 0},\r\n{0x16, (uint8_t[]){0x00}, 1, 0},\r\n{0x17, (uint8_t[]){0x00}, 1, 0},\r\n{0x18, (uint8_t[]){0x00}, 1, 0},\r\n{0x19, (uint8_t[]){0x00}, 1, 0},\r\n{0x1a, (uint8_t[]){0x00}, 1, 0},\r\n{0x1b, (uint8_t[]){0x00}, 1, 0},\r\n{0x1c, (uint8_t[]){0x00}, 1, 0},\r\n{0x1d, (uint8_t[]){0x00}, 1, 0},\r\n{0x1e, (uint8_t[]){0x40}, 1, 0},\r\n{0x1f, (uint8_t[]){0x00}, 1, 0},\r\n{0x20, (uint8_t[]){0x06}, 1, 0},\r\n{0x21, (uint8_t[]){0x01}, 1, 0},\r\n{0x22, (uint8_t[]){0x00}, 1, 0},\r\n{0x23, (uint8_t[]){0x00}, 1, 0},\r\n{0x24, (uint8_t[]){0x00}, 1, 0},\r\n{0x25, (uint8_t[]){0x00}, 1, 0},\r\n{0x26, (uint8_t[]){0x00}, 1, 0},\r\n{0x27, (uint8_t[]){0x00}, 1, 0},\r\n{0x28, (uint8_t[]){0x33}, 1, 0},\r\n{0x29, (uint8_t[]){0x03}, 1, 0},\r\n{0x2a, (uint8_t[]){0x00}, 1, 0},\r\n{0x2b, (uint8_t[]){0x00}, 1, 0},\r\n{0x2c, (uint8_t[]){0x00}, 1, 0},\r\n{0x2d, (uint8_t[]){0x00}, 1, 0},\r\n{0x2e, (uint8_t[]){0x00}, 1, 0},\r\n{0x2f, (uint8_t[]){0x00}, 1, 0},\r\n{0x30, (uint8_t[]){0x00}, 1, 0},\r\n{0x31, (uint8_t[]){0x00}, 1, 0},\r\n{0x32, (uint8_t[]){0x00}, 1, 0},\r\n{0x33, (uint8_t[]){0x00}, 1, 0},\r\n{0x34, (uint8_t[]){0x00}, 1, 0},\r\n{0x35, (uint8_t[]){0x00}, 1, 0},\r\n{0x36, (uint8_t[]){0x00}, 1, 0},\r\n{0x37, (uint8_t[]){0x00}, 1, 0},\r\n{0x38, (uint8_t[]){0x00}, 1, 0},\r\n{0x39, (uint8_t[]){0x00}, 1, 0},\r\n{0x3a, (uint8_t[]){0x00}, 1, 0},\r\n{0x3b, (uint8_t[]){0x00}, 1, 0},\r\n{0x3c, (uint8_t[]){0x00}, 1, 0},\r\n{0x3d, (uint8_t[]){0x00}, 1, 0},\r\n{0x3e, (uint8_t[]){0x00}, 1, 0},\r\n{0x3f, (uint8_t[]){0x00}, 1, 0},\r\n{0x40, (uint8_t[]){0x00}, 1, 0},\r\n{0x41, (uint8_t[]){0x00}, 1, 0},\r\n{0x42, (uint8_t[]){0x00}, 1, 0},\r\n{0x43, (uint8_t[]){0x00}, 1, 0},\r\n{0x44, (uint8_t[]){0x00}, 1, 0},\r\n\r\n{0x50, (uint8_t[]){0x01}, 1, 0},\r\n{0x51, (uint8_t[]){0x23}, 1, 0},\r\n{0x52, (uint8_t[]){0x45}, 1, 0},\r\n{0x53, (uint8_t[]){0x67}, 1, 0},\r\n{0x54, (uint8_t[]){0x89}, 1, 0},\r\n{0x55, (uint8_t[]){0xab}, 1, 0},\r\n{0x56, (uint8_t[]){0x01}, 1, 0},\r\n{0x57, (uint8_t[]){0x23}, 1, 0},\r\n{0x58, (uint8_t[]){0x45}, 1, 0},\r\n{0x59, (uint8_t[]){0x67}, 1, 0},\r\n{0x5a, (uint8_t[]){0x89}, 1, 0},\r\n{0x5b, (uint8_t[]){0xab}, 1, 0},\r\n{0x5c, (uint8_t[]){0xcd}, 1, 0},\r\n{0x5d, (uint8_t[]){0xef}, 1, 0},\r\n\r\n{0x5e, (uint8_t[]){0x11}, 1, 0},\r\n{0x5f, (uint8_t[]){0x02}, 1, 0},\r\n{0x60, (uint8_t[]){0x00}, 1, 0},\r\n{0x61, (uint8_t[]){0x07}, 1, 0},\r\n{0x62, (uint8_t[]){0x06}, 1, 0},\r\n{0x63, (uint8_t[]){0x0E}, 1, 0},\r\n{0x64, (uint8_t[]){0x0F}, 1, 0},\r\n{0x65, (uint8_t[]){0x0C}, 1, 0},\r\n{0x66, (uint8_t[]){0x0D}, 1, 0},\r\n{0x67, (uint8_t[]){0x02}, 1, 0},\r\n{0x68, (uint8_t[]){0x02}, 1, 0},\r\n{0x69, (uint8_t[]){0x02}, 1, 0},\r\n{0x6a, (uint8_t[]){0x02}, 1, 0},\r\n{0x6b, (uint8_t[]){0x02}, 1, 0},\r\n{0x6c, (uint8_t[]){0x02}, 1, 0},\r\n{0x6d, (uint8_t[]){0x02}, 1, 0},\r\n{0x6e, (uint8_t[]){0x02}, 1, 0},\r\n{0x6f, (uint8_t[]){0x02}, 1, 0},\r\n{0x70, (uint8_t[]){0x02}, 1, 0},\r\n{0x71, (uint8_t[]){0x02}, 1, 0},\r\n{0x72, (uint8_t[]){0x02}, 1, 0},\r\n{0x73, (uint8_t[]){0x05}, 1, 0},\r\n{0x74, (uint8_t[]){0x01}, 1, 0},\r\n{0x75, (uint8_t[]){0x02}, 1, 0},\r\n{0x76, (uint8_t[]){0x00}, 1, 0},\r\n{0x77, (uint8_t[]){0x07}, 1, 0},\r\n{0x78, (uint8_t[]){0x06}, 1, 0},\r\n{0x79, (uint8_t[]){0x0E}, 1, 0},\r\n{0x7a, (uint8_t[]){0x0F}, 1, 0},\r\n{0x7b, (uint8_t[]){0x0C}, 1, 0},\r\n{0x7c, (uint8_t[]){0x0D}, 1, 0},\r\n{0x7d, (uint8_t[]){0x02}, 1, 0},\r\n{0x7e, (uint8_t[]){0x02}, 1, 0},\r\n{0x7f, (uint8_t[]){0x02}, 1, 0},\r\n{0x80, (uint8_t[]){0x02}, 1, 0},\r\n{0x81, (uint8_t[]){0x02}, 1, 0},\r\n{0x82, (uint8_t[]){0x02}, 1, 0},\r\n{0x83, (uint8_t[]){0x02}, 1, 0},\r\n{0x84, (uint8_t[]){0x02}, 1, 0},\r\n{0x85, (uint8_t[]){0x02}, 1, 0},\r\n{0x86, (uint8_t[]){0x02}, 1, 0},\r\n{0x87, (uint8_t[]){0x02}, 1, 0},\r\n{0x88, (uint8_t[]){0x02}, 1, 0},\r\n{0x89, (uint8_t[]){0x05}, 1, 0},\r\n{0x8A, (uint8_t[]){0x01}, 1, 0},\r\n\r\n/**** CMD_Page 4 ****/\r\n{0xFF, (uint8_t[]){0x98, 0x81, 0x04}, 3, 0},\r\n{0x38, (uint8_t[]){0x01}, 1, 0},\r\n{0x39, (uint8_t[]){0x00}, 1, 0},\r\n{0x6C, (uint8_t[]){0x15}, 1, 0},\r\n{0x6E, (uint8_t[]){0x1A}, 1, 0},\r\n{0x6F, (uint8_t[]){0x25}, 1, 0},\r\n{0x3A, (uint8_t[]){0xA4}, 1, 0},\r\n{0x8D, (uint8_t[]){0x20}, 1, 0},\r\n{0x87, (uint8_t[]){0xBA}, 1, 0},\r\n{0x3B, (uint8_t[]){0x98}, 1, 0},\r\n\r\n/**** CMD_Page 1 ****/\r\n{0xFF, (uint8_t[]){0x98, 0x81, 0x01}, 3, 0},\r\n{0x22, (uint8_t[]){0x0A}, 1, 0},\r\n{0x31, (uint8_t[]){0x00}, 1, 0},\r\n{0x50, (uint8_t[]){0x6B}, 1, 0},\r\n{0x51, (uint8_t[]){0x66}, 1, 0},\r\n{0x53, (uint8_t[]){0x73}, 1, 0},\r\n{0x55, (uint8_t[]){0x8B}, 1, 0},\r\n{0x60, (uint8_t[]){0x1B}, 1, 0},\r\n{0x61, (uint8_t[]){0x01}, 1, 0},\r\n{0x62, (uint8_t[]){0x0C}, 1, 0},\r\n{0x63, (uint8_t[]){0x00}, 1, 0},\r\n\r\n// Gamma P\r\n{0xA0, (uint8_t[]){0x00}, 1, 0},\r\n{0xA1, (uint8_t[]){0x15}, 1, 0},\r\n{0xA2, (uint8_t[]){0x1F}, 1, 0},\r\n{0xA3, (uint8_t[]){0x13}, 1, 0},\r\n{0xA4, (uint8_t[]){0x11}, 1, 0},\r\n{0xA5, (uint8_t[]){0x21}, 1, 0},\r\n{0xA6, (uint8_t[]){0x17}, 1, 0},\r\n{0xA7, (uint8_t[]){0x1B}, 1, 0},\r\n{0xA8, (uint8_t[]){0x6B}, 1, 0},\r\n{0xA9, (uint8_t[]){0x1E}, 1, 0},\r\n{0xAA, (uint8_t[]){0x2B}, 1, 0},\r\n{0xAB, (uint8_t[]){0x5D}, 1, 0},\r\n{0xAC, (uint8_t[]){0x19}, 1, 0},\r\n{0xAD, (uint8_t[]){0x14}, 1, 0},\r\n{0xAE, (uint8_t[]){0x4B}, 1, 0},\r\n{0xAF, (uint8_t[]){0x1D}, 1, 0},\r\n{0xB0, (uint8_t[]){0x27}, 1, 0},\r\n{0xB1, (uint8_t[]){0x49}, 1, 0},\r\n{0xB2, (uint8_t[]){0x5D}, 1, 0},\r\n{0xB3, (uint8_t[]){0x39}, 1, 0},\r\n\r\n// Gamma N\r\n{0xC0, (uint8_t[]){0x00}, 1, 0},\r\n{0xC1, (uint8_t[]){0x01}, 1, 0},\r\n{0xC2, (uint8_t[]){0x0C}, 1, 0},\r\n{0xC3, (uint8_t[]){0x11}, 1, 0},\r\n{0xC4, (uint8_t[]){0x15}, 1, 0},\r\n{0xC5, (uint8_t[]){0x28}, 1, 0},\r\n{0xC6, (uint8_t[]){0x1B}, 1, 0},\r\n{0xC7, (uint8_t[]){0x1C}, 1, 0},\r\n{0xC8, (uint8_t[]){0x62}, 1, 0},\r\n{0xC9, (uint8_t[]){0x1C}, 1, 0},\r\n{0xCA, (uint8_t[]){0x29}, 1, 0},\r\n{0xCB, (uint8_t[]){0x60}, 1, 0},\r\n{0xCC, (uint8_t[]){0x16}, 1, 0},\r\n{0xCD, (uint8_t[]){0x17}, 1, 0},\r\n{0xCE, (uint8_t[]){0x4A}, 1, 0},\r\n{0xCF, (uint8_t[]){0x23}, 1, 0},\r\n{0xD0, (uint8_t[]){0x24}, 1, 0},\r\n{0xD1, (uint8_t[]){0x4F}, 1, 0},\r\n{0xD2, (uint8_t[]){0x5F}, 1, 0},\r\n{0xD3, (uint8_t[]){0x39}, 1, 0},\r\n\r\n/**** CMD_Page 0 ****/\r\n{0xFF, (uint8_t[]){0x98, 0x81, 0x00}, 3, 0},\r\n{0x35, (uint8_t[]){0x00}, 0, 0},\r\n// {0x11, (uint8_t []){0x00}, 0},\r\n{0xFE, (uint8_t[]){0x00}, 0, 0},\r\n{0x29, (uint8_t[]){0x00}, 0, 0},\r\n//============ Gamma END===========\r\n", + "BSP_LCD_INIT_CMDS": "// ST7123 init sequence from M5Stack M5Tab5-UserDemo {cmd, { data }, data_size, delay_ms}\n{0x60, (uint8_t[]){0x71, 0x23, 0xa2}, 3, 0},\n{0x60, (uint8_t[]){0x71, 0x23, 0xa3}, 3, 0},\n{0x60, (uint8_t[]){0x71, 0x23, 0xa4}, 3, 0},\n{0xA4, (uint8_t[]){0x31}, 1, 0},\n{0xD7, (uint8_t[]){0x10, 0x0A, 0x10, 0x2A, 0x80, 0x80}, 6, 0},\n{0x90, (uint8_t[]){0x71, 0x23, 0x5A, 0x20, 0x24, 0x09, 0x09}, 7, 0},\n{0xA3, (uint8_t[]){0x80, 0x01, 0x88, 0x30, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x1E, 0x5C, 0x1E, 0x80, 0x00, 0x4F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x1E, 0x5C, 0x1E, 0x80, 0x00, 0x6F, 0x58, 0x00, 0x00, 0x00, 0xFF}, 40, 0},\n{0xA6, (uint8_t[]){0x03, 0x00, 0x24, 0x55, 0x36, 0x00, 0x39, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x00, 0x24, 0x55, 0x38, 0x00, 0x37, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x00, 0x24, 0x11, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x00, 0xEC, 0x11, 0x00, 0x03, 0x00, 0x03, 0x6E, 0x6E, 0xFF, 0xFF, 0x00, 0x08, 0x80, 0x08, 0x80, 0x06, 0x00, 0x00, 0x00, 0x00}, 55, 0},\n{0xA7, (uint8_t[]){0x19, 0x19, 0x80, 0x64, 0x40, 0x07, 0x16, 0x40, 0x00, 0x44, 0x03, 0x6E, 0x6E, 0x91, 0xFF, 0x08, 0x80, 0x64, 0x40, 0x25, 0x34, 0x40, 0x00, 0x02, 0x01, 0x6E, 0x6E, 0x91, 0xFF, 0x08, 0x80, 0x64, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x08, 0x80, 0x64, 0x40, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x6E, 0x6E, 0x84, 0xFF, 0x08, 0x80, 0x44}, 60, 0},\n{0xAC, (uint8_t[]){0x03, 0x19, 0x19, 0x18, 0x18, 0x06, 0x13, 0x13, 0x11, 0x11, 0x08, 0x08, 0x0A, 0x0A, 0x1C, 0x1C, 0x07, 0x07, 0x00, 0x00, 0x02, 0x02, 0x01, 0x19, 0x19, 0x18, 0x18, 0x06, 0x12, 0x12, 0x10, 0x10, 0x09, 0x09, 0x0B, 0x0B, 0x1C, 0x1C, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01}, 44, 0},\n{0xAD, (uint8_t[]){0xF0, 0x00, 0x46, 0x00, 0x03, 0x50, 0x50, 0xFF, 0xFF, 0xF0, 0x40, 0x06, 0x01, 0x07, 0x42, 0x42, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}, 25, 0},\n{0xAE, (uint8_t[]){0xFE, 0x3F, 0x3F, 0xFE, 0x3F, 0x3F, 0x00}, 7, 0},\n{0xB2, (uint8_t[]){0x15, 0x19, 0x05, 0x23, 0x49, 0xAF, 0x03, 0x2E, 0x5C, 0xD2, 0xFF, 0x10, 0x20, 0xFD, 0x20, 0xC0, 0x00}, 17, 0},\n{0xE8, (uint8_t[]){0x20, 0x6F, 0x04, 0x97, 0x97, 0x3E, 0x04, 0xDC, 0xDC, 0x3E, 0x06, 0xFA, 0x26, 0x3E}, 15, 0},\n{0x75, (uint8_t[]){0x03, 0x04}, 2, 0},\n{0xE7, (uint8_t[]){0x3B, 0x00, 0x00, 0x7C, 0xA1, 0x8C, 0x20, 0x1A, 0xF0, 0xB1, 0x50, 0x00, 0x50, 0xB1, 0x50, 0xB1, 0x50, 0xD8, 0x00, 0x55, 0x00, 0xB1, 0x00, 0x45, 0xC9, 0x6A, 0xFF, 0x5A, 0xD8, 0x18, 0x88, 0x15, 0xB1, 0x01, 0x01, 0x77}, 36, 0},\n{0xEA, (uint8_t[]){0x13, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x2C}, 8, 0},\n{0xB0, (uint8_t[]){0x22, 0x43, 0x11, 0x61, 0x25, 0x43, 0x43}, 7, 0},\n{0xB7, (uint8_t[]){0x00, 0x00, 0x73, 0x73}, 4, 0},\n{0xBF, (uint8_t[]){0xA6, 0xAA}, 2, 0},\n{0xA9, (uint8_t[]){0x00, 0x00, 0x73, 0xFF, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03}, 10, 0},\n{0xC8, (uint8_t[]){0x00, 0x00, 0x10, 0x1F, 0x36, 0x00, 0x5D, 0x04, 0x9D, 0x05, 0x10, 0xF2, 0x06, 0x60, 0x03, 0x11, 0xAD, 0x00, 0xEF, 0x01, 0x22, 0x2E, 0x0E, 0x74, 0x08, 0x32, 0xDC, 0x09, 0x33, 0x0F, 0xF3, 0x77, 0x0D, 0xB0, 0xDC, 0x03, 0xFF}, 37, 0},\n{0xC9, (uint8_t[]){0x00, 0x00, 0x10, 0x1F, 0x36, 0x00, 0x5D, 0x04, 0x9D, 0x05, 0x10, 0xF2, 0x06, 0x60, 0x03, 0x11, 0xAD, 0x00, 0xEF, 0x01, 0x22, 0x2E, 0x0E, 0x74, 0x08, 0x32, 0xDC, 0x09, 0x33, 0x0F, 0xF3, 0x77, 0x0D, 0xB0, 0xDC, 0x03, 0xFF}, 37, 0},\n{0x36, (uint8_t[]){0x03}, 1, 0},\n{0x11, (uint8_t[]){0x00}, 1, 0}, \n{0x29, (uint8_t[]){0x00}, 1, 0}, \n{0x35, (uint8_t[]){0x00}, 1, 0},\n", "BSP_FEATURE_LCD_TYPE": "IO_Expander", "BSP_FEATURE_LCD_LEVEL": "true", - "DRIVER": "ili9881c", + "DRIVER": "st7123", "DRIVER_NAMESPACE": "espressif" }, { @@ -121,16 +122,16 @@ "true" ], "interface": "I2C", - "driver": "espressif/esp_lcd_touch_gt911", + "driver": "espressif/esp_lcd_touch_st7123", "pins": { "BSP_LCD_TOUCH_INT": "GPIO_NUM_NC", "BSP_TOUCH_EN": "IO_EXPANDER_PIN_NUM_5" }, "BSP_FEATURE_TOUCH_TYPE": "IO_Expander", "BSP_FEATURE_TOUCH_LEVEL": "true", - "DRIVER": "gt911", + "DRIVER": "st7123", "DRIVER_NAMESPACE": "espressif", - "CFG": "ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG()" + "CFG": "ESP_LCD_TOUCH_IO_I2C_ST7123_CONFIG()" }, { "name": "AUDIO_SPEAKER", @@ -277,13 +278,13 @@ "min_idf": "5.1" }, { - "name": "espressif/esp_lcd_ili9881c", + "name": "espressif/esp_lcd_st7123", "version": "*", "public": "false", "min_idf": "0" }, { - "name": "espressif/esp_lcd_touch_gt911", + "name": "espressif/esp_lcd_touch_st7123", "version": "*", "public": "false", "min_idf": "0" @@ -353,6 +354,6 @@ "level": "true" } ], - "YEAR": 2025, + "YEAR": 2026, "NOGLIB": 1 } diff --git a/bsp/m5stack_tab5/priv_include/disp_init_data.h b/bsp/m5stack_tab5/priv_include/disp_init_data.h index 9636c6a3a..ba565088c 100644 --- a/bsp/m5stack_tab5/priv_include/disp_init_data.h +++ b/bsp/m5stack_tab5/priv_include/disp_init_data.h @@ -5,430 +5,38 @@ */ #pragma once -static const ili9881c_lcd_init_cmd_t disp_init_data[] = { - // {cmd, { data }, data_size, delay} - - /**** CMD_Page 1 ****/ - - {0xFF, (uint8_t[]){0x98, 0x81, 0x01}, 3, 0}, - - {0xB7, (uint8_t[]){0x03}, 1, 0}, // set 2 lane - - /**** CMD_Page 3 ****/ - - {0xFF, (uint8_t[]){0x98, 0x81, 0x03}, 3, 0}, - - {0x01, (uint8_t[]){0x00}, 1, 0}, - - {0x02, (uint8_t[]){0x00}, 1, 0}, - - {0x03, (uint8_t[]){0x73}, 1, 0}, - - {0x04, (uint8_t[]){0x00}, 1, 0}, - - {0x05, (uint8_t[]){0x00}, 1, 0}, - - {0x06, (uint8_t[]){0x08}, 1, 0}, - - {0x07, (uint8_t[]){0x00}, 1, 0}, - - {0x08, (uint8_t[]){0x00}, 1, 0}, - - {0x09, (uint8_t[]){0x1B}, 1, 0}, - - {0x0a, (uint8_t[]){0x01}, 1, 0}, - - {0x0b, (uint8_t[]){0x01}, 1, 0}, - - {0x0c, (uint8_t[]){0x0D}, 1, 0}, - - {0x0d, (uint8_t[]){0x01}, 1, 0}, - - {0x0e, (uint8_t[]){0x01}, 1, 0}, - - {0x0f, (uint8_t[]){0x26}, 1, 0}, - - {0x10, (uint8_t[]){0x26}, 1, 0}, - +/* + * ST7123 initialization sequence for M5Stack Tab5 + * Based on M5Stack's official M5Tab5-UserDemo repository + * https://github.com/m5stack/M5Tab5-UserDemo + */ +static const st7123_lcd_init_cmd_t disp_init_data[] = { + // {cmd, { data }, data_size, delay_ms} + {0x60, (uint8_t[]){0x71, 0x23, 0xa2}, 3, 0}, + {0x60, (uint8_t[]){0x71, 0x23, 0xa3}, 3, 0}, + {0x60, (uint8_t[]){0x71, 0x23, 0xa4}, 3, 0}, + {0xA4, (uint8_t[]){0x31}, 1, 0}, + {0xD7, (uint8_t[]){0x10, 0x0A, 0x10, 0x2A, 0x80, 0x80}, 6, 0}, + {0x90, (uint8_t[]){0x71, 0x23, 0x5A, 0x20, 0x24, 0x09, 0x09}, 7, 0}, + {0xA3, (uint8_t[]){0x80, 0x01, 0x88, 0x30, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x1E, 0x5C, 0x1E, 0x80, 0x00, 0x4F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x1E, 0x5C, 0x1E, 0x80, 0x00, 0x6F, 0x58, 0x00, 0x00, 0x00, 0xFF}, 40, 0}, + {0xA6, (uint8_t[]){0x03, 0x00, 0x24, 0x55, 0x36, 0x00, 0x39, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x00, 0x24, 0x55, 0x38, 0x00, 0x37, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x00, 0x24, 0x11, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x00, 0xEC, 0x11, 0x00, 0x03, 0x00, 0x03, 0x6E, 0x6E, 0xFF, 0xFF, 0x00, 0x08, 0x80, 0x08, 0x80, 0x06, 0x00, 0x00, 0x00, 0x00}, 55, 0}, + {0xA7, (uint8_t[]){0x19, 0x19, 0x80, 0x64, 0x40, 0x07, 0x16, 0x40, 0x00, 0x44, 0x03, 0x6E, 0x6E, 0x91, 0xFF, 0x08, 0x80, 0x64, 0x40, 0x25, 0x34, 0x40, 0x00, 0x02, 0x01, 0x6E, 0x6E, 0x91, 0xFF, 0x08, 0x80, 0x64, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x6E, 0x6E, 0x91, 0xFF, 0x08, 0x80, 0x64, 0x40, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x6E, 0x6E, 0x84, 0xFF, 0x08, 0x80, 0x44}, 60, 0}, + {0xAC, (uint8_t[]){0x03, 0x19, 0x19, 0x18, 0x18, 0x06, 0x13, 0x13, 0x11, 0x11, 0x08, 0x08, 0x0A, 0x0A, 0x1C, 0x1C, 0x07, 0x07, 0x00, 0x00, 0x02, 0x02, 0x01, 0x19, 0x19, 0x18, 0x18, 0x06, 0x12, 0x12, 0x10, 0x10, 0x09, 0x09, 0x0B, 0x0B, 0x1C, 0x1C, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01}, 44, 0}, + {0xAD, (uint8_t[]){0xF0, 0x00, 0x46, 0x00, 0x03, 0x50, 0x50, 0xFF, 0xFF, 0xF0, 0x40, 0x06, 0x01, 0x07, 0x42, 0x42, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}, 25, 0}, + {0xAE, (uint8_t[]){0xFE, 0x3F, 0x3F, 0xFE, 0x3F, 0x3F, 0x00}, 7, 0}, + {0xB2, (uint8_t[]){0x15, 0x19, 0x05, 0x23, 0x49, 0xAF, 0x03, 0x2E, 0x5C, 0xD2, 0xFF, 0x10, 0x20, 0xFD, 0x20, 0xC0, 0x00}, 17, 0}, + {0xE8, (uint8_t[]){0x20, 0x6F, 0x04, 0x97, 0x97, 0x3E, 0x04, 0xDC, 0xDC, 0x3E, 0x06, 0xFA, 0x26, 0x3E}, 15, 0}, + {0x75, (uint8_t[]){0x03, 0x04}, 2, 0}, + {0xE7, (uint8_t[]){0x3B, 0x00, 0x00, 0x7C, 0xA1, 0x8C, 0x20, 0x1A, 0xF0, 0xB1, 0x50, 0x00, 0x50, 0xB1, 0x50, 0xB1, 0x50, 0xD8, 0x00, 0x55, 0x00, 0xB1, 0x00, 0x45, 0xC9, 0x6A, 0xFF, 0x5A, 0xD8, 0x18, 0x88, 0x15, 0xB1, 0x01, 0x01, 0x77}, 36, 0}, + {0xEA, (uint8_t[]){0x13, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x2C}, 8, 0}, + {0xB0, (uint8_t[]){0x22, 0x43, 0x11, 0x61, 0x25, 0x43, 0x43}, 7, 0}, + {0xB7, (uint8_t[]){0x00, 0x00, 0x73, 0x73}, 4, 0}, + {0xBF, (uint8_t[]){0xA6, 0xAA}, 2, 0}, + {0xA9, (uint8_t[]){0x00, 0x00, 0x73, 0xFF, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03}, 10, 0}, + {0xC8, (uint8_t[]){0x00, 0x00, 0x10, 0x1F, 0x36, 0x00, 0x5D, 0x04, 0x9D, 0x05, 0x10, 0xF2, 0x06, 0x60, 0x03, 0x11, 0xAD, 0x00, 0xEF, 0x01, 0x22, 0x2E, 0x0E, 0x74, 0x08, 0x32, 0xDC, 0x09, 0x33, 0x0F, 0xF3, 0x77, 0x0D, 0xB0, 0xDC, 0x03, 0xFF}, 37, 0}, + {0xC9, (uint8_t[]){0x00, 0x00, 0x10, 0x1F, 0x36, 0x00, 0x5D, 0x04, 0x9D, 0x05, 0x10, 0xF2, 0x06, 0x60, 0x03, 0x11, 0xAD, 0x00, 0xEF, 0x01, 0x22, 0x2E, 0x0E, 0x74, 0x08, 0x32, 0xDC, 0x09, 0x33, 0x0F, 0xF3, 0x77, 0x0D, 0xB0, 0xDC, 0x03, 0xFF}, 37, 0}, + {0x36, (uint8_t[]){0x03}, 1, 0}, {0x11, (uint8_t[]){0x00}, 1, 0}, - - {0x12, (uint8_t[]){0x00}, 1, 0}, - - {0x13, (uint8_t[]){0x02}, 1, 0}, - - {0x14, (uint8_t[]){0x00}, 1, 0}, - - {0x15, (uint8_t[]){0x00}, 1, 0}, - - {0x16, (uint8_t[]){0x00}, 1, 0}, - - {0x17, (uint8_t[]){0x00}, 1, 0}, - - {0x18, (uint8_t[]){0x00}, 1, 0}, - - {0x19, (uint8_t[]){0x00}, 1, 0}, - - {0x1a, (uint8_t[]){0x00}, 1, 0}, - - {0x1b, (uint8_t[]){0x00}, 1, 0}, - - {0x1c, (uint8_t[]){0x00}, 1, 0}, - - {0x1d, (uint8_t[]){0x00}, 1, 0}, - - {0x1e, (uint8_t[]){0x40}, 1, 0}, - - {0x1f, (uint8_t[]){0x00}, 1, 0}, - - {0x20, (uint8_t[]){0x06}, 1, 0}, - - {0x21, (uint8_t[]){0x01}, 1, 0}, - - {0x22, (uint8_t[]){0x00}, 1, 0}, - - {0x23, (uint8_t[]){0x00}, 1, 0}, - - {0x24, (uint8_t[]){0x00}, 1, 0}, - - {0x25, (uint8_t[]){0x00}, 1, 0}, - - {0x26, (uint8_t[]){0x00}, 1, 0}, - - {0x27, (uint8_t[]){0x00}, 1, 0}, - - {0x28, (uint8_t[]){0x33}, 1, 0}, - - {0x29, (uint8_t[]){0x03}, 1, 0}, - - {0x2a, (uint8_t[]){0x00}, 1, 0}, - - {0x2b, (uint8_t[]){0x00}, 1, 0}, - - {0x2c, (uint8_t[]){0x00}, 1, 0}, - - {0x2d, (uint8_t[]){0x00}, 1, 0}, - - {0x2e, (uint8_t[]){0x00}, 1, 0}, - - {0x2f, (uint8_t[]){0x00}, 1, 0}, - - {0x30, (uint8_t[]){0x00}, 1, 0}, - - {0x31, (uint8_t[]){0x00}, 1, 0}, - - {0x32, (uint8_t[]){0x00}, 1, 0}, - - {0x33, (uint8_t[]){0x00}, 1, 0}, - - {0x34, (uint8_t[]){0x00}, 1, 0}, - + {0x29, (uint8_t[]){0x00}, 1, 0}, {0x35, (uint8_t[]){0x00}, 1, 0}, - - {0x36, (uint8_t[]){0x00}, 1, 0}, - - {0x37, (uint8_t[]){0x00}, 1, 0}, - - {0x38, (uint8_t[]){0x00}, 1, 0}, - - {0x39, (uint8_t[]){0x00}, 1, 0}, - - {0x3a, (uint8_t[]){0x00}, 1, 0}, - - {0x3b, (uint8_t[]){0x00}, 1, 0}, - - {0x3c, (uint8_t[]){0x00}, 1, 0}, - - {0x3d, (uint8_t[]){0x00}, 1, 0}, - - {0x3e, (uint8_t[]){0x00}, 1, 0}, - - {0x3f, (uint8_t[]){0x00}, 1, 0}, - - {0x40, (uint8_t[]){0x00}, 1, 0}, - - {0x41, (uint8_t[]){0x00}, 1, 0}, - - {0x42, (uint8_t[]){0x00}, 1, 0}, - - {0x43, (uint8_t[]){0x00}, 1, 0}, - - {0x44, (uint8_t[]){0x00}, 1, 0}, - - - - {0x50, (uint8_t[]){0x01}, 1, 0}, - - {0x51, (uint8_t[]){0x23}, 1, 0}, - - {0x52, (uint8_t[]){0x45}, 1, 0}, - - {0x53, (uint8_t[]){0x67}, 1, 0}, - - {0x54, (uint8_t[]){0x89}, 1, 0}, - - {0x55, (uint8_t[]){0xab}, 1, 0}, - - {0x56, (uint8_t[]){0x01}, 1, 0}, - - {0x57, (uint8_t[]){0x23}, 1, 0}, - - {0x58, (uint8_t[]){0x45}, 1, 0}, - - {0x59, (uint8_t[]){0x67}, 1, 0}, - - {0x5a, (uint8_t[]){0x89}, 1, 0}, - - {0x5b, (uint8_t[]){0xab}, 1, 0}, - - {0x5c, (uint8_t[]){0xcd}, 1, 0}, - - {0x5d, (uint8_t[]){0xef}, 1, 0}, - - - - {0x5e, (uint8_t[]){0x11}, 1, 0}, - - {0x5f, (uint8_t[]){0x02}, 1, 0}, - - {0x60, (uint8_t[]){0x00}, 1, 0}, - - {0x61, (uint8_t[]){0x07}, 1, 0}, - - {0x62, (uint8_t[]){0x06}, 1, 0}, - - {0x63, (uint8_t[]){0x0E}, 1, 0}, - - {0x64, (uint8_t[]){0x0F}, 1, 0}, - - {0x65, (uint8_t[]){0x0C}, 1, 0}, - - {0x66, (uint8_t[]){0x0D}, 1, 0}, - - {0x67, (uint8_t[]){0x02}, 1, 0}, - - {0x68, (uint8_t[]){0x02}, 1, 0}, - - {0x69, (uint8_t[]){0x02}, 1, 0}, - - {0x6a, (uint8_t[]){0x02}, 1, 0}, - - {0x6b, (uint8_t[]){0x02}, 1, 0}, - - {0x6c, (uint8_t[]){0x02}, 1, 0}, - - {0x6d, (uint8_t[]){0x02}, 1, 0}, - - {0x6e, (uint8_t[]){0x02}, 1, 0}, - - {0x6f, (uint8_t[]){0x02}, 1, 0}, - - {0x70, (uint8_t[]){0x02}, 1, 0}, - - {0x71, (uint8_t[]){0x02}, 1, 0}, - - {0x72, (uint8_t[]){0x02}, 1, 0}, - - {0x73, (uint8_t[]){0x05}, 1, 0}, - - {0x74, (uint8_t[]){0x01}, 1, 0}, - - {0x75, (uint8_t[]){0x02}, 1, 0}, - - {0x76, (uint8_t[]){0x00}, 1, 0}, - - {0x77, (uint8_t[]){0x07}, 1, 0}, - - {0x78, (uint8_t[]){0x06}, 1, 0}, - - {0x79, (uint8_t[]){0x0E}, 1, 0}, - - {0x7a, (uint8_t[]){0x0F}, 1, 0}, - - {0x7b, (uint8_t[]){0x0C}, 1, 0}, - - {0x7c, (uint8_t[]){0x0D}, 1, 0}, - - {0x7d, (uint8_t[]){0x02}, 1, 0}, - - {0x7e, (uint8_t[]){0x02}, 1, 0}, - - {0x7f, (uint8_t[]){0x02}, 1, 0}, - - {0x80, (uint8_t[]){0x02}, 1, 0}, - - {0x81, (uint8_t[]){0x02}, 1, 0}, - - {0x82, (uint8_t[]){0x02}, 1, 0}, - - {0x83, (uint8_t[]){0x02}, 1, 0}, - - {0x84, (uint8_t[]){0x02}, 1, 0}, - - {0x85, (uint8_t[]){0x02}, 1, 0}, - - {0x86, (uint8_t[]){0x02}, 1, 0}, - - {0x87, (uint8_t[]){0x02}, 1, 0}, - - {0x88, (uint8_t[]){0x02}, 1, 0}, - - {0x89, (uint8_t[]){0x05}, 1, 0}, - - {0x8A, (uint8_t[]){0x01}, 1, 0}, - - - - /**** CMD_Page 4 ****/ - - {0xFF, (uint8_t[]){0x98, 0x81, 0x04}, 3, 0}, - - {0x38, (uint8_t[]){0x01}, 1, 0}, - - {0x39, (uint8_t[]){0x00}, 1, 0}, - - {0x6C, (uint8_t[]){0x15}, 1, 0}, - - {0x6E, (uint8_t[]){0x1A}, 1, 0}, - - {0x6F, (uint8_t[]){0x25}, 1, 0}, - - {0x3A, (uint8_t[]){0xA4}, 1, 0}, - - {0x8D, (uint8_t[]){0x20}, 1, 0}, - - {0x87, (uint8_t[]){0xBA}, 1, 0}, - - {0x3B, (uint8_t[]){0x98}, 1, 0}, - - - - /**** CMD_Page 1 ****/ - - {0xFF, (uint8_t[]){0x98, 0x81, 0x01}, 3, 0}, - - {0x22, (uint8_t[]){0x0A}, 1, 0}, - - {0x31, (uint8_t[]){0x00}, 1, 0}, - - {0x50, (uint8_t[]){0x6B}, 1, 0}, - - {0x51, (uint8_t[]){0x66}, 1, 0}, - - {0x53, (uint8_t[]){0x73}, 1, 0}, - - {0x55, (uint8_t[]){0x8B}, 1, 0}, - - {0x60, (uint8_t[]){0x1B}, 1, 0}, - - {0x61, (uint8_t[]){0x01}, 1, 0}, - - {0x62, (uint8_t[]){0x0C}, 1, 0}, - - {0x63, (uint8_t[]){0x00}, 1, 0}, - - - -// Gamma P - - {0xA0, (uint8_t[]){0x00}, 1, 0}, - - {0xA1, (uint8_t[]){0x15}, 1, 0}, - - {0xA2, (uint8_t[]){0x1F}, 1, 0}, - - {0xA3, (uint8_t[]){0x13}, 1, 0}, - - {0xA4, (uint8_t[]){0x11}, 1, 0}, - - {0xA5, (uint8_t[]){0x21}, 1, 0}, - - {0xA6, (uint8_t[]){0x17}, 1, 0}, - - {0xA7, (uint8_t[]){0x1B}, 1, 0}, - - {0xA8, (uint8_t[]){0x6B}, 1, 0}, - - {0xA9, (uint8_t[]){0x1E}, 1, 0}, - - {0xAA, (uint8_t[]){0x2B}, 1, 0}, - - {0xAB, (uint8_t[]){0x5D}, 1, 0}, - - {0xAC, (uint8_t[]){0x19}, 1, 0}, - - {0xAD, (uint8_t[]){0x14}, 1, 0}, - - {0xAE, (uint8_t[]){0x4B}, 1, 0}, - - {0xAF, (uint8_t[]){0x1D}, 1, 0}, - - {0xB0, (uint8_t[]){0x27}, 1, 0}, - - {0xB1, (uint8_t[]){0x49}, 1, 0}, - - {0xB2, (uint8_t[]){0x5D}, 1, 0}, - - {0xB3, (uint8_t[]){0x39}, 1, 0}, - - - -// Gamma N - - {0xC0, (uint8_t[]){0x00}, 1, 0}, - - {0xC1, (uint8_t[]){0x01}, 1, 0}, - - {0xC2, (uint8_t[]){0x0C}, 1, 0}, - - {0xC3, (uint8_t[]){0x11}, 1, 0}, - - {0xC4, (uint8_t[]){0x15}, 1, 0}, - - {0xC5, (uint8_t[]){0x28}, 1, 0}, - - {0xC6, (uint8_t[]){0x1B}, 1, 0}, - - {0xC7, (uint8_t[]){0x1C}, 1, 0}, - - {0xC8, (uint8_t[]){0x62}, 1, 0}, - - {0xC9, (uint8_t[]){0x1C}, 1, 0}, - - {0xCA, (uint8_t[]){0x29}, 1, 0}, - - {0xCB, (uint8_t[]){0x60}, 1, 0}, - - {0xCC, (uint8_t[]){0x16}, 1, 0}, - - {0xCD, (uint8_t[]){0x17}, 1, 0}, - - {0xCE, (uint8_t[]){0x4A}, 1, 0}, - - {0xCF, (uint8_t[]){0x23}, 1, 0}, - - {0xD0, (uint8_t[]){0x24}, 1, 0}, - - {0xD1, (uint8_t[]){0x4F}, 1, 0}, - - {0xD2, (uint8_t[]){0x5F}, 1, 0}, - - {0xD3, (uint8_t[]){0x39}, 1, 0}, - - - - /**** CMD_Page 0 ****/ - - {0xFF, (uint8_t[]){0x98, 0x81, 0x00}, 3, 0}, - - {0x35, (uint8_t[]){0x00}, 0, 0}, - -// {0x11, (uint8_t []){0x00}, 0}, - - {0xFE, (uint8_t[]){0x00}, 0, 0}, - - {0x29, (uint8_t[]){0x00}, 0, 0}, - -//============ Gamma END=========== - - }; diff --git a/bsp/m5stack_tab5/src/m5stack_tab5.c b/bsp/m5stack_tab5/src/m5stack_tab5.c index 4f372c969..6e3587443 100644 --- a/bsp/m5stack_tab5/src/m5stack_tab5.c +++ b/bsp/m5stack_tab5/src/m5stack_tab5.c @@ -17,10 +17,10 @@ #include "esp_lcd_mipi_dsi.h" #include "esp_ldo_regulator.h" #include "sd_pwr_ctrl_by_on_chip_ldo.h" -#include "esp_lcd_ili9881c.h" +#include "esp_lcd_st7123.h" #include "disp_init_data.h" #include "esp_io_expander_pi4ioe5v6408.h" -#include "esp_lcd_touch_gt911.h" +#include "esp_lcd_touch_st7123.h" #include "esp_vfs_fat.h" #include "sd_pwr_ctrl_by_on_chip_ldo.h" #include "bsp/m5stack_tab5.h" @@ -496,7 +496,7 @@ esp_err_t bsp_display_brightness_init(void) .speed_mode = LEDC_LOW_SPEED_MODE, .duty_resolution = LEDC_TIMER_10_BIT, .timer_num = LEDC_TIMER_0, - .freq_hz = 5000, + .freq_hz = 25000, .clk_cfg = LEDC_AUTO_CLK }; @@ -605,19 +605,19 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l esp_lcd_dpi_panel_config_t dpi_config = { .virtual_channel = 0, .dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT, - .dpi_clock_freq_mhz = 60, + .dpi_clock_freq_mhz = 70, .in_color_format = LCD_COLOR_FMT_RGB565, .num_fbs = 1, .video_timing = { .h_size = BSP_LCD_H_RES, .v_size = BSP_LCD_V_RES, - .hsync_back_porch = 140, - .hsync_pulse_width = 40, - .hsync_front_porch = 40, - .vsync_back_porch = 20, - .vsync_pulse_width = 4, - .vsync_front_porch = 20, + .hsync_back_porch = BSP_LCD_MIPI_DSI_LCD_HBP, + .hsync_pulse_width = BSP_LCD_MIPI_DSI_LCD_HSYNC, + .hsync_front_porch = BSP_LCD_MIPI_DSI_LCD_HFP, + .vsync_back_porch = BSP_LCD_MIPI_DSI_LCD_VBP, + .vsync_pulse_width = BSP_LCD_MIPI_DSI_LCD_VSYNC, + .vsync_front_porch = BSP_LCD_MIPI_DSI_LCD_VFP, }, #if CONFIG_BSP_LCD_USE_DMA2D && (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)) .flags.use_dma2d = true, @@ -625,13 +625,12 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l }; dpi_config.num_fbs = CONFIG_BSP_LCD_DPI_BUFFER_NUMS; - ili9881c_vendor_config_t vendor_config = { + st7123_vendor_config_t vendor_config = { .init_cmds = disp_init_data, .init_cmds_size = sizeof(disp_init_data) / sizeof(disp_init_data[0]), .mipi_config = { .dsi_bus = ret_handles->mipi_dsi_bus, .dpi_config = &dpi_config, - .lane_num = BSP_LCD_MIPI_DSI_LANE_NUM, }, }; ESP_LOGD(TAG, "Install LCD driver"); @@ -642,7 +641,7 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l .bits_per_pixel = BSP_LCD_BITS_PER_PIXEL, .vendor_config = &vendor_config, }; - ESP_GOTO_ON_ERROR(esp_lcd_new_panel_ili9881c(ret_handles->io, (const esp_lcd_panel_dev_config_t *)&panel_config, + ESP_GOTO_ON_ERROR(esp_lcd_new_panel_st7123(ret_handles->io, (const esp_lcd_panel_dev_config_t *)&panel_config, &ret_handles->panel), err, TAG, "New panel failed"); disp_handles.panel = ret_handles->panel; #if CONFIG_BSP_LCD_USE_DMA2D && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)) @@ -652,7 +651,7 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l esp_lcd_panel_reset(ret_handles->panel); esp_lcd_panel_init(ret_handles->panel); esp_lcd_panel_invert_color(ret_handles->panel, false); - esp_lcd_panel_swap_xy(ret_handles->panel, false); + //esp_lcd_panel_swap_xy(ret_handles->panel, false); esp_lcd_panel_mirror(ret_handles->panel, false, false); ESP_LOGI(TAG, "Display initialized with resolution %dx%d", BSP_LCD_H_RES, BSP_LCD_V_RES); @@ -776,7 +775,7 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t /* * Keep interrupt pin in low for working touch * Note: This is the fix - there is resistor to 3V3 on interrupt pin - * which is blocking GT911 touch. + * which is blocking ST7123 touch. */ const gpio_config_t int_gpio_config = { .mode = GPIO_MODE_OUTPUT, @@ -789,13 +788,13 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t gpio_set_level(GPIO_NUM_23, 0); esp_lcd_panel_io_handle_t tp_io_handle = NULL; - esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_GT911_CONFIG(); - tp_io_config.dev_addr = ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS_BACKUP; + esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_ST7123_CONFIG(); + tp_io_config.dev_addr = ESP_LCD_TOUCH_IO_I2C_ST7123_ADDRESS; tp_io_config.scl_speed_hz = CONFIG_BSP_I2C_CLK_SPEED_HZ; // This parameter was introduced together with I2C Driver-NG in IDF v5.2 ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_handle, &tp_io_config, &tp_io_handle), TAG, ""); - ESP_RETURN_ON_ERROR(esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, ret_touch), TAG, + ESP_RETURN_ON_ERROR(esp_lcd_touch_new_i2c_st7123(tp_io_handle, &tp_cfg, ret_touch), TAG, "New touch driver initialization failed"); return ESP_OK;