diff --git a/ESP_Panel_Board_Supported.h b/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/ESP_Panel_Board_Supported.h +++ b/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/docs/Board_Instructions.md b/docs/Board_Instructions.md index c9142313..8e1d15cc 100644 --- a/docs/Board_Instructions.md +++ b/docs/Board_Instructions.md @@ -17,6 +17,12 @@ | | [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 | 800x480 | 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 | 240x240 | - | - | +### [Elecrow](https://www.elecrow.com/) + +| **Picture** | **Name** | **LCD Bus** | **LCD Controller** | **LCD resolution** | **Touch Bus** | **Touch Controller** | +| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------: | :--------------: | :--------------: | :----------------: | :-----------: | :------------------: | +| | [CrowPanel 7.0"](https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html) | RGB | EK9716BD3 & EK73002ACGB | 800x480 | I2C | GT911 | + ### [M5Stack](https://m5stack.com/) | **Picture** | **Name** | **LCD Bus** | **LCD Controller** | **LCD resolution** | **Touch Bus** | **Touch Controller** | @@ -52,6 +58,7 @@ Below are recommended configurations for developing GUI applications on differen | M5STACK-M5DIAL | ESP32S3 Dev Module | OPI | QIO 80MHz | 8MB | Disabled | Default | | M5STACK-M5CORES3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Enabled | Default 4MB with spiffs | | ESP32-4848S040C_I_Y_3 | ESP32S3 Dev Module | OPI | QIO 80MHz | 16MB | Disabled | 16M Flash (3MB) | +| ElecrowCrowPanel 7.0" | ESP32S3 Dev Module | OPI | QIO 80MHz | 4MB | Disabled | Huge App (3MB) | **Notes:** diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h +++ b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/examples/PlatformIO/src/ESP_Panel_Board_Supported.h b/examples/PlatformIO/src/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/examples/PlatformIO/src/ESP_Panel_Board_Supported.h +++ b/examples/PlatformIO/src/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h index eb609a76..0221d679 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h @@ -46,6 +46,13 @@ // #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 // #define BOARD_ESP32_S3_USB_OTG +/* + * Elecrow (https://www.elecrow.com): + * + * - ELECROW_CROWPANEL_7_0: https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html + */ +// #define BOARD_ELECROW_CROWPANEL_7_0 + /* * M5Stack (https://m5stack.com/): * diff --git a/src/board/ESP_PanelBoard.h b/src/board/ESP_PanelBoard.h index dcf772a8..1ecb59b7 100644 --- a/src/board/ESP_PanelBoard.h +++ b/src/board/ESP_PanelBoard.h @@ -46,6 +46,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" +/* Elecrow */ +#elif defined(BOARD_ELECROW_CROWPANEL_7_0) || CONFIG_BOARD_ELECROW_CROWPANEL_7_0 + #include "board/elecrow/CROWPANEL_7_0.h" /* M5Stack */ #elif defined(BOARD_M5STACK_M5CORE2) || CONFIG_BOARD_M5STACK_M5CORE2 #include "board/m5stack/M5CORE2.h" diff --git a/src/board/elecrow/CROWPANEL_7_0.h b/src/board/elecrow/CROWPANEL_7_0.h new file mode 100644 index 00000000..c8ccc6a8 --- /dev/null +++ b/src/board/elecrow/CROWPANEL_7_0.h @@ -0,0 +1,235 @@ +/* + * SPDX-FileCopyrightText: 2023-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. + */ +#define ESP_PANEL_LCD_NAME EK9716BD3 + +/* LCD resolution in pixels */ +#define ESP_PANEL_LCD_WIDTH (800) +#define ESP_PANEL_LCD_HEIGHT (480) + +/* 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 (1) // 0/1 +/** + * LCD Bus Type. + */ +#define ESP_PANEL_LCD_BUS_TYPE (ESP_PANEL_BUS_TYPE_RGB) +/** + * 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_RGB + + #define ESP_PANEL_LCD_RGB_CLK_HZ (14 * 1000 * 1000) + #define ESP_PANEL_LCD_RGB_HPW (48) // Hsync pulse width x + #define ESP_PANEL_LCD_RGB_HBP (40) // Hsync back porch x + #define ESP_PANEL_LCD_RGB_HFP (40) // Hsync front porch x + #define ESP_PANEL_LCD_RGB_VPW (31) // Vsync pulse width x + #define ESP_PANEL_LCD_RGB_VBP (13) // Vsync back porch x + #define ESP_PANEL_LCD_RGB_VFP (1) // Vsync front porch + #define ESP_PANEL_LCD_RGB_PCLK_ACTIVE_NEG (1) // 0: rising edge, 1: falling edge + #define ESP_PANEL_LCD_RGB_DATA_WIDTH (16) // 8 | 16 + #define ESP_PANEL_LCD_RGB_PIXEL_BITS (16) // 24 | 16 + #define ESP_PANEL_LCD_RGB_FRAME_BUF_NUM (1) // 1/2/3 + #define ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE (ESP_PANEL_LCD_WIDTH * 10) + // Bounce buffer size in bytes. This function is used to avoid screen drift. + // To enable the bounce buffer, set it to a non-zero value. + // Typically set to `ESP_PANEL_LCD_WIDTH * 10` + #define ESP_PANEL_LCD_RGB_IO_HSYNC (39) + #define ESP_PANEL_LCD_RGB_IO_VSYNC (40) + #define ESP_PANEL_LCD_RGB_IO_DE (41) // -1 if not used + #define ESP_PANEL_LCD_RGB_IO_PCLK (0) + #define ESP_PANEL_LCD_RGB_IO_DISP (-1) // -1 if not used + #define ESP_PANEL_LCD_RGB_IO_DATA0 (15) + #define ESP_PANEL_LCD_RGB_IO_DATA1 (7) + #define ESP_PANEL_LCD_RGB_IO_DATA2 (6) + #define ESP_PANEL_LCD_RGB_IO_DATA3 (5) + #define ESP_PANEL_LCD_RGB_IO_DATA4 (4) + #define ESP_PANEL_LCD_RGB_IO_DATA5 (9) + #define ESP_PANEL_LCD_RGB_IO_DATA6 (46) + #define ESP_PANEL_LCD_RGB_IO_DATA7 (3) +#if ESP_PANEL_LCD_RGB_DATA_WIDTH > 8 + #define ESP_PANEL_LCD_RGB_IO_DATA8 (8) + #define ESP_PANEL_LCD_RGB_IO_DATA9 (16) + #define ESP_PANEL_LCD_RGB_IO_DATA10 (1) + #define ESP_PANEL_LCD_RGB_IO_DATA11 (14) + #define ESP_PANEL_LCD_RGB_IO_DATA12 (21) + #define ESP_PANEL_LCD_RGB_IO_DATA13 (47) + #define ESP_PANEL_LCD_RGB_IO_DATA14 (48) + #define ESP_PANEL_LCD_RGB_IO_DATA15 (45) +#endif + +#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 (24) // 8/16/18/24 +/* + * LCD RGB Element Order. Choose one of the following: + * - 0: RGB + * - 1: BGR + */ +#define ESP_PANEL_LCD_BGR_ORDER (0) // 0/1 +#define ESP_PANEL_LCD_INEVRT_COLOR (0) // 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. + */ +#define ESP_PANEL_TOUCH_NAME GT911 + +/* Touch resolution in pixels */ +#define ESP_PANEL_TOUCH_H_RES (ESP_PANEL_LCD_HEIGHT) // Typically set to the same value as the width of LCD +#define ESP_PANEL_TOUCH_V_RES (ESP_PANEL_LCD_WIDTH) // 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 (20) + #define ESP_PANEL_TOUCH_I2C_IO_SDA (19) +#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 (38) +#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 (1) // 0/1 +#if ESP_PANEL_USE_BACKLIGHT +/* IO num of backlight pin */ +#define ESP_PANEL_BACKLIGHT_IO (2) +#define ESP_PANEL_BACKLIGHT_ON_LEVEL (1) // 0: low level, 1: high level + +/* Set to 1 if you want to turn off the backlight after initializing the panel; otherwise, set it to turn on */ +#define ESP_PANEL_BACKLIGHT_IDLE_OFF (0) // 0: on, 1: off + +/* Set to 1 if use PWM for brightness control */ +#define ESP_PANEL_LCD_BL_USE_PWM (0) // 0/1 +#endif /* ESP_PANEL_USE_BACKLIGHT */ + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////// 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 ) \ + + { \ + /* Maintain the touch INT signal in a low state during the reset process to set its I2C address to `0x5D` */ \ + gpio_set_direction((gpio_num_t)ESP_PANEL_TOUCH_IO_INT, GPIO_MODE_OUTPUT); \ + gpio_set_level((gpio_num_t)ESP_PANEL_TOUCH_IO_INT, 0); \ + vTaskDelay(pdMS_TO_TICKS(10)); \ + } + +// #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 ) + +// *INDENT-OFF*