Skip to content

Commit 8bd03be

Browse files
author
IT: Sop.Son
committed
add example build with PlatformIO
1 parent 82ad522 commit 8bd03be

File tree

111 files changed

+22798
-0
lines changed

Some content is hidden

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

111 files changed

+22798
-0
lines changed

examples/platformio/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.pio
2+
.vscode/.browse.c_cpp.db*
3+
.vscode/c_cpp_properties.json
4+
.vscode/launch.json
5+
.vscode/ipch

examples/platformio/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "esp32s3_out.ld",
5+
"partitions": "default_16MB.csv",
6+
"memory_type": "qio_opi"
7+
},
8+
"core": "esp32",
9+
"extra_flags": [
10+
"-DBOARD_HAS_PSRAM",
11+
"-DARDUINO_USB_MODE=1",
12+
"-DARDUINO_RUNNING_CORE=1",
13+
"-DARDUINO_EVENT_RUNNING_CORE=1"
14+
],
15+
"f_cpu": "240000000L",
16+
"f_flash": "80000000L",
17+
"flash_mode": "qio",
18+
"hwids": [["0x303A", "0x1001"]],
19+
"mcu": "esp32s3",
20+
"variant": "esp32s3"
21+
},
22+
"connectivity": ["wifi"],
23+
"debug": {
24+
"default_tool": "esp-builtin",
25+
"onboard_tools": ["esp-builtin"],
26+
"openocd_target": "esp32s3.cfg"
27+
},
28+
"frameworks": ["arduino", "espidf"],
29+
"name": "ESP-LCD (16M Flash 8M OPI PSRAM )",
30+
"upload": {
31+
"flash_size": "16MB",
32+
"maximum_ram_size": 327680,
33+
"maximum_size": 16777216,
34+
"require_upload_port": true,
35+
"speed": 921600
36+
},
37+
"url": "https://www.lilygo.cc",
38+
"vendor": "LilyGo"
39+
}

examples/platformio/platformio.ini

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[env:ESP-LCD]
2+
platform = espressif32
3+
board = ESP-LCD
4+
framework = arduino
5+
platform_packages =
6+
platformio/framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
7+
platformio/framework-arduinoespressif32-libs@https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
8+
upload_speed = 921600
9+
monitor_speed = 115200
10+
build_flags =
11+
-DBOARD_HAS_PSRAM
12+
-DLV_CONF_INCLUDE_SIMPLE
13+
-DDISABLE_ALL_LIBRARY_WARNINGS
14+
-DARDUINO_USB_CDC_ON_BOOT=1
15+
-DCORE_DEBUG_LEVEL=1
16+
-DLV_LVGL_H_INCLUDE_SIMPLE
17+
-I src
18+
-D VN=1
19+
-D ESP32S3=1
20+
lib_deps =
21+
https://github.com/esp-arduino-libs/ESP32_Display_Panel.git
22+
https://github.com/esp-arduino-libs/ESP32_IO_Expander.git
23+
https://github.com/lvgl/lvgl.git#release/v8.3
24+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
#define ESP_PANEL_USE_SUPPORTED_BOARD (1) // 0/1
4+
5+
#if ESP_PANEL_USE_SUPPORTED_BOARD
6+
7+
#define BOARD_ESP32_S3_LCD_EV_BOARD_V1_5
8+
9+
#endif
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Debug configurations
3+
*
4+
*/
5+
/* Set to 1 if assert on error. Otherwise print error message */
6+
#define ESP_PANEL_CHECK_RESULT_ASSERT (0) // 0/1
7+
8+
/* Set to 1 if print log message for debug */
9+
#define ESP_PANEL_ENABLE_LOG (0) // 0/1
10+
11+
/**
12+
* Touch driver configurations
13+
*
14+
*/
15+
/* Maximum point number */
16+
#define ESP_PANEL_TOUCH_MAX_POINTS (3)
17+
18+
/* Maximum button number */
19+
#define ESP_PANEL_TOUCH_MAX_BUTTONS (1)
20+
21+
/* Model configurations */
22+
// XPT2046
23+
#define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD (400) // Minimum Z pressure threshold
24+
/**
25+
* Enable Interrupt (PENIRQ) output, also called Full Power Mode.
26+
* Enable this to configure the XPT2046 to output low on the PENIRQ output if a touch is detected.
27+
* This mode uses more power when enabled. Note that this signal goes low normally when a read is active.
28+
*/
29+
#define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE (0) // 0/1
30+
/**
31+
* Keep internal Vref enabled.
32+
* Enable this to keep the internal Vref enabled between conversions. This uses slightly more power,
33+
* but requires fewer transactions when reading the battery voltage, aux voltage and temperature.
34+
*
35+
*/
36+
#define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE (0) // 0/1
37+
/**
38+
* Convert touch coordinates to screen coordinates.
39+
* When this option is enabled the raw ADC values will be converted from 0-4096 to 0-{screen width} or 0-{screen height}.
40+
* When this option is disabled the process_coordinates method will need to be used to convert the raw ADC values into a
41+
* screen coordinate.
42+
*
43+
*/
44+
#define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS (1) // 0/1
45+
/**
46+
* Enable data structure locking.
47+
* By enabling this option the XPT2046 driver will lock the touch position data structures when reading values from the
48+
* XPT2046 and when reading position data via API.
49+
* WARNING: enabling this option may result in unintended crashes.
50+
*
51+
*/
52+
#define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1

examples/platformio/src/app.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <Arduino.h>
2+
#include <ESP_Panel_Library.h>
3+
#include <lvgl.h>
4+
#include <demos/lv_demos.h>
5+
#include "lvgl_port_v8.h"
6+
void setup()
7+
{
8+
Serial.begin(115200);
9+
10+
Serial.println("Initialize panel device");
11+
ESP_Panel *panel = new ESP_Panel();
12+
panel->init();
13+
#if LVGL_PORT_AVOID_TEAR
14+
// When avoid tearing function is enabled, configure the RGB bus according to the LVGL configuration
15+
ESP_PanelBus_RGB *rgb_bus = static_cast<ESP_PanelBus_RGB *>(panel->getLcd()->getBus());
16+
rgb_bus->configRgbFrameBufferNumber(LVGL_PORT_DISP_BUFFER_NUM);
17+
rgb_bus->configRgbBounceBufferSize(LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE);
18+
#endif
19+
20+
panel->begin();
21+
22+
Serial.println("Initialize LVGL");
23+
lvgl_port_init(panel->getLcd(), panel->getTouch());
24+
25+
Serial.println("Create UI");
26+
/* Lock the mutex due to the LVGL APIs are not thread-safe */
27+
lvgl_port_lock(-1);
28+
29+
lv_demo_music();
30+
/* Release the mutex */
31+
lvgl_port_unlock();
32+
}
33+
34+
void loop()
35+
{
36+
37+
delay(0x10);
38+
}
Lines changed: 97 additions & 0 deletions
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* @file lv_demos.h
3+
*
4+
*/
5+
6+
#ifndef LV_DEMOS_H
7+
#define LV_DEMOS_H
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
/*********************
14+
* INCLUDES
15+
*********************/
16+
#include "../lvgl.h"
17+
18+
#if LV_USE_DEMO_WIDGETS
19+
#include "widgets/lv_demo_widgets.h"
20+
#endif
21+
22+
#if LV_USE_DEMO_BENCHMARK
23+
#include "benchmark/lv_demo_benchmark.h"
24+
#endif
25+
26+
#if LV_USE_DEMO_STRESS
27+
#include "stress/lv_demo_stress.h"
28+
#endif
29+
30+
#if LV_USE_DEMO_KEYPAD_AND_ENCODER
31+
#include "keypad_encoder/lv_demo_keypad_encoder.h"
32+
#endif
33+
34+
#if LV_USE_DEMO_MUSIC
35+
#include "music/lv_demo_music.h"
36+
#endif
37+
38+
/*********************
39+
* DEFINES
40+
*********************/
41+
42+
/**********************
43+
* TYPEDEFS
44+
**********************/
45+
46+
/**********************
47+
* GLOBAL PROTOTYPES
48+
**********************/
49+
50+
/**********************
51+
* MACROS
52+
**********************/
53+
54+
#ifdef __cplusplus
55+
} /* extern "C" */
56+
#endif
57+
58+
#endif /*LV_DEMO_H*/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/demos -name "*.c")
Lines changed: 27 additions & 0 deletions

0 commit comments

Comments
 (0)