Skip to content

Commit 11d26c7

Browse files
Merge pull request #1 from lvgl/master
Merge from lvgl
2 parents c985063 + 70ba70a commit 11d26c7

File tree

6 files changed

+45
-26
lines changed

6 files changed

+45
-26
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
PROJECT_NAME := lvgl-demo
77

88
# Add new components (source folders)
9-
EXTRA_COMPONENT_DIRS := components/lvgl_esp32_drivers/lvgl_tft components/lvgl_esp32_drivers/lvgl_touch
9+
EXTRA_COMPONENT_DIRS := components/lvgl_esp32_drivers/lvgl_tft
10+
EXTRA_COMPONENT_DIRS += components/lvgl_esp32_drivers/lvgl_touch
1011
# Must be before include $(IDF_PATH)/make/project.mk
1112
# $(PROJECT_PATH)/xxx didn't work -> use $(abspath xxx) instead
1213

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,23 @@ int app_main(void)
113113
/* hw_loop(); */
114114

115115
return 0;
116+
}
116117
```
117118
118119
For more information see: [platformio with espidf framework compability](https://github.com/lvgl/lv_port_esp32/issues/168).
119120
120121
# ESP32-S2 Support
121122
122-
Support for ESP32-S2 variant isn't tested, the current drivers implementation
123-
would needs to be improved because this target available memory is less than
124-
ESP32 targets. The menuconfig interface also would need to be improved to take
125-
this into account.
123+
Support for ESP32-S2 variant is Work In Progress.
124+
Smaller displays (e.g. 320x240) work fine, but larger ones need testing.
125+
126+
## Background
127+
128+
ESP32-S2 has less on-chip SRAM than its predecessor ESP32 (520kB vs. 320kB).
129+
This causes problems with memory allocation with large LVGL display buffers as they don't fit into the on-chip memory
130+
and external PSRAM is not accessible by DMA.
131+
132+
Moreover, static allocation to external PSRAM is not yet supported
133+
(see [GitHub issue](https://github.com/espressif/esp-idf/issues/6162)).
134+
135+
At this momement, the buffers are dynamicaly allocated with DMA capabilty and memory allocator handles the rest.

components/lv_examples/Kconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ menu "lv_examples configuration"
1212
config LV_USE_DEMO_WIDGETS
1313
bool "Show demo widgets."
1414

15-
config LV_DEMO_WIDGETS_SLIDESHOW
16-
bool "Slide demo widgets automatically."
17-
depends on LV_USE_DEMO_WIDGETS
18-
default y
19-
2015
config LV_USE_DEMO_KEYPAD_AND_ENCODER
2116
bool "Demonstrate the usage of encoder and keyboard."
2217

@@ -26,4 +21,9 @@ menu "lv_examples configuration"
2621
config LV_USE_DEMO_STRESS
2722
bool "Stress test for LVGL."
2823
endchoice
24+
25+
config LV_DEMO_WIDGETS_SLIDESHOW
26+
bool "Slide demo widgets automatically."
27+
depends on LV_USE_DEMO_WIDGETS
28+
default y
2929
endmenu

main/component.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
#
44
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
55

6-
CFLAGS+= -DLV_CONF_INCLUDE_SIMPLE
6+
CFLAGS += -DLV_CONF_INCLUDE_SIMPLE
7+
CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE

main/main.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* LVGL Example project
2-
*
2+
*
33
* Basic project to test LVGL on ESP32 based projects.
44
*
55
* This example code is in the Public Domain (or CC0 licensed, at your option.)
@@ -60,7 +60,7 @@ static void create_demo_application(void);
6060
* APPLICATION MAIN
6161
**********************/
6262
void app_main() {
63-
63+
6464
/* If you want to use a task to create the graphic, you NEED to create a Pinned task
6565
* Otherwise there can be problem such as memory corruption and so on.
6666
* NOTE: When not using Wi-Fi nor Bluetooth you can pin the guiTask to core 0 */
@@ -73,20 +73,22 @@ void app_main() {
7373
SemaphoreHandle_t xGuiSemaphore;
7474

7575
static void guiTask(void *pvParameter) {
76-
76+
7777
(void) pvParameter;
7878
xGuiSemaphore = xSemaphoreCreateMutex();
7979

8080
lv_init();
81-
81+
8282
/* Initialize SPI or I2C bus used by the drivers */
8383
lvgl_driver_init();
8484

85-
static lv_color_t buf1[DISP_BUF_SIZE];
85+
lv_color_t* buf1 = heap_caps_malloc(DISP_BUF_SIZE * sizeof(lv_color_t), MALLOC_CAP_DMA);
86+
assert(buf1 != NULL);
8687

8788
/* Use double buffered when not working with monochrome displays */
8889
#ifndef CONFIG_LV_TFT_DISPLAY_MONOCHROME
89-
static lv_color_t buf2[DISP_BUF_SIZE];
90+
lv_color_t* buf2 = heap_caps_malloc(DISP_BUF_SIZE * sizeof(lv_color_t), MALLOC_CAP_DMA);
91+
assert(buf2 != NULL);
9092
#else
9193
static lv_color_t *buf2 = NULL;
9294
#endif
@@ -95,10 +97,11 @@ static void guiTask(void *pvParameter) {
9597

9698
uint32_t size_in_px = DISP_BUF_SIZE;
9799

98-
#if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820 \
99-
|| defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A \
100-
|| defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D
101-
100+
#if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820 \
101+
|| defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A \
102+
|| defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D \
103+
|| defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306
104+
102105
/* Actual size in pixels, not bytes. */
103106
size_in_px *= 8;
104107
#endif
@@ -130,7 +133,7 @@ static void guiTask(void *pvParameter) {
130133
indev_drv.type = LV_INDEV_TYPE_POINTER;
131134
lv_indev_drv_register(&indev_drv);
132135
#endif
133-
136+
134137
/* Create and start a periodic timer interrupt to call lv_tick_inc */
135138
const esp_timer_create_args_t periodic_timer_args = {
136139
.callback = &lv_tick_task,
@@ -142,7 +145,7 @@ static void guiTask(void *pvParameter) {
142145

143146
/* Create the demo application */
144147
create_demo_application();
145-
148+
146149
while (1) {
147150
/* Delay 1 tick (assumes FreeRTOS tick is 10ms */
148151
vTaskDelay(pdMS_TO_TICKS(10));
@@ -155,16 +158,20 @@ static void guiTask(void *pvParameter) {
155158
}
156159

157160
/* A task should NEVER return */
161+
free(buf1);
162+
#ifndef CONFIG_LV_TFT_DISPLAY_MONOCHROME
163+
free(buf2);
164+
#endif
158165
vTaskDelete(NULL);
159166
}
160167

161168
static void create_demo_application(void)
162169
{
163-
/* When using a monochrome display we only show "Hello World" centered on the
170+
/* When using a monochrome display we only show "Hello World" centered on the
164171
* screen */
165172
#if defined CONFIG_LV_TFT_DISPLAY_MONOCHROME || \
166173
defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S
167-
174+
168175
/* use a pretty small demo for monochrome displays */
169176
/* Get the current screen */
170177
lv_obj_t * scr = lv_disp_get_scr_act(NULL);

0 commit comments

Comments
 (0)