Skip to content

Commit

Permalink
feat(example): add support for PlatformIO (#42)
Browse files Browse the repository at this point in the history
Closes #37
  • Loading branch information
Lzw655 authored Jun 14, 2024
2 parents 8131565 + f117509 commit b1fb5bc
Show file tree
Hide file tree
Showing 14 changed files with 1,603 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* feat(board): add add new board M5CORE2 by @MacChu0315-Espressif (#40)
* feat(board): add add new board M5DIAL by @MacChu0315-Espressif (#41)
* feat(board): add add new board M5CORES3 by @MacChu0315-Espressif (#45)
* feat(example): add support for PlatformIO by @isthaison (#37)

### Bugfixes:

Expand Down
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ ESP32_Display_Panel encapsulates various components from the [Espressif Componen
- [Using Supported Development Boards](#using-supported-development-boards)
- [Using Custom Development Boards](#using-custom-development-boards)
- [Usage Examples](#usage-examples)
- [LCD](#lcd)
- [Touch](#touch)
- [Panel](#panel)
- [LVGL v8](#lvgl-v8)
- [SquareLine](#squareline)
- [Arduino IDE](#arduino-ide)
- [LCD](#lcd)
- [Touch](#touch)
- [Panel](#panel)
- [LVGL v8](#lvgl-v8)
- [SquareLine](#squareline)
- [PlatformIO](#platformio)
- [Other Relevant Instructions](#other-relevant-instructions)
- [Configuring Supported Development Boards](#configuring-supported-development-boards)
- [Configuring LVGL](#configuring-lvgl)
Expand All @@ -38,6 +40,7 @@ ESP32_Display_Panel encapsulates various components from the [Espressif Componen
- [How to Install ESP32\_Display\_Panel in Arduino IDE?](#how-to-install-esp32_display_panel-in-arduino-ide)
- [Where are the installation directory for arduino-esp32 and the SDK located?](#where-are-the-installation-directory-for-arduino-esp32-and-the-sdk-located)
- [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)
- [How to Use ESP32\_Display\_Panel on PlatformIO?](#how-to-use-esp32_display_panel-on-platformio)

## Overview

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

### Usage Examples

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.
The following are some examples of using ESP32_Display_Panel on different development platforms.

#### LCD
#### Arduino IDE

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.

##### LCD

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

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

#### Touch
##### Touch

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:

* [I2C](examples/Touch/I2C/)
* [SPI](examples/Touch/SPI/)

#### Panel
##### Panel

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

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

#### LVGL v8
##### LVGL v8

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

* [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.
* [Rotation](examples/LVGL/v8/Rotation/): This example demonstrates how to use LVGL to rotate the display.

#### SquareLine
##### SquareLine

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

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

#### PlatformIO

- [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.

## Other Relevant Instructions

### Configuring Supported Development Boards
Expand Down Expand Up @@ -446,3 +457,7 @@ When encountering screen drift issue when driving RGB LCD with ESP32-S3, you can
lcd_bus->begin();
...
```
### How to Use ESP32_Display_Panel on PlatformIO?
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.
37 changes: 26 additions & 11 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ ESP32_Display_Panel 封装了多种[乐鑫组件库](https://components.espressi
- [使用支持的开发板](#使用支持的开发板)
- [使用自定义开发板](#使用自定义开发板)
- [示例说明](#示例说明)
- [LCD](#lcd)
- [Touch](#touch)
- [Panel](#panel)
- [LVGL v8](#lvgl-v8)
- [SquareLine](#squareline)
- [Arduino IDE](#arduino-ide)
- [LCD](#lcd)
- [Touch](#touch)
- [Panel](#panel)
- [LVGL v8](#lvgl-v8)
- [SquareLine](#squareline)
- [PlatformIO](#platformio)
- [其他相关说明](#其他相关说明)
- [配置支持的开发板](#配置支持的开发板)
- [配置 LVGL](#配置-lvgl)
Expand All @@ -38,6 +40,7 @@ ESP32_Display_Panel 封装了多种[乐鑫组件库](https://components.espressi
- [如何在 Arduino IDE 中安装 ESP32\_Display\_Panel?](#如何在-arduino-ide-中安装-esp32_display_panel)
- [arduino-eps32 的安装目录以及 SDK 的目录在哪儿?](#arduino-eps32-的安装目录以及-sdk-的目录在哪儿)
- [使用 ESP32-S3 驱动 RGB LCD 时出现画面漂移问题的解决方案](#使用-esp32-s3-驱动-rgb-lcd-时出现画面漂移问题的解决方案)
- [如何在 PlatformIO 上使用 ESP32\_Display\_Panel?](#如何在-platformio-上使用-esp32_display_panel)

## 概述

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

### 示例说明

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

#### LCD
#### Arduino IDE

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

##### LCD

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

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

#### Touch
##### Touch

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

* [I2C](examples/Touch/I2C/)
* [SPI](examples/Touch/SPI/)

#### Panel
##### Panel

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

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

#### LVGL v8
##### LVGL v8

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

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

#### SquareLine
##### SquareLine

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

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

#### PlatformIO

- [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) 文件。

## 其他相关说明

### 配置支持的开发板
Expand Down Expand Up @@ -446,3 +457,7 @@ arduino-esp32 v3.x.x 版本的 SDK 位于默认安装路径下的 `tools > esp32
lcd_bus->begin();
...
```
### 如何在 PlatformIO 上使用 ESP32_Display_Panel?
您可以参考示例 [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) 文件。
5 changes: 5 additions & 0 deletions examples/PlatformIO/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
41 changes: 41 additions & 0 deletions examples/PlatformIO/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# PlatformIO Example

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.

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.

## How to Use

Follow the steps below to configure:

1. For **ESP32_Display_Panel**:

- Follow the [steps](../../README.md#configuring-drivers) to configure drivers if needed.
- If using a supported development board, follow the [steps](../../README.md#using-supported-development-boards) to configure it.
- If using a custom board, follow the [steps](../../README.md#using-custom-development-boards) to configure it.

2. For **lvgl**:

- Follow the [steps](../../README.md#configuring-lvgl) to add *lv_conf.h* file and change the configurations.
- Modify the macros in the [lvgl_port_v8.h](./lvgl_port_v8.h) file to configure the LVGL porting parameters.

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)
4. Verify and upload the example to your ESP board.

## Serial Output

```bash
...
LVGL porting example start
Initialize panel device
Initialize LVGL
Create UI
LVGL porting example end
IDLE loop
IDLE loop
...
```

## Troubleshooting

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.
39 changes: 39 additions & 0 deletions examples/PlatformIO/boards/ESP-LCD.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"partitions": "default_16MB.csv",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [["0x303A", "0x1001"]],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": ["wifi"],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": ["esp-builtin"],
"openocd_target": "esp32s3.cfg"
},
"frameworks": ["arduino", "espidf"],
"name": "ESP-LCD (16M QIO Flash & OPI PSRAM)",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"require_upload_port": true,
"speed": 921600
},
"url": "https://www.espressif.com",
"vendor": "ESP-LCD"
}
22 changes: 22 additions & 0 deletions examples/PlatformIO/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[env:ESP-LCD]
platform = espressif32
board = ESP-LCD
framework = arduino
platform_packages =
platformio/framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
platformio/framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
upload_speed = 921600
monitor_speed = 115200
build_flags =
-DBOARD_HAS_PSRAM
-DLV_CONF_INCLUDE_SIMPLE
-DDISABLE_ALL_LIBRARY_WARNINGS
-DARDUINO_USB_CDC_ON_BOOT=1
-DCORE_DEBUG_LEVEL=1
-DLV_LVGL_H_INCLUDE_SIMPLE
-I src
lib_deps =
https://github.com/esp-arduino-libs/ESP32_Display_Panel.git
https://github.com/esp-arduino-libs/ESP32_IO_Expander.git
https://github.com/lvgl/lvgl.git#release/v8.3

Loading

0 comments on commit b1fb5bc

Please sign in to comment.