Skip to content

Commit 74bfdda

Browse files
committed
Merge branch 'feat/add_mipi_dsi_avoid_example' into 'master'
feat(lcd): Added MIPI-DSI avoid-tear example. See merge request ae_group/esp-iot-solution!1186
2 parents 21d671b + f9fc38d commit 74bfdda

File tree

74 files changed

+5516
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+5516
-243
lines changed

.gitlab/ci/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,16 @@ build_example_check_pedestrian_flow:
375375
variables:
376376
EXAMPLE_DIR: examples/check_pedestrian_flow
377377

378+
build_example_display_lcd_lcd_layer_blending:
379+
extends:
380+
- .build_examples_template
381+
- .rules:build:example_display_lcd_lcd_layer_blending
382+
parallel:
383+
matrix:
384+
- IMAGE: espressif/idf:release-v5.4
385+
variables:
386+
EXAMPLE_DIR: examples/display/lcd/lcd_layer_blending
387+
378388
build_example_display_lcd_lcd_with_te:
379389
extends:
380390
- .build_examples_template
@@ -385,6 +395,16 @@ build_example_display_lcd_lcd_with_te:
385395
variables:
386396
EXAMPLE_DIR: examples/display/lcd/lcd_with_te
387397

398+
build_example_display_lcd_mipi_dsi_avoid_tearing:
399+
extends:
400+
- .build_examples_template
401+
- .rules:build:example_display_lcd_mipi_dsi_avoid_tearing
402+
parallel:
403+
matrix:
404+
- IMAGE: espressif/idf:release-v5.4
405+
variables:
406+
EXAMPLE_DIR: examples/display/lcd/mipi_dsi_avoid_tearing
407+
388408
build_example_display_lcd_qspi_with_ram:
389409
extends:
390410
- .build_examples_template

.gitlab/ci/rules.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,15 @@
436436
.patterns-example_common_components_camera: &patterns-example_common_components_camera
437437
- "examples/common_components/camera/**/*"
438438

439+
.patterns-example_display_lcd_lcd_layer_blending: &patterns-example_display_lcd_lcd_layer_blending
440+
- "examples/display/lcd/lcd_layer_blending/**/*"
441+
439442
.patterns-example_display_lcd_lcd_with_te: &patterns-example_display_lcd_lcd_with_te
440443
- "examples/display/lcd/lcd_with_te/**/*"
441444

445+
.patterns-example_display_lcd_mipi_dsi_avoid_tearing: &patterns-example_display_lcd_mipi_dsi_avoid_tearing
446+
- "examples/display/lcd/mipi_dsi_avoid_tearing/**/*"
447+
442448
.patterns-example_display_lcd_qspi_with_ram: &patterns-example_display_lcd_qspi_with_ram
443449
- "examples/display/lcd/qspi_with_ram/**/*"
444450

@@ -807,6 +813,18 @@
807813
- <<: *if-dev-push
808814
changes: *patterns-example_check_pedestrian_flow
809815

816+
.rules:build:example_display_lcd_lcd_layer_blending:
817+
rules:
818+
- <<: *if-protected
819+
- <<: *if-label-build
820+
- <<: *if-trigger-job
821+
- <<: *if-dev-push
822+
changes: *patterns-build_system
823+
- <<: *if-dev-push
824+
changes: *patterns-components_display_lcd_esp_lcd_ek79007
825+
- <<: *if-dev-push
826+
changes: *patterns-example_display_lcd_lcd_layer_blending
827+
810828
.rules:build:example_display_lcd_lcd_with_te:
811829
rules:
812830
- <<: *if-protected
@@ -819,6 +837,18 @@
819837
- <<: *if-dev-push
820838
changes: *patterns-components_display_lcd_esp_lcd_axs15231b
821839

840+
.rules:build:example_display_lcd_mipi_dsi_avoid_tearing:
841+
rules:
842+
- <<: *if-protected
843+
- <<: *if-label-build
844+
- <<: *if-trigger-job
845+
- <<: *if-dev-push
846+
changes: *patterns-build_system
847+
- <<: *if-dev-push
848+
changes: *patterns-components_display_lcd_esp_lcd_ek79007
849+
- <<: *if-dev-push
850+
changes: *patterns-example_display_lcd_mipi_dsi_avoid_tearing
851+
822852
.rules:build:example_display_lcd_qspi_with_ram:
823853
rules:
824854
- <<: *if-protected

components/display/lcd/esp_lcd_st77903_rgb/idf_component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: "1.0.0"
22
targets:
33
- esp32s3
4+
- esp32p4
45
description: ESP LCD ST77903 RGB
56
url: https://github.com/espressif/esp-iot-solution/tree/master/components/display/lcd/esp_lcd_st77903_rgb
67
repository: https://github.com/espressif/esp-iot-solution.git

examples/.build-rules.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ examples/check_pedestrian_flow:
159159
enable:
160160
- if: IDF_TARGET in ["esp32","esp32s2","esp32s3","esp32c3"]
161161

162+
examples/display/lcd/lcd_layer_blending:
163+
enable:
164+
- if: IDF_TARGET in ["esp32p4"]
165+
166+
examples/display/lcd/mipi_dsi_avoid_tearing:
167+
enable:
168+
- if: IDF_TARGET in ["esp32p4"]
169+
162170
examples/display/lcd/qspi_with_ram:
163171
enable:
164172
- if: IDF_TARGET in ["esp32","esp32c2","esp32c3","esp32c6","esp32h2","esp32s2", "esp32s3"] and (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR == 1)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/squareline/backup/**
2+
**/squareline/autosave/**
3+
components/lvgl/**
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
7+
add_compile_options(-Wno-attributes
8+
-Wno-format)
9+
project(lcd_layer_blending)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
| Supported Targets | ESP32-P4 |
2+
| ----------------- | -------- |
3+
4+
| Supported LCD Controller | EK79007 |
5+
| ----------------------------|---------|
6+
7+
| Supported Touch Controller | GT911 |
8+
| ----------------------------| -------|
9+
10+
# LCD Layer Blending Example
11+
12+
[esp_lcd](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/lcd.html) provides several panel drivers out-of box, e.g. ST7789, SSD1306, NT35510. However, there're a lot of other panels on the market, it's beyond `esp_lcd` component's responsibility to include them all.
13+
14+
`esp_lcd` allows user to add their own panel drivers in the project scope (i.e. panel driver can live outside of esp-idf), so that the upper layer code like LVGL porting code can be reused without any modifications, as long as user-implemented panel driver follows the interface defined in the `esp_lcd` component.
15+
16+
This example demonstrates how to use LVGL v9 based on PPA to implement layer blending (e.g., integration with camera data streams) and color format switching.
17+
18+
This example uses the [esp_timer](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/esp_timer.html) to generate the ticks needed by LVGL and uses a dedicated task to run the `lv_timer_handler()`. Since the LVGL APIs are not thread-safe, this example uses a mutex which be invoked before the call of `lv_timer_handler()` and released after it. The same mutex needs to be used in other tasks and threads around every LVGL (lv_...) related function call and code. For more porting guides, please refer to [LVGL porting doc](https://docs.lvgl.io/master/porting/index.html).
19+
20+
## How to use the example
21+
22+
## ESP-IDF Required
23+
24+
### Hardware Required
25+
26+
* An ESP32-P4-Function-EV-Board.
27+
* A 7-inch 1024 x 600 LCD screen powered by the [EK79007](https://docs.espressif.com/projects/esp-dev-kits/en/latest/_static/esp32-p4-function-ev-board/camera_display_datasheet/display_driver_chip_EK79007AD_datasheet.pdf) IC, accompanied by a 32-pin FPC connection [adapter board](https://docs.espressif.com/projects/esp-dev-kits/en/latest/_static/esp32-p4-function-ev-board/schematics/esp32-p4-function-ev-board-lcd-subboard-schematics.pdf) ([LCD Specifications](https://docs.espressif.com/projects/esp-dev-kits/en/latest/_static/esp32-p4-function-ev-board/camera_display_datasheet/display_datasheet.pdf)).
28+
* A MIPI-CSI camera powered by the SC2336 IC, accompanied by a 32-pin FPC connection [adapter board](https://docs.espressif.com/projects/esp-dev-kits/en/latest/_static/esp32-p4-function-ev-board/schematics/esp32-p4-function-ev-board-camera-subboard-schematics.pdf) ([Camera Specifications](https://docs.espressif.com/projects/esp-dev-kits/en/latest/_static/esp32-p4-function-ev-board/camera_display_datasheet/camera_datasheet.pdf)).
29+
* A USB-C cable for power supply and programming.
30+
* Please refer to the following steps for the connection:
31+
* **Step 1**. According to the table below, connect the pins on the back of the screen adapter board to the corresponding pins on the development board.
32+
33+
| Screen Adapter Board | ESP32-P4-Function-EV-Board |
34+
| -------------------- | -------------------------- |
35+
| 5V (any one) | 5V (any one) |
36+
| GND (any one) | GND (any one) |
37+
| PWM | GPIO26 |
38+
| LCD_RST | GPIO27 |
39+
40+
* **Step 2**. Connect the FPC of LCD through the `MIPI_DSI` interface.
41+
* **Step 3**. Connect the FPC of Camera through the `MIPI_CSI` interface.
42+
* **Step 4**. Use a USB-C cable to connect the `USB-UART` port to a PC (Used for power supply and viewing serial output).
43+
* **Step 5**. Turn on the power switch of the board.
44+
45+
### Configure the Project
46+
47+
Run `idf.py menuconfig` and navigate to `Example Configuration` menu.
48+
49+
### Build and Flash
50+
51+
Run `idf.py set-target esp32p4` to select the target chip.
52+
53+
Run `idf.py -p PORT build flash monitor` to build, flash and monitor the project. A fancy animation will show up on the LCD as expected.
54+
55+
The first time you run `idf.py` for the example will cost extra time as the build system needs to address the component dependencies and downloads the missing components from registry into `managed_components` folder.
56+
57+
(To exit the serial monitor, type ``Ctrl-]``.)
58+
59+
See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
60+
61+
## Troubleshooting
62+
63+
For any technical queries, please open an [issue](https://github.com/espressif/esp-iot-solution/issues) on GitHub. We will get back to you soon.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
set(LV_UI_DIR ui)
2+
file(GLOB_RECURSE LV_UI_SOURCES ${LV_UI_DIR}/*.c)
3+
set(CORE_DIR core)
4+
file(GLOB_RECURSE CORE_SOURCES ${CORE_DIR}/*.c)
5+
6+
set(INCLUDE_DIRS "")
7+
list(APPEND INCLUDE_DIRS "include")
8+
9+
idf_component_get_property(LVGL_LIB lvgl__lvgl COMPONENT_LIB)
10+
11+
idf_component_register(
12+
SRCS main.c app_lcd.c app_video.c camera_ppa_blend.c ${LV_UI_SOURCES} ${CORE_SOURCES}
13+
INCLUDE_DIRS . ${LV_UI_DIR} ${INCLUDE_DIRS} ${CORE_DIR}
14+
)
15+
16+
target_compile_options(
17+
${LVGL_LIB}
18+
PRIVATE
19+
-DLV_LVGL_H_INCLUDE_SIMPLE
20+
-DLV_USE_DEMO_MUSIC
21+
-Wno-missing-field-initializers
22+
)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
menu "Example Configuration"
2+
menu "Camera Configuration"
3+
config EXAMPLE_ENABLE_MIPI_CSI_CAM_SENSOR
4+
bool "Enable MIPI CSI Camera Sensor"
5+
default y
6+
depends on SOC_MIPI_CSI_SUPPORTED
7+
8+
if EXAMPLE_ENABLE_MIPI_CSI_CAM_SENSOR
9+
config EXAMPLE_MIPI_CSI_SCCB_I2C_PORT
10+
int "MIPI CSI SCCB I2C Port Number"
11+
default 0
12+
range 0 1
13+
14+
config EXAMPLE_MIPI_CSI_SCCB_I2C_SCL_PIN
15+
int "MIPI CSI SCCB I2C SCL Pin"
16+
default 34
17+
range -1 56
18+
19+
config EXAMPLE_MIPI_CSI_SCCB_I2C_SDA_PIN
20+
int "MIPI CSI SCCB I2C SDA Pin"
21+
default 31
22+
range -1 56
23+
24+
config EXAMPLE_MIPI_CSI_SCCB_I2C_FREQ
25+
int "MIPI CSI SCCB I2C Frequency"
26+
default 100000
27+
range 100000 400000
28+
help
29+
Increasing this value can reduce the initialization time of the camera sensor.
30+
Please refer to the relevant instructions of the camera sensor to adjust the value.
31+
32+
config EXAMPLE_MIPI_CSI_CAM_SENSOR_RESET_PIN
33+
int "MIPI CSI Camera Sensor Reset Pin"
34+
default -1
35+
range -1 56
36+
37+
config EXAMPLE_MIPI_CSI_CAM_SENSOR_PWDN_PIN
38+
int "MIPI CSI Camera Sensor Power Down Pin"
39+
default -1
40+
range -1 56
41+
endif
42+
43+
config EXAMPLE_CAM_BUF_COUNT
44+
int "Camera Buffer Count"
45+
default 2
46+
range 2 3
47+
endmenu
48+
menu "LCD Configuration"
49+
choice
50+
prompt "Choose the color format of the LCD"
51+
default LCD_PIXEL_FORMAT_RGB565
52+
config LCD_PIXEL_FORMAT_RGB565
53+
bool "RGB565"
54+
55+
config LCD_PIXEL_FORMAT_RGB888
56+
bool "RGB888"
57+
endchoice
58+
59+
config EXAMPLE_LCD_PPA_BLEND_AVOID_TEAR
60+
bool "Enable LCD avoid tear feat"
61+
default y
62+
endmenu
63+
endmenu

0 commit comments

Comments
 (0)