Skip to content

Commit f117509

Browse files
committed
feat(example): add docs for PlatformIO
1 parent d21fa43 commit f117509

17 files changed

+196
-847
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* feat(board): add add new board M5CORE2 by @MacChu0315-Espressif (#40)
88
* feat(board): add add new board M5DIAL by @MacChu0315-Espressif (#41)
99
* feat(board): add add new board M5CORES3 by @MacChu0315-Espressif (#45)
10+
* feat(example): add support for PlatformIO by @isthaison (#37)
1011

1112
### Bugfixes:
1213

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ ESP32_Display_Panel encapsulates various components from the [Espressif Componen
2424
- [Using Supported Development Boards](#using-supported-development-boards)
2525
- [Using Custom Development Boards](#using-custom-development-boards)
2626
- [Usage Examples](#usage-examples)
27-
- [LCD](#lcd)
28-
- [Touch](#touch)
29-
- [Panel](#panel)
30-
- [LVGL v8](#lvgl-v8)
31-
- [SquareLine](#squareline)
27+
- [Arduino IDE](#arduino-ide)
28+
- [LCD](#lcd)
29+
- [Touch](#touch)
30+
- [Panel](#panel)
31+
- [LVGL v8](#lvgl-v8)
32+
- [SquareLine](#squareline)
33+
- [PlatformIO](#platformio)
3234
- [Other Relevant Instructions](#other-relevant-instructions)
3335
- [Configuring Supported Development Boards](#configuring-supported-development-boards)
3436
- [Configuring LVGL](#configuring-lvgl)
@@ -38,6 +40,7 @@ ESP32_Display_Panel encapsulates various components from the [Espressif Componen
3840
- [How to Install ESP32\_Display\_Panel in Arduino IDE?](#how-to-install-esp32_display_panel-in-arduino-ide)
3941
- [Where are the installation directory for arduino-esp32 and the SDK located?](#where-are-the-installation-directory-for-arduino-esp32-and-the-sdk-located)
4042
- [How to fix screen drift issue when driving RGB LCD with ESP32-S3?](#how-to-fix-screen-drift-issue-when-driving-rgb-lcd-with-esp32-s3)
43+
- [How to Use ESP32\_Display\_Panel on PlatformIO?](#how-to-use-esp32_display_panel-on-platformio)
4144

4245
## Overview
4346

@@ -256,9 +259,13 @@ Here is a snippet of the modified `ESP_Panel_Board_Custom.h` file:
256259

257260
### Usage Examples
258261

259-
Below are some examples of using ESP32_Display_Panel. You can access them in the Arduino IDE by navigating to `File` > `Examples` > `ESP32_Display_Panel`. If you cannot find the `ESP32_Display_Panel` option, please check if the library has been installed correctly and ensure that an ESP development board is selected.
262+
The following are some examples of using ESP32_Display_Panel on different development platforms.
260263

261-
#### LCD
264+
#### Arduino IDE
265+
266+
You can access them in the Arduino IDE by navigating to `File` > `Examples` > `ESP32_Display_Panel`. If you cannot find the `ESP32_Display_Panel` option, please check if the library has been installed correctly and ensure that an ESP development board is selected.
267+
268+
##### LCD
262269

263270
The following examples demonstrate how to develop different interface and model LCDs using standalone drivers and test them by displaying color bars:
264271

@@ -267,33 +274,37 @@ The following examples demonstrate how to develop different interface and model
267274
* [Single RGB](examples/LCD/RGB/)
268275
* [3-wire SPI + RGB](examples/LCD/3wireSPI_RGB/)
269276

270-
#### Touch
277+
##### Touch
271278

272279
The following example demonstrates how to develop touch screens of different interfaces and models using standalone drivers and test them by printing touch point coordinates:
273280

274281
* [I2C](examples/Touch/I2C/)
275282
* [SPI](examples/Touch/SPI/)
276283

277-
#### Panel
284+
##### Panel
278285

279286
The following example demonstrates how to develop built-in or custom development boards using the `ESP_Panel` driver:
280287

281288
* [Panel Test](examples/Panel/PanelTest/): This example tests by displaying color bars and printing touch point coordinates.
282289

283-
#### LVGL v8
290+
##### LVGL v8
284291

285292
For configuring LVGL (v8.3.x), please refer to [here](#configuring-lvgl) for more detailed information.
286293

287294
* [Porting](examples/LVGL/v8/Porting/): This example demonstrates how to port LVGL (v8.3.x). And for RGB LCD, it can enable the avoid tearing fucntion.
288295
* [Rotation](examples/LVGL/v8/Rotation/): This example demonstrates how to use LVGL to rotate the display.
289296

290-
#### SquareLine
297+
##### SquareLine
291298

292299
To port the SquareLine project (v1.3.x), please refer to [here](#porting-squareline-project) for more detailed information.
293300

294301
- [Porting](examples/SquareLine/v8/Porting/): This example demonstrates how to port the SquareLine project.
295302
- [WiFiClock](examples/SquareLine/v8/WiFiClock/): This example implements a simple Wi-Fi clock and can display weather information.
296303

304+
#### PlatformIO
305+
306+
- [PlatformIO](examples/PlatformIO/): This example demonstrates how to use ESP32_Display_Panel in PlatformIO. By default, it is suitable for the **ESP32-S3-LCD-EV-Board** and **ESP32-S3-LCD-EV-Board-2** development boards. Users need to modify the [boards/ESP-LCD.json](examples/PlatformIO/boards/ESP-LCD.json) file according to the actual situation.
307+
297308
## Other Relevant Instructions
298309

299310
### Configuring Supported Development Boards
@@ -446,3 +457,7 @@ When encountering screen drift issue when driving RGB LCD with ESP32-S3, you can
446457
lcd_bus->begin();
447458
...
448459
```
460+
461+
### How to Use ESP32_Display_Panel on PlatformIO?
462+
463+
You can refer to the example [PlatformIO](examples/PlatformIO/) to use the ESP32_Display_Panel library in PlatformIO. By default, it is suitable for the **ESP32-S3-LCD-EV-Board** and **ESP32-S3-LCD-EV-Board-2** development boards. You need to modify the [boards/ESP-LCD.json](examples/PlatformIO/boards/ESP-LCD.json) file according to the actual situation.

README_CN.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ ESP32_Display_Panel 封装了多种[乐鑫组件库](https://components.espressi
2424
- [使用支持的开发板](#使用支持的开发板)
2525
- [使用自定义开发板](#使用自定义开发板)
2626
- [示例说明](#示例说明)
27-
- [LCD](#lcd)
28-
- [Touch](#touch)
29-
- [Panel](#panel)
30-
- [LVGL v8](#lvgl-v8)
31-
- [SquareLine](#squareline)
27+
- [Arduino IDE](#arduino-ide)
28+
- [LCD](#lcd)
29+
- [Touch](#touch)
30+
- [Panel](#panel)
31+
- [LVGL v8](#lvgl-v8)
32+
- [SquareLine](#squareline)
33+
- [PlatformIO](#platformio)
3234
- [其他相关说明](#其他相关说明)
3335
- [配置支持的开发板](#配置支持的开发板)
3436
- [配置 LVGL](#配置-lvgl)
@@ -38,6 +40,7 @@ ESP32_Display_Panel 封装了多种[乐鑫组件库](https://components.espressi
3840
- [如何在 Arduino IDE 中安装 ESP32\_Display\_Panel?](#如何在-arduino-ide-中安装-esp32_display_panel)
3941
- [arduino-eps32 的安装目录以及 SDK 的目录在哪儿?](#arduino-eps32-的安装目录以及-sdk-的目录在哪儿)
4042
- [使用 ESP32-S3 驱动 RGB LCD 时出现画面漂移问题的解决方案](#使用-esp32-s3-驱动-rgb-lcd-时出现画面漂移问题的解决方案)
43+
- [如何在 PlatformIO 上使用 ESP32\_Display\_Panel?](#如何在-platformio-上使用-esp32_display_panel)
4144

4245
## 概述
4346

@@ -256,9 +259,13 @@ ESP32_Display_Panel 会根据 [ESP_Panel_Board_Custom.h](./ESP_Panel_Board_Custo
256259

257260
### 示例说明
258261

259-
以下是使用 ESP32_Display_Panel 的一些示例,你可以在 Arduino IDE 中导航到 `File` > `Examples` > `ESP32_Display_Panel` 来访问它们。如果你找不到 `ESP32_Display_Panel` 选项,请检查库是否已正确安装,并确认选择了一个 ESP 开发板
262+
以下是在不同开发平台下使用 ESP32_Display_Panel 的一些示例。
260263

261-
#### LCD
264+
#### Arduino IDE
265+
266+
你可以在 Arduino IDE 中导航到 `File` > `Examples` > `ESP32_Display_Panel` 来访问它们。如果你找不到 `ESP32_Display_Panel` 选项,请检查库是否已正确安装,并确认选择了一个 ESP 开发板。
267+
268+
##### LCD
262269

263270
以下示例演示了如何使用独立的驱动开发不同接口和不同型号的 LCD,并通过显示彩条进行测试:
264271

@@ -267,33 +274,37 @@ ESP32_Display_Panel 会根据 [ESP_Panel_Board_Custom.h](./ESP_Panel_Board_Custo
267274
* [Single RGB](examples/LCD/RGB/)
268275
* [3-wire SPI + RGB](examples/LCD/3wireSPI_RGB/)
269276

270-
#### Touch
277+
##### Touch
271278

272279
以下示例演示了如何使用独立的驱动开发不同接口和不同型号的触摸屏,并通过打印触摸点坐标进行测试:
273280

274281
* [I2C](examples/Touch/I2C/)
275282
* [SPI](examples/Touch/SPI/)
276283

277-
#### Panel
284+
##### Panel
278285

279286
以下示例演示了如何使用 `ESP_Panel` 驱动开发内置或自定义的开发板:
280287

281288
* [Panel Test](examples/Panel/PanelTest/):此示例通过显示彩条和打印触摸点坐标进行测试。
282289

283-
#### LVGL v8
290+
##### LVGL v8
284291

285292
关于如何配置 LVGL(v8.3.x),请参阅[此处](#配置-lvgl)以获取更多详细信息。
286293

287294
* [Porting](examples/LVGL/v8/Porting/): 此示例演示了如何移植 LVGL(v8.3.x)。对于 RGB LCD,它还可以启用防撕裂功能。
288295
* [Rotation](examples/LVGL/v8/Rotation/): 此示例演示了如何使用 LVGL 来旋转显示屏。
289296

290-
#### SquareLine
297+
##### SquareLine
291298

292299
​ 要移植 Squarelina 项目(v1.3.x),请参阅[此处](#移植-SquareLine-工程)获取更多详细信息。
293300

294301
- [Porting](examples/SquareLine/v8/Porting): 此示例演示了如何移植 SquareLine 项目。
295302
- [WiFiClock](examples/SquareLine/v8/WiFiClock): 此示例实现了一个简单的 Wi-Fi 时钟,并且可以显示天气信息。
296303

304+
#### PlatformIO
305+
306+
- [PlatformIO](examples/PlatformIO/): 此示例演示了如何在 PlatformIO 中使用 ESP32_Display_Panel。它默认情况下适用于 **ESP32-S3-LCD-EV-Board** and **ESP32-S3-LCD-EV-Board-2** 开发板,用户需要根据实际情况修改 [boards/ESP-LCD.json](examples/PlatformIO/boards/ESP-LCD.json) 文件。
307+
297308
## 其他相关说明
298309

299310
### 配置支持的开发板
@@ -446,3 +457,7 @@ arduino-esp32 v3.x.x 版本的 SDK 位于默认安装路径下的 `tools > esp32
446457
lcd_bus->begin();
447458
...
448459
```
460+
461+
### 如何在 PlatformIO 上使用 ESP32_Display_Panel?
462+
463+
您可以参考示例 [PlatformIO](examples/PlatformIO/) 在 PlatformIO 中使用 ESP32_Display_Panel 库,它默认情况下适用于 **ESP32-S3-LCD-EV-Board** and **ESP32-S3-LCD-EV-Board-2** 开发板,您需要根据实际情况修改 [boards/ESP-LCD.json](examples/PlatformIO/boards/ESP-LCD.json) 文件。
File renamed without changes.

examples/PlatformIO/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# PlatformIO Example
2+
3+
The example is used to guide how to use this library in PlatformIO. It also demonstrates how to port LVGL (v8.3.x). And for RGB LCD, it can enable the avoid tearing fucntion.
4+
5+
It is by default suitable for **ESP32-S3-LCD-EV-Board** and **ESP32-S3-LCD-EV-Board-2** boards. Users should modify the [boards/ESP-LCD.json](boards/ESP-LCD.json) file as needed.
6+
7+
## How to Use
8+
9+
Follow the steps below to configure:
10+
11+
1. For **ESP32_Display_Panel**:
12+
13+
- Follow the [steps](../../README.md#configuring-drivers) to configure drivers if needed.
14+
- If using a supported development board, follow the [steps](../../README.md#using-supported-development-boards) to configure it.
15+
- If using a custom board, follow the [steps](../../README.md#using-custom-development-boards) to configure it.
16+
17+
2. For **lvgl**:
18+
19+
- Follow the [steps](../../README.md#configuring-lvgl) to add *lv_conf.h* file and change the configurations.
20+
- Modify the macros in the [lvgl_port_v8.h](./lvgl_port_v8.h) file to configure the LVGL porting parameters.
21+
22+
3. Navigate to the `Tools` menu in the Arduino IDE to choose a ESP board and configure its parameters. For supported boards, please refter to [Configuring Supported Development Boards](../../README.md#configuring-supported-development-boards)
23+
4. Verify and upload the example to your ESP board.
24+
25+
## Serial Output
26+
27+
```bash
28+
...
29+
LVGL porting example start
30+
Initialize panel device
31+
Initialize LVGL
32+
Create UI
33+
LVGL porting example end
34+
IDLE loop
35+
IDLE loop
36+
...
37+
```
38+
39+
## Troubleshooting
40+
41+
Please check the [FAQ](../../README.md#faq) first to see if the same question exists. If not, please create a [Github issue](https://github.com/esp-arduino-libs/ESP32_Display_Panel/issues). We will get back to you as soon as possible.

examples/platformio/boards/ESP-LCD.json renamed to examples/PlatformIO/boards/ESP-LCD.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"openocd_target": "esp32s3.cfg"
2727
},
2828
"frameworks": ["arduino", "espidf"],
29-
"name": "ESP-LCD (16M Flash 8M OPI PSRAM )",
29+
"name": "ESP-LCD (16M QIO Flash & OPI PSRAM)",
3030
"upload": {
3131
"flash_size": "16MB",
3232
"maximum_ram_size": 327680,

examples/platformio/platformio.ini renamed to examples/PlatformIO/platformio.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
platform = espressif32
33
board = ESP-LCD
44
framework = arduino
5-
platform_packages =
5+
platform_packages =
66
platformio/framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
77
platformio/framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
88
upload_speed = 921600
99
monitor_speed = 115200
10-
build_flags =
10+
build_flags =
1111
-DBOARD_HAS_PSRAM
1212
-DLV_CONF_INCLUDE_SIMPLE
1313
-DDISABLE_ALL_LIBRARY_WARNINGS
1414
-DARDUINO_USB_CDC_ON_BOOT=1
1515
-DCORE_DEBUG_LEVEL=1
1616
-DLV_LVGL_H_INCLUDE_SIMPLE
1717
-I src
18-
lib_deps =
18+
lib_deps =
1919
https://github.com/esp-arduino-libs/ESP32_Display_Panel.git
2020
https://github.com/esp-arduino-libs/ESP32_IO_Expander.git
2121
https://github.com/lvgl/lvgl.git#release/v8.3

examples/platformio/src/ESP_Panel_Board_Custom.h renamed to examples/PlatformIO/src/ESP_Panel_Board_Custom.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
* - CST816S
215215
* - FT5x06
216216
* - GT911, GT1151
217-
* - ST7123
217+
* - ST1633, ST7123
218218
* - TT21100
219219
* - XPT2046
220220
*/
@@ -362,7 +362,7 @@
362362
*/
363363
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0
364364
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1
365-
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0
365+
#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 1
366366

367367
#endif /* ESP_PANEL_USE_CUSTOM_BOARD */
368368

examples/platformio/src/ESP_Panel_Board_Supported.h renamed to examples/PlatformIO/src/ESP_Panel_Board_Supported.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@
4646
// #define BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5
4747
// #define BOARD_ESP32_S3_USB_OTG
4848

49+
/*
50+
* M5Stack (https://m5stack.com/):
51+
*
52+
* - M5STACK_M5CORE2: https://docs.m5stack.com/zh_CN/core/core2
53+
* - M5STACK_M5DIAL: https://docs.m5stack.com/zh_CN/core/M5Dial
54+
* - M5STACK_M5CORES3: https://docs.m5stack.com/zh_CN/core/CoreS3
55+
*/
56+
// #define BOARD_M5STACK_M5CORE2
57+
// #define BOARD_M5STACK_M5DIAL
58+
// #define BOARD_M5STACK_M5CORES3
59+
4960
/*
5061
* Shenzhen Jingcai Intelligent Supported Boards (https://www.displaysmodule.com/):
5162
*
@@ -68,7 +79,7 @@
6879
*
6980
*/
7081
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0
71-
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1
82+
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 2
7283
#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0
7384

7485
#endif
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#pragma once
8+
9+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10+
///////////////////////////////////////////////// Debug Configurations /////////////////////////////////////////////////
11+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12+
/* Set to 1 if assert on error. Otherwise print error message */
13+
#define ESP_PANEL_CHECK_RESULT_ASSERT (0) // 0/1
14+
15+
/* Set to 1 if print log message for debug */
16+
#define ESP_PANEL_ENABLE_LOG (0) // 0/1
17+
18+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
19+
///////////////////////////////////////////// Touch Driver Configurations //////////////////////////////////////////////
20+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
21+
/* Maximum point number */
22+
#define ESP_PANEL_TOUCH_MAX_POINTS (5)
23+
/* Maximum button number */
24+
#define ESP_PANEL_TOUCH_MAX_BUTTONS (1)
25+
26+
/**
27+
* XPT2046 related
28+
*
29+
*/
30+
#define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD (400) // Minimum Z pressure threshold
31+
/**
32+
* Enable Interrupt (PENIRQ) output, also called Full Power Mode.
33+
* Enable this to configure the XPT2046 to output low on the PENIRQ output if a touch is detected.
34+
* This mode uses more power when enabled. Note that this signal goes low normally when a read is active.
35+
*/
36+
#define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE (0) // 0/1
37+
/**
38+
* Keep internal Vref enabled.
39+
* Enable this to keep the internal Vref enabled between conversions. This uses slightly more power,
40+
* but requires fewer transactions when reading the battery voltage, aux voltage and temperature.
41+
*
42+
*/
43+
#define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE (0) // 0/1
44+
/**
45+
* Convert touch coordinates to screen coordinates.
46+
* When this option is enabled the raw ADC values will be converted from 0-4096 to 0-{screen width} or 0-{screen height}.
47+
* When this option is disabled the process_coordinates method will need to be used to convert the raw ADC values into a
48+
* screen coordinate.
49+
*
50+
*/
51+
#define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS (1) // 0/1
52+
/**
53+
* Enable data structure locking.
54+
* By enabling this option the XPT2046 driver will lock the touch position data structures when reading values from the
55+
* XPT2046 and when reading position data via API.
56+
* WARNING: enabling this option may result in unintended crashes.
57+
*
58+
*/
59+
#define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1
60+
61+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
62+
/////////////////////////////////////////////// File Version ///////////////////////////////////////////////////////////
63+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
64+
/**
65+
* Do not change the following versions, they are used to check if the configurations in this file are compatible with
66+
* the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows:
67+
*
68+
* 1. If the major version is not consistent, then the configurations in this file are incompatible with the library
69+
* and must be replaced with the file from the library.
70+
* 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to
71+
* default values. It is recommended to replace it with the file from the library.
72+
* 3. Even if the patch version is not consistent, it will not affect normal functionality.
73+
*
74+
*/
75+
#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0
76+
#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1
77+
#define ESP_PANEL_CONF_FILE_VERSION_PATCH 1

0 commit comments

Comments
 (0)