diff --git a/CHANGELOG.md b/CHANGELOG.md index 354bf6b5..57b47074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # ChangeLog +## v0.1.3 - 2024-06-04 + +### Enhancements: + +* feat(board): add add new board M5CORE2 by @MacChu0315-Espressif (#40) + +### Bugfixes: + +* fix(version): fix version mismatch +* fix(docs): update files related to version and board M5CORE2 + ## v0.1.2 - 2024-06-01 ### Enhancements: diff --git a/ESP_Panel_Board_Supported.h b/ESP_Panel_Board_Supported.h index dda0d913..2d9807a6 100644 --- a/ESP_Panel_Board_Supported.h +++ b/ESP_Panel_Board_Supported.h @@ -46,6 +46,14 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * M5Stack (https://m5stack.com/): + * + * - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2 + * + */ +// #define BOARD_M5STACK_M5CORE2 + /* * Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/): * @@ -68,7 +76,7 @@ * */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/README.md b/README.md index 7bcd51bf..70ccea83 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ * [中文版本](./README_CN.md) -ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. Users can develop directly for a variety of [supported development boards](src/board/README.md) or create custom ones through simple adaptation. Additionally, ESP32_Display_Panel is compatible with various LCD and touch drivers, allowing users to develop using standalone drivers as needed. +ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. Users can develop directly for a variety of [supported development boards](src/board/Board_Instructions.md) or create custom ones through simple adaptation. Additionally, ESP32_Display_Panel is compatible with various LCD and touch drivers, allowing users to develop using standalone drivers as needed. ESP32_Display_Panel encapsulates various components from the [Espressif Components Registry](https://components.espressif.com/), requiring development based on [arduino-esp32](https://github.com/espressif/arduino-esp32), and can be directly downloaded from the Arduino IDE. @@ -55,14 +55,15 @@ The functional block diagram of ESP32_Display_Panel is as follows, mainly compri ### Development Boards -Below is a list of [supported development boards](src/board/README.md): +Below is a list of [supported development boards](src/board/Board_Instructions.md): | **Manufacturer** | **Board Model** | | --------------- | --------------- | -| [Espressif](src/board/README.md#espressif) | ESP32-C3-LCDkit, ESP32-S3-Box, ESP32-S3-Box-3, ESP32-S3-Box-3(beta), ESP32-S3-Box-Lite, ESP32-S3-EYE, ESP32-S3-Korvo-2, ESP32-S3-LCD-EV-Board, ESP32-S3-LCD-EV-Board-2, ESP32-S3-USB-OTG | -| [Jingcai](src/board/README.md#shenzhen-jingcai-intelligent) | ESP32-4848S040C_I_Y_3 | +| [Espressif](src/board/Board_Instructions.md#espressif) | ESP32-C3-LCDkit, ESP32-S3-Box, ESP32-S3-Box-3, ESP32-S3-Box-3(beta), ESP32-S3-Box-Lite, ESP32-S3-EYE, ESP32-S3-Korvo-2, ESP32-S3-LCD-EV-Board, ESP32-S3-LCD-EV-Board-2, ESP32-S3-USB-OTG | +| [M5Stack](https://m5stack.com/) | M5STACK-M5CORE2 | +| [Jingcai](src/board/Board_Instructions.md#shenzhen-jingcai-intelligent) | ESP32-4848S040C_I_Y_3 | -Developers and manufacturers are welcome to submit PRs to add more development boards. +Developers and manufacturers are welcomed to contribute PRs to add more development boards. For detailed instructions, please refer to the [`Board Development Guide`](./src/board/Board_Contribution_Guide.md). ### LCD Controllers @@ -297,32 +298,7 @@ To port the SquareLine project (v1.3.x), please refer to [here](#porting-squarel ### Configuring Supported Development Boards -Below are recommended configurations for developing GUI applications on different development boards. These settings can be adjusted according to specific requirements, and users can navigate to the `Tools` menu in the Arduino IDE to configure the following settings. - -| Supported Boards | Selected Board | PSRAM | Flash Mode | Flash Size | USB CDC On Boot | Partition Scheme | -| :---------------------: | :----------------: | :------: | :--------: | :--------: | :-------------: | :---------------------: | -| ESP32-C3-LCDkit | ESP32C3 Dev Module | Disabled | QIO | 4MB (32Mb) | Enabled | Default 4MB with spiffs | -| ESP32-S3-Box | ESP32-S3-Box | - | - | - | - | 16M Flash (3MB) | -| ESP32-S3-Box-3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| ESP32-S3-Box-3(beta) | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| ESP32-S3-Box-Lite | ESP32-S3-Box | - | - | - | - | 16M Flash (3MB) | -| ESP32-S3-EYE | ESP32S3 Dev Module | OPI | QIO 80MHz | 8MB | Enabled | 8M with spiffs | -| ESP32-S3-Korvo-2 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | -| ESP32-S3-LCD-EV-Board | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | **See Note 1** | 16M Flash (3MB) | -| ESP32-S3-LCD-EV-Board-2 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | **See Note 1** | 16M Flash (3MB) | -| ESP32-S3-USB-OTG | ESP32-S3-USB-OTG | - | - | - | - | 8M with spiffs | -| ESP32-4848S040C_I_Y_3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | - -**Notes:** - -1. Enable or disable `USB CDC On Boot` based on the type of port used: - - * Disable this configuration if using **UART** port; enable it if using **USB** port. - * If this configuration differs from previous flashing, first enable `Erase All Flash Before Sketch Upload`, then it can be disabled after flashing. - * If this configuration does not match the actual port type, it will prevent the development board from printing serial logs correctly. - -2. To view more output logs, set `Core Debug Level` to `Info` or a lower level. -3. If the predefined partition schemes provided by ESP32 do not meet the requirements, users can also select `Custom` in the "Partition Scheme" and create a custom partition table file `Custom.csv` in the `hardware/esp32/3.x.x/tools/partitions` directory under the [arduino-esp32 installation directory](#where-are-the-installation-directory-for-arduino-esp32-and-the-sdk-located). For detailed information on partition tables, please refer to the [ESP-IDF documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html). +For details on how to configure the supported development boards in the Arduino IDE, see [Board_Instructions.md](./src/board/Board_Instructions.md). ### Configuring LVGL diff --git a/README_CN.md b/README_CN.md index a663a836..745bb675 100644 --- a/README_CN.md +++ b/README_CN.md @@ -4,7 +4,7 @@ * [English Version](./README.md) -ESP32_Display_Panel 是专为 ESP SoCs 设计的 Arduino 库,用于驱动显示屏并实现快速 GUI 开发。用户不仅可以直接开发多款[内部支持的开发板](src/board/README.md),还可以通过简单的适配来开发自定义的开发板。此外,ESP32_Display_Panel 还适配了多款 LCD 和触摸的驱动,用户也可以根据需要使用独立的驱动进行开发。 +ESP32_Display_Panel 是专为 ESP SoCs 设计的 Arduino 库,用于驱动显示屏并实现快速 GUI 开发。用户不仅可以直接开发多款[内部支持的开发板](src/board/Board_Instructions.md),还可以通过简单的适配来开发自定义的开发板。此外,ESP32_Display_Panel 还适配了多款 LCD 和触摸的驱动,用户也可以根据需要使用独立的驱动进行开发。 ESP32_Display_Panel 封装了多种[乐鑫组件库](https://components.espressif.com/)中相关的组件,需要基于 [arduino-esp32](https://github.com/espressif/arduino-esp32) 进行开发,并且可以直接从 Arduino IDE 中下载获取。 @@ -55,14 +55,15 @@ ESP32_Display_Panel 的功能框图如下所示,主要包含以下特性: ### 开发板 -下面是支持的[开发板列表](src/board/README.md): +下面是支持的[开发板列表](src/board/Board_Instructions.md): | **厂商** | **开发板型号** | | -------- | -------------- | -| [Espressif](src/board/README.md#espressif) | ESP32-C3-LCDkit, ESP32-S3-Box, ESP32-S3-Box-3, ESP32-S3-Box-3(beta), ESP32-S3-Box-Lite, ESP32-S3-EYE, ESP32-S3-Korvo-2, ESP32-S3-LCD-EV-Board, ESP32-S3-LCD-EV-Board-2, ESP32-S3-USB-OTG | -| [Jingcai](src/board/README.md#shenzhen-jingcai-intelligent) | ESP32-4848S040C_I_Y_3 | +| [Espressif](src/board/Board_Instructions.md#espressif) | ESP32-C3-LCDkit, ESP32-S3-Box, ESP32-S3-Box-3, ESP32-S3-Box-3(beta), ESP32-S3-Box-Lite, ESP32-S3-EYE, ESP32-S3-Korvo-2, ESP32-S3-LCD-EV-Board, ESP32-S3-LCD-EV-Board-2, ESP32-S3-USB-OTG | +| [M5Stack](https://m5stack.com/) | M5STACK-M5CORE2 | +| [Jingcai](src/board/Board_Instructions.md#shenzhen-jingcai-intelligent) | ESP32-4848S040C_I_Y_3 | -欢迎开发者和厂商提交 PR 来添加更多的开发板。 +欢迎开发者和厂商贡献 PR 来添加更多的开发板,详细说明请参考 [`开发板贡献指南`](./src/board/Board_Contribution_Guide_CN.md)。 ### LCD 控制器 @@ -297,32 +298,7 @@ ESP32_Display_Panel 会根据 [ESP_Panel_Board_Custom.h](./ESP_Panel_Board_Custo ### 配置支持的开发板 -下面是在不同开发板上开发 GUI 应用程序的建议配置,这些设置能够根据实际需求进行调整,用户可以前往 Arduino IDE 中的工具菜单来配置以下设置 - -| Supported Boards | Selected Board | PSRAM | Flash Mode | Flash Size | USB CDC On Boot | Partition Scheme | -| :---------------------: | :----------------: | :------: | :--------: | :--------: | :-------------: | :---------------------: | -| ESP32-C3-LCDkit | ESP32C3 Dev Module | Disabled | QIO | 4MB (32Mb) | Enabled | Default 4MB with spiffs | -| ESP32-S3-Box | ESP32-S3-Box | - | - | - | - | 16M Flash (3MB) | -| ESP32-S3-Box-3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| ESP32-S3-Box-3(beta) | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | -| ESP32-S3-Box-Lite | ESP32-S3-Box | - | - | - | - | 16M Flash (3MB) | -| ESP32-S3-EYE | ESP32S3 Dev Module | OPI | QIO 80MHz | 8MB | Enabled | 8M with spiffs | -| ESP32-S3-Korvo-2 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | -| ESP32-S3-LCD-EV-Board | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | **See Note 1** | 16M Flash (3MB) | -| ESP32-S3-LCD-EV-Board-2 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | **See Note 1** | 16M Flash (3MB) | -| ESP32-S3-USB-OTG | ESP32-S3-USB-OTG | - | - | - | - | 8M with spiffs | -| ESP32-4848S040C_I_Y_3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | - -**Notes:** - -1. 根据使用的端口类型启用或关闭 `USB CDC On Boot`: - - * 如果使用 **UART** 端口,则禁用此配置;如果使用 **USB** 端口,则启用它。 - * 如果此配置与先前的刷写不同,应首先启用 `Erase All Flash Before Sketch Upload`,然后在刷写后可以禁用它。 - * 如果此配置不符合实际端口类型,将导致开发板无法正常打印串口日志。 - -2. 若要查看更多输出日志,请将 `Core Debug Level` 设置为 `Info` 或更低级别 -3. 若 esp32 提供的预设分区方案都不满足需求,用户也可以在 "Partition Scheme" 中选择 `Custom`,并在 [arduino-esp32 安装目录](#arduino-eps32-的安装目录以及-sdk-的目录在哪儿)下的 `hardware/esp32/3.x.x/tools/partitions` 目录中创建自定义的分区表文件 `Custome.csv`,关于分区表的详细信息请参考 [ESP-IDF 文档](https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-guides/partition-tables.html)。 +关于如何在 Arduino IDE 中配置支持的开发板,请参考 [Board_Instructions.md](./src/board/Board_Instructions.md). ### 配置 LVGL diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h index dda0d913..2d9807a6 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h @@ -46,6 +46,14 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * M5Stack (https://m5stack.com/): + * + * - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2 + * + */ +// #define BOARD_M5STACK_M5CORE2 + /* * Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/): * @@ -68,7 +76,7 @@ * */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/LVGL/v8/Porting/lvgl_port_v8.h b/examples/LVGL/v8/Porting/lvgl_port_v8.h index c3102369..f7cdb7ca 100644 --- a/examples/LVGL/v8/Porting/lvgl_port_v8.h +++ b/examples/LVGL/v8/Porting/lvgl_port_v8.h @@ -36,7 +36,7 @@ * - The number of buffers should be 1 or 2. * */ -#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL) // Allocate LVGL buffer in SRAM +#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) // Allocate LVGL buffer in SRAM // #define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_SPIRAM) // Allocate LVGL buffer in PSRAM #define LVGL_PORT_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 20) #define LVGL_PORT_BUFFER_NUM (2) diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h index dda0d913..2d9807a6 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h @@ -46,6 +46,14 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * M5Stack (https://m5stack.com/): + * + * - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2 + * + */ +// #define BOARD_M5STACK_M5CORE2 + /* * Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/): * @@ -68,7 +76,7 @@ * */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/LVGL/v8/Rotation/lvgl_port_v8.h b/examples/LVGL/v8/Rotation/lvgl_port_v8.h index c3102369..f7cdb7ca 100644 --- a/examples/LVGL/v8/Rotation/lvgl_port_v8.h +++ b/examples/LVGL/v8/Rotation/lvgl_port_v8.h @@ -36,7 +36,7 @@ * - The number of buffers should be 1 or 2. * */ -#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL) // Allocate LVGL buffer in SRAM +#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) // Allocate LVGL buffer in SRAM // #define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_SPIRAM) // Allocate LVGL buffer in PSRAM #define LVGL_PORT_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 20) #define LVGL_PORT_BUFFER_NUM (2) diff --git a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h index dda0d913..2d9807a6 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h +++ b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h @@ -46,6 +46,14 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * M5Stack (https://m5stack.com/): + * + * - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2 + * + */ +// #define BOARD_M5STACK_M5CORE2 + /* * Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/): * @@ -68,7 +76,7 @@ * */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h index dda0d913..2d9807a6 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h @@ -46,6 +46,14 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * M5Stack (https://m5stack.com/): + * + * - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2 + * + */ +// #define BOARD_M5STACK_M5CORE2 + /* * Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/): * @@ -68,7 +76,7 @@ * */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/SquareLine/v8/Porting/lvgl_port_v8.h b/examples/SquareLine/v8/Porting/lvgl_port_v8.h index c3102369..f7cdb7ca 100644 --- a/examples/SquareLine/v8/Porting/lvgl_port_v8.h +++ b/examples/SquareLine/v8/Porting/lvgl_port_v8.h @@ -36,7 +36,7 @@ * - The number of buffers should be 1 or 2. * */ -#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL) // Allocate LVGL buffer in SRAM +#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) // Allocate LVGL buffer in SRAM // #define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_SPIRAM) // Allocate LVGL buffer in PSRAM #define LVGL_PORT_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 20) #define LVGL_PORT_BUFFER_NUM (2) diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h index dda0d913..2d9807a6 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h @@ -46,6 +46,14 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * M5Stack (https://m5stack.com/): + * + * - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2 + * + */ +// #define BOARD_M5STACK_M5CORE2 + /* * Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/): * @@ -68,7 +76,7 @@ * */ #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 #endif diff --git a/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h b/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h index c3102369..f7cdb7ca 100644 --- a/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h +++ b/examples/SquareLine/v8/WiFiClock/lvgl_port_v8.h @@ -36,7 +36,7 @@ * - The number of buffers should be 1 or 2. * */ -#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL) // Allocate LVGL buffer in SRAM +#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) // Allocate LVGL buffer in SRAM // #define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_SPIRAM) // Allocate LVGL buffer in PSRAM #define LVGL_PORT_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 20) #define LVGL_PORT_BUFFER_NUM (2) diff --git a/library.properties b/library.properties index 68a7f205..908d5a7a 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ name=ESP32_Display_Panel -version=0.1.2 +version=0.1.3 author=espressif maintainer=espressif sentence=ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. -paragraph=Currently supported boards:ESP32-C3-LCDkit,ESP32-S3-Box,ESP32-S3-Box-3,ESP32-S3-Box-3(beta),ESP32-S3-Box-Lite,ESP32-S3-EYE,ESP32-S3-Korvo-2,ESP32-S3-LCD-EV-Board,ESP32-S3-LCD-EV-Board-2,ESP32-S3-USB-OTG,ESP32-4848S040C_I_Y_3. Currently supported devices: Bus,LCD,Touch,Backlight,IO expander. Currently supported Bus: I2C,SPI,QSPI,3-wire SPI + RGB. Currently supported LCD controllers: GC9A01,GC9B71,GC9503,ILI9341,NV3022B,ST7262,ST7701,ST7789,ST7796,ST77916,ST77922. Currently supported Touch controllers: CST816S,FT5x06,GT1151,GT911,ST7123,TT21100,XPT2046. +paragraph=Currently supported boards:ESP32-C3-LCDkit,ESP32-S3-Box,ESP32-S3-Box-3,ESP32-S3-Box-3(beta),ESP32-S3-Box-Lite,ESP32-S3-EYE,ESP32-S3-Korvo-2,ESP32-S3-LCD-EV-Board,ESP32-S3-LCD-EV-Board-2,ESP32-S3-USB-OTG,M5STACK-M5CORE2,ESP32-4848S040C_I_Y_3. Currently supported devices: Bus,LCD,Touch,Backlight,IO expander. Currently supported Bus: I2C,SPI,QSPI,3-wire SPI + RGB. Currently supported LCD controllers: GC9A01,GC9B71,GC9503,ILI9341,NV3022B,ST7262,ST7701,ST7789,ST7796,ST77916,ST77922. Currently supported Touch controllers: CST816S,FT5x06,GT1151,GT911,ST7123,TT21100,XPT2046. category=Other architectures=esp32 url=https://github.com/esp-arduino-libs/ESP32_Display_Panel diff --git a/src/ESP_PanelVersions.h b/src/ESP_PanelVersions.h index b2b0844f..8788bc1f 100644 --- a/src/ESP_PanelVersions.h +++ b/src/ESP_PanelVersions.h @@ -11,7 +11,7 @@ /* Library Version */ #define ESP_PANEL_VERSION_MAJOR 0 #define ESP_PANEL_VERSION_MINOR 1 -#define ESP_PANEL_VERSION_PATCH 2 +#define ESP_PANEL_VERSION_PATCH 3 /* File `ESP_Panel_Conf.h` */ #define ESP_PANEL_CONF_VERSION_MAJOR 0 @@ -25,7 +25,7 @@ /* File `ESP_Panel_Board_Supported.h` */ #define ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR 0 -#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR 2 #define ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH 0 /* Check if the current configuration file version is compatible with the library version */ diff --git a/src/board/Board_Contribution_Guide.md b/src/board/Board_Contribution_Guide.md new file mode 100644 index 00000000..6842f65c --- /dev/null +++ b/src/board/Board_Contribution_Guide.md @@ -0,0 +1,61 @@ +# Board Contribution Guide + +1. Newly added development boards must ensure the hardware schematics are open-source. Please provide a link or file. +2. This library currently only supports the APIs provided in ESP-IDF. It does not support other Arduino library APIs, such as Wire. + +**Note**: +1. It is recommended to use the vscode + Arduino CLI development environment. +2. Pull the ESP32_Display_Panel repository into the Arduino library directory before making modifications. +3. The project uses pre-commit to enforce commit standards. It is recommended to install the pre-commit library before committing using the following command: + +``` +pip3 install pre-commit && pre-commit install +``` + +## Modification Content + +Using the adaption of the `M5Stack M5CORE2` development board as an example. Following this guide, changes below will be made under the project: + +``` +| -ESP32_Display_Panel + | -src + | -board + | -m5stack [A] + | -M5CORE2.h [A] + | -ESP_PanelBoard [M] + | -README.md [M] + | -ESP_PanelVersions.h [M] + | -CHANGELOG.md [M] + | -ESP_Panel_Board_Custom.h + | -ESP_Panel_Board_Supported.h [M] + | -library.properties [M] + | -README_CN.md [M] + | -README.md [M] +``` +Note: [A] stands for 'append' and [M] stands for 'modify' + +## Modification Process + +Using the adaption of `M5Stack M5CORE2` as an example, follow these steps to modify the relevant files: + +1. **[M]** *[ESP_Panel_Board_Supported.h](../../ESP_Panel_Board_Supported.h)*: Add a macro for the new development board, such as `BOARD_M5STACK_M5CORE2`. Ensure the macro is in uppercase. Include the manufacturer's name and link, as well as the target development board's link. +2. **[A]** *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*: Use the *ESP_Panel_Board_Custom.h* file in the root directory as a template to create a new configuration header file for the development board. Follow the naming conventions of existing development boards. +3. **[M]** *[src/board/ESP_PanelBoard.h](../board/ESP_PanelBoard.h)*: Add the macro check for the new development board by referring to the existing boards in the file, and modify the file to use the correct header file for this development board. + + **Note**: At this point, you can verify the above steps: + + - Choose an example, such as *[examples/Panel/PanelTest](../../examples/Panel/PanelTest/)*. + - modify the macro `ESP_PANEL_USE_SUPPORTED_BOARD` to enable this header file. Define the development board macro, such as `BOARD_M5STACK_M5CORE2`, to enable the new header file *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*. + - Verify the example's ino file. If successful, proceed to the following steps. + +4. **[M]** *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*: Modify the configuration header file for the new development board: + - Review the hardware schematics of the development board, focusing on the BUS type used for the LCD screen, the LCD driver name, the BUS type used for touch, the touch driver name, and the chip pin numbers used for each interface of the LCD and touch. + - The best practice is to first get the screen working, then work on the touch functionality. + - If the new development board's driver is compatible with an existing driver, there is no need to add a new driver. Simply note in the comments that this driver is compatible with an existing one and use the existing driver. + - If the driver used by the new development board is not compatible with existing drivers or has other special configurations, you can achieve this by modifying the macro functions at the end of the new development board's configuration header file, such as `ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION`, `ESP_PANEL_BEGIN_END_FUNCTION`, etc. Refer to *[src/board/espressif/ESP32_S3_BOX_3.h](../board/espressif/ESP32_S3_BOX_3.h)* or *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)* for specific implementations. + - Run examples other than *[examples/LCD](../../examples/LCD/)* and *[examples/Touch](../../examples/Touch/)*, and continuously adjust the configuration header file to ensure correct settings. + +5. **[M]** *[ESP_Panel_Board_Supported](../../ESP_Panel_Board_Supported.h)*, *[library.properties](../../library.properties)*, *[board/Board_Instructions.md](../board/Board_Instructions.md)*, *[README_CN.md](../../README_CN.md)*, *[README.md](../../README.md)*: Update the supported development boards information in these files. +6. **[M]** *[src/board/Board_Instructions.md](../board/Board_Instructions.md)*: Update the recommended configuration for the new development board. +7. **[M]** *[src/ESP_PanelVersions.h](../ESP_PanelVersions.h)*: Ensure that the version under `Library Version` should be ahead of the latest tag version in terms of the minor version; when changes occur to *[ESP_Panel_Board_Custom.h](../../ESP_Panel_Board_Custom.h)*, *[ESP_Panel_Board_Supported.h](../../ESP_Panel_Board_Supported.h)*, and *[ESP_Panel_Conf.h](../../ESP_Panel_Conf.h)* in the root directory, the minor version number but patch version number at the end of the corresponding file and at the beginging of *[src/ESP_PanelVersions.h](../ESP_PanelVersions.h)* should be increased by one and reset the patch version number to 0. +8. **[M]** *[CHANGELOG.md](../../CHANGELOG.md)*: Update the changelog. \ No newline at end of file diff --git a/src/board/Board_Contribution_Guide_CN.md b/src/board/Board_Contribution_Guide_CN.md new file mode 100644 index 00000000..74c59763 --- /dev/null +++ b/src/board/Board_Contribution_Guide_CN.md @@ -0,0 +1,61 @@ +# 开发板贡献指南 + +1. 新添加的开发板需要确保硬件原理图开源,需要提供链接或文件。 +2. 该库目前仅支持 ESP-IDF 提供的 API,不支持其他 Arduino 库 API,如 Wire。 + +**注意**: +1. 推荐使用 vscode + Arduino CLI 开发环境。 +2. 在进行修改之前,将 ESP32_Display_Panel 仓库拉入 Arduino 库目录中。 +3. 项目使用 pre-commit 来规范提交内容,因此建议在提交之前安装 pre-commit 库,使用以下命令: + +``` +pip3 install pre-commit && pre-commit install +``` + +## 需修改内容 + +以适配 `M5Stack M5CORE2` 开发板为例。按照本指南,以下更改将在项目中进行: + +``` +| -ESP32_Display_Panel + | -src + | -board + | -m5stack [A] + | -M5CORE2.h [A] + | -ESP_PanelBoard [M] + | -README.md [M] + | -ESP_PanelVersions.h [M] + | -CHANGELOG.md [M] + | -ESP_Panel_Board_Custom.h + | -ESP_Panel_Board_Supported.h [M] + | -library.properties [M] + | -README_CN.md [M] + | -README.md [M] +``` +注:[A] 代表 '添加',[M] 代表 '修改' + +## 各文件修改流程 + +以适配 `M5Stack M5CORE2` 为例,按照以下步骤修改相关文件: + +1. **[M]** *[ESP_Panel_Board_Supported.h](../../ESP_Panel_Board_Supported.h)*:为新开发板添加一个宏,例如 `BOARD_M5STACK_M5CORE2`。命名时注意宏名大写。注意附上开发板制造商的名称和链接,以及目标开发板的链接。 +2. **[A]** *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*:使用根目录中的 *ESP_Panel_Board_Custom.h* 文件作为模板,为开发板创建一个新的配置头文件。文件命名请参考已有开发板。 +3. **[M]** *[src/board/ESP_PanelBoard.h](../board/ESP_PanelBoard.h)*:参照文件中其他开发板的写法,添加新开发板的宏名判断,并注意修改此开发板所使用的头文件。 + + **注意**:此时,可以验证上述步骤: + + - 选择一个示例,例如 *[examples/Panel/PanelTest](../../examples/Panel/PanelTest/)*。 + - 修改宏 `ESP_PANEL_USE_SUPPORTED_BOARD` 以启用此头文件。定义开发板宏,例如 `BOARD_M5STACK_M5CORE2`,以启用新的头文件 *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*。 + - 验证示例的 ino 文件。如果成功,继续后续步骤。 + +4. **[M]** *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*:修改新开发板的配置头文件: + - 审查开发板的硬件原理图,重点关注LCD 屏幕所使用 BUS 类型、 LCD 驱动名、touch 所使用 BUS 类型、touch 驱动名,以及 LCD 和 touch 各接口所使用的芯片管脚号。 + - 修改技巧是先亮屏再 touch。 + - 如果新开发板的驱动程序与现有驱动程序兼容,则无需添加新驱动程序。只需在注释中注明该驱动程序与现有驱动程序兼容,并使用现有驱动程序。 + - 如果新开发板使用的驱动程序与现有驱动程序不兼容或有其他特殊配置,可以通过修改新开发板配置头文件末尾的宏函数来实现,例如 `ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION`、`ESP_PANEL_BEGIN_END_FUNCTION` 等。具体实现请参考 *[src/board/espressif/ESP32_S3_BOX_3.h](../board/espressif/ESP32_S3_BOX_3.h)* 或 *[src/board/m5stack/M5CORE2.h](../board/m5stack/M5CORE2.h)*。 + - 运行除 *[examples/LCD](../../examples/LCD/)* 和 *[examples/Touch](../../examples/Touch/)* 以外的示例,并不断调整配置头文件以确保设置正确。 + +5. **[M]** *[ESP_Panel_Board_Supported](../../ESP_Panel_Board_Supported.h)*、*[library.properties](../../library.properties)*、*[board/Board_Instructions.md](../board/Board_Instructions.md)*、*[README_CN.md](../../README_CN.md)*、*[README.md](../../README.md)*:更新上述文件中“已支持开发板”说明。 +6. **[M]** *[src/board/Board_Instructions.md](../board/Board_Instructions.md)*:更新新开发板的推荐配置。 +7. **[M]** *[src/ESP_PanelVersions.h](../ESP_PanelVersions.h)*:确保 `Library Version` 下的版本应领先于最新标签版本的小版本;当根目录下的 *[ESP_Panel_Board_Custom.h](../../ESP_Panel_Board_Custom.h)*、*[ESP_Panel_Board_Supported.h](../../ESP_Panel_Board_Supported.h)* 和 *[ESP_Panel_Conf.h](../../ESP_Panel_Conf.h)* 发生变化时,相应文件末尾和 *[src/ESP_PanelVersions.h](../ESP_PanelVersions.h)* 开头的小版本号应增加一个,并将补丁版本号重置为 0。 +8. **[M]** *[CHANGELOG.md](../../CHANGELOG.md)*:更新变更日志。 \ No newline at end of file diff --git a/src/board/README.md b/src/board/Board_Instructions.md similarity index 53% rename from src/board/README.md rename to src/board/Board_Instructions.md index 5e1870f8..ea0561e4 100644 --- a/src/board/README.md +++ b/src/board/Board_Instructions.md @@ -1,6 +1,8 @@ -# Internal Supported Development Boards +# Development board -## [Espressif](https://www.espressif.com/en/products/devkits) +## Internal Supported Development Boards + +### [Espressif](https://www.espressif.com/en/products/devkits) | **Picture** | **Name** | **LCD Bus** | **LCD Controller** | **Touch Bus** | **Touch Controller** | | :--------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------: | :--------------: | :----------------: | :-----------: | :------------------: | @@ -15,8 +17,44 @@ | | [ESP32-S3-LCD-EV-Board-2](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/index.html) | RGB | ST7262E43 | I2C | GT1151 | | | [ESP32-S3-USB-OTG](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-usb-otg/index.html) | SPI | ST7789 | - | - | -## [Shenzhen Jingcai Intelligent](https://www.displaysmodule.com/) +### [M5Stack](https://m5stack.com/) + +| **Picture** | **Name** | **LCD Bus** | **LCD Controller** | **Touch Bus** | **Touch Controller** | +| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :--------------: | :----------------: | :-----------: | :------------------: | +| [](https://www.displaysmodule.com/sale-41828962-experience-the-power-of-the-esp32-display-module-sku-esp32-4848s040c-i-y-3.html) | [M5STACK_M5CORE2](https://docs.m5stack.com/zh_CN/core/core2) | SPI | ILI9342C | I2C | FT6336U | + +### [Shenzhen Jingcai Intelligent](https://www.displaysmodule.com/) | **Picture** | **Name** | **LCD Bus** | **LCD Controller** | **Touch Bus** | **Touch Controller** | | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :--------------: | :----------------: | :-----------: | :------------------: | | [](https://www.displaysmodule.com/sale-41828962-experience-the-power-of-the-esp32-display-module-sku-esp32-4848s040c-i-y-3.html) | [ESP32-4848S040C_I_Y_3](http://pan.jczn1688.com/directlink/1/ESP32%20module/4.0inch_ESP32-4848S040.zip) | 3-wire SPI + RGB | ST7701 | I2C | GT911 | + +## Recommended Configurations in the Arduino IDE + +Below are recommended configurations for developing GUI applications on different development boards. These settings can be adjusted according to specific requirements, and users can navigate to the `Tools` menu in the Arduino IDE to configure the following settings. + +| Supported Boards | Selected Board | PSRAM | Flash Mode | Flash Size | USB CDC On Boot | Partition Scheme | +| :---------------------: | :----------------: | :------: | :--------: | :--------: | :-------------: | :---------------------: | +| ESP32-C3-LCDkit | ESP32C3 Dev Module | Disabled | QIO | 4MB (32Mb) | Enabled | Default 4MB with spiffs | +| ESP32-S3-Box | ESP32-S3-Box | - | - | - | - | 16M Flash (3MB) | +| ESP32-S3-Box-3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| ESP32-S3-Box-3(beta) | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | 16M Flash (3MB) | +| ESP32-S3-Box-Lite | ESP32-S3-Box | - | - | - | - | 16M Flash (3MB) | +| ESP32-S3-EYE | ESP32S3 Dev Module | OPI | QIO 80MHz | 8MB | Enabled | 8M with spiffs | +| ESP32-S3-Korvo-2 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | +| ESP32-S3-LCD-EV-Board | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | **See Note 1** | 16M Flash (3MB) | +| ESP32-S3-LCD-EV-Board-2 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | **See Note 1** | 16M Flash (3MB) | +| ESP32-S3-USB-OTG | ESP32-S3-USB-OTG | - | - | - | - | 8M with spiffs | +| M5STACK-M5CORE2 | M5Stack-Core2 | Enabled | - | - | - | Default | +| ESP32-4848S040C_I_Y_3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | + +**Notes:** + +1. Enable or disable `USB CDC On Boot` based on the type of port used: + + * Disable this configuration if using **UART** port; enable it if using **USB** port. + * If this configuration differs from previous flashing, first enable `Erase All Flash Before Sketch Upload`, then it can be disabled after flashing. + * If this configuration does not match the actual port type, it will prevent the development board from printing serial logs correctly. + +2. To view more output logs, set `Core Debug Level` to `Info` or a lower level. +3. If the predefined partition schemes provided by ESP32 do not meet the requirements, users can also select `Custom` in the "Partition Scheme" and create a custom partition table file `Custom.csv` in the `hardware/esp32/3.x.x/tools/partitions` directory under the [arduino-esp32 installation directory](#where-are-the-installation-directory-for-arduino-esp32-and-the-sdk-located). For detailed information on partition tables, please refer to the [ESP-IDF documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html). diff --git a/src/board/ESP_PanelBoard.h b/src/board/ESP_PanelBoard.h index ed023797..23ee0a2f 100644 --- a/src/board/ESP_PanelBoard.h +++ b/src/board/ESP_PanelBoard.h @@ -13,8 +13,8 @@ defined(BOARD_ESP32_S3_BOX_3_BETA) + defined(BOARD_ESP32_S3_BOX_LITE) + defined(BOARD_ESP32_S3_EYE) + \ defined(BOARD_ESP32_S3_KORVO_2) + defined(BOARD_ESP32_S3_LCD_EV_BOARD) + \ defined(BOARD_ESP32_S3_LCD_EV_BOARD_V1_5) + defined(BOARD_ESP32_S3_LCD_EV_BOARD_2) + \ - defined(BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5) + defined(BOARD_ESP32_S3_USB_OTG) + \ - defined(BOARD_ESP32_4848S040C_I_Y_3) \ + defined(BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5) + defined(BOARD_ESP32_S3_USB_OTG) + \ + defined(BOARD_M5STACK_M5CORE2) + defined(BOARD_ESP32_4848S040C_I_Y_3) \ > 1 #error "Multiple boards enabled! Please check file `ESP_Panel_Board_Supported.h` and make sure only one board is enabled." #endif @@ -45,6 +45,9 @@ #include "board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h" #elif defined(BOARD_ESP32_S3_USB_OTG) || CONFIG_BOARD_ESP32_S3_USB_OTG #include "board/espressif/ESP32_S3_USB_OTG.h" +/* M5Stack */ +#elif defined(BOARD_M5STACK_M5CORE2) || CONFIG_BOARD_M5STACK_M5CORE2 + #include "board/m5stack/M5CORE2.h" /* Jingcai */ #elif defined(BOARD_ESP32_4848S040C_I_Y_3) || CONFIG_BOARD_ESP32_4848S040C_I_Y_3 #include "board/jingcai/ESP32_4848S040C_I_Y_3.h" diff --git a/src/board/m5stack/M5CORE2.h b/src/board/m5stack/M5CORE2.h new file mode 100644 index 00000000..adc98cfa --- /dev/null +++ b/src/board/m5stack/M5CORE2.h @@ -0,0 +1,244 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +// *INDENT-OFF* + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the LCD panel ///////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* Set to 1 when using an LCD panel */ +#define ESP_PANEL_USE_LCD (1) // 0/1 + +#if ESP_PANEL_USE_LCD +/** + * LCD Controller Name. + * LCD Controller of M5Core2 is ILI9342C, but the driver is compatible with ILI9341. + */ +#define ESP_PANEL_LCD_NAME ILI9341 + +/* LCD resolution in pixels */ +#define ESP_PANEL_LCD_WIDTH (320) +#define ESP_PANEL_LCD_HEIGHT (240) + +/* LCD Bus Settings */ +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * It is useful if other devices use the same host. Please ensure that the host is initialized only once. + */ +#define ESP_PANEL_LCD_BUS_SKIP_INIT_HOST (0) // 0/1 +/** + * LCD Bus Type. + */ +#define ESP_PANEL_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_SPI) +/** + * LCD Bus Parameters. + * + * Please refer to https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/lcd.html and + * https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/lcd/index.html for more details. + * + */ +#if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + + #define ESP_PANEL_LCD_BUS_HOST_ID (1) // Typically set to 1 + #define ESP_PANEL_LCD_SPI_IO_CS (5) +#if !ESP_PANEL_LCD_BUS_SKIP_INIT_HOST + #define ESP_PANEL_LCD_SPI_IO_SCK (18) + #define ESP_PANEL_LCD_SPI_IO_MOSI (23) + #define ESP_PANEL_LCD_SPI_IO_MISO (-1) // -1 if not used +#endif + #define ESP_PANEL_LCD_SPI_IO_DC (15) + #define ESP_PANEL_LCD_SPI_MODE (0) // 0/1/2/3, typically set to 0 + #define ESP_PANEL_LCD_SPI_CLK_HZ (40 * 1000 * 1000) + // Should be an integer divisor of 80M, typically set to 40M + #define ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ (10) // Typically set to 10 + #define ESP_PANEL_LCD_SPI_CMD_BITS (8) // Typically set to 8 + #define ESP_PANEL_LCD_SPI_PARAM_BITS (8) // Typically set to 8 + +#endif /* ESP_PANEL_LCD_BUS_TYPE */ + +/** + * LCD Venbdor Initialization Commands. + * + * Vendor specific initialization can be different between manufacturers, should consult the LCD supplier for + * initialization sequence code. Please uncomment and change the following macro definitions. Otherwise, the LCD driver + * will use the default initialization sequence code. + * + * There are two formats for the sequence code: + * 1. Raw data: {command, (uint8_t []){ data0, data1, ... }, data_size, delay_ms} + * 2. Formater: ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(delay_ms, command, { data0, data1, ... }) and + * ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(delay_ms, command) + */ +// #define ESP_PANEL_LCD_VENDOR_INIT_CMD \ +// { \ +// {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0}, \ +// {0xC0, (uint8_t []){0x3B, 0x00}, 2, 0}, \ +// {0xC1, (uint8_t []){0x0D, 0x02}, 2, 0}, \ +// {0x29, (uint8_t []){0x00}, 0, 120}, \ +// or \ +// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xFF, {0x77, 0x01, 0x00, 0x00, 0x10}), \ +// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC0, {0x3B, 0x00}), \ +// ESP_PANEL_LCD_CMD_WITH_8BIT_PARAM(0, 0xC1, {0x0D, 0x02}), \ +// ESP_PANEL_LCD_CMD_WITH_NONE_PARAM(120, 0x29), \ +// } + +/* LCD Color Settings */ +/* LCD color depth in bits */ +#define ESP_PANEL_LCD_COLOR_BITS (16) // 8/16/18/24 +/* + * LCD RGB Element Order. Choose one of the following: + * - 0: RGB + * - 1: BGR + */ +#define ESP_PANEL_LCD_BGR_ORDER (1) // 0/1 +#define ESP_PANEL_LCD_INEVRT_COLOR (1) // 0/1 + +/* LCD Transformation Flags */ +#define ESP_PANEL_LCD_SWAP_XY (0) // 0/1 +#define ESP_PANEL_LCD_MIRROR_X (0) // 0/1 +#define ESP_PANEL_LCD_MIRROR_Y (0) // 0/1 + +/* LCD Other Settings */ +/* IO num of RESET pin, set to -1 if not use */ +#define ESP_PANEL_LCD_IO_RST (-1) +#define ESP_PANEL_LCD_RST_LEVEL (0) // 0: low level, 1: high level + +#endif /* ESP_PANEL_USE_LCD */ + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////// Please update the following macros to configure the touch panel /////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* Set to 1 when using an touch panel */ +#define ESP_PANEL_USE_TOUCH (1) // 0/1 +#if ESP_PANEL_USE_TOUCH +/** + * Touch controller name. + * Touch Controller of M5Core2 is FT6336U, but the driver is compatible with FT5x06. + */ +#define ESP_PANEL_TOUCH_NAME FT5x06 + +/* Touch resolution in pixels */ +#define ESP_PANEL_TOUCH_H_RES (ESP_PANEL_LCD_WIDTH) // Typically set to the same value as the width of LCD +#define ESP_PANEL_TOUCH_V_RES (ESP_PANEL_LCD_HEIGHT) // Typically set to the same value as the height of LCD + +/* Touch Panel Bus Settings */ +/** + * If set to 1, the bus will skip to initialize the corresponding host. Users need to initialize the host in advance. + * It is useful if other devices use the same host. Please ensure that the host is initialized only once. + */ +#define ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST (0) // 0/1 +/** + * Touch panel bus type. + */ +#define ESP_PANEL_TOUCH_BUS_TYPE (ESP_PANEL_BUS_TYPE_I2C) +/* Touch panel bus parameters */ +#if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + #define ESP_PANEL_TOUCH_BUS_HOST_ID (0) // Typically set to 0 + #define ESP_PANEL_TOUCH_I2C_ADDRESS (0) // Typically set to 0 to use default address +#if !ESP_PANEL_TOUCH_BUS_SKIP_INIT_HOST + #define ESP_PANEL_TOUCH_I2C_CLK_HZ (400 * 1000) + // Typically set to 400K + #define ESP_PANEL_TOUCH_I2C_SCL_PULLUP (0) // 0/1 + #define ESP_PANEL_TOUCH_I2C_SDA_PULLUP (0) // 0/1 + #define ESP_PANEL_TOUCH_I2C_IO_SCL (22) + #define ESP_PANEL_TOUCH_I2C_IO_SDA (21) +#endif + +#endif + +/* Touch Transformation Flags */ +#define ESP_PANEL_TOUCH_SWAP_XY (0) // 0/1 +#define ESP_PANEL_TOUCH_MIRROR_X (0) // 0/1 +#define ESP_PANEL_TOUCH_MIRROR_Y (0) // 0/1 + +/* Touch Other Settings */ +/* IO num of RESET pin, set to -1 if not use */ +#define ESP_PANEL_TOUCH_IO_RST (-1) +#define ESP_PANEL_TOUCH_RST_LEVEL (0) // 0: low level, 1: high level +/* IO num of INT pin, set to -1 if not use */ +#define ESP_PANEL_TOUCH_IO_INT (39) +#define ESP_PANEL_TOUCH_INT_LEVEL (0) // 0: low level, 1: high level + +#endif /* ESP_PANEL_USE_TOUCH */ + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the backlight //////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define ESP_PANEL_USE_BACKLIGHT (0) // 0/1 + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please update the following macros to configure the IO expander ////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/* Set to 0 if not using IO Expander */ +#define ESP_PANEL_USE_EXPANDER (0) // 0/1 + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// Please utilize the following macros to execute any additional code if required. ////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// #define ESP_PANEL_BEGIN_START_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_EXPANDER_START_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_EXPANDER_END_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_LCD_START_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_LCD_END_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_TOUCH_START_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_TOUCH_END_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_BACKLIGHT_START_FUNCTION( panel ) +// #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) +#define ESP_PANEL_BEGIN_END_FUNCTION( panel ) \ + { \ + static const uint8_t AXP_ADDR = 0x34; \ + static const uint8_t I2C_MASTER_TIMEOUT_MS = 1000; \ + static i2c_port_t i2c_master_port = I2C_NUM_0; \ + \ + uint8_t device_id = 0; \ + uint8_t read_value = 0; \ + uint8_t write_value = 0; \ + uint8_t reg_addr = 0; \ + uint8_t write_buf[2] = {0}; \ + \ + reg_addr = 0x03; \ + i2c_master_write_read_device(i2c_master_port, AXP_ADDR, ®_addr, 1, &device_id, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + if (device_id == 0x03) { \ + reg_addr = 0x28; \ + i2c_master_write_read_device(i2c_master_port, AXP_ADDR, ®_addr, 1, &read_value, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + write_value = (read_value & 0x0F) | ((((3300 - 1800) / 100) & 0x0F) << 4); \ + write_buf[0] = 0x28; \ + write_buf[1] = write_value; \ + i2c_master_write_to_device(i2c_master_port, AXP_ADDR, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + \ + reg_addr = 0x12; \ + i2c_master_write_read_device(i2c_master_port, AXP_ADDR, ®_addr, 1, &read_value, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + write_value = (read_value | (0x01 << 2)); \ + write_buf[0] = 0x12; \ + write_buf[1] = write_value; \ + i2c_master_write_to_device(i2c_master_port, AXP_ADDR, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + \ + reg_addr = 0x12; \ + i2c_master_write_read_device(i2c_master_port, AXP_ADDR, ®_addr, 1, &read_value, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + write_value = (read_value | (0x01 << 1)); \ + write_buf[0] = 0x12; \ + write_buf[1] = write_value; \ + i2c_master_write_to_device(i2c_master_port, AXP_ADDR, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + } else if (device_id == 0x4A) { \ + reg_addr = 0x90; \ + read_value = device_id; \ + i2c_master_write_read_device(i2c_master_port, AXP_ADDR, ®_addr, 1, &read_value, 1, I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + write_value = (read_value | (1 << 4)); \ + write_buf[0] = 0x90; \ + write_buf[1] = write_value; \ + i2c_master_write_to_device(i2c_master_port, AXP_ADDR, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + \ + write_value = (3000 - 500) / 100; \ + write_buf[0] = 0x94; \ + write_buf[1] = write_value; \ + i2c_master_write_to_device(i2c_master_port, AXP_ADDR, write_buf, sizeof(write_buf), I2C_MASTER_TIMEOUT_MS / portTICK_PERIOD_MS); \ + } else { \ + \ + } \ + } +// *INDENT-OFF*