Skip to content

Commit

Permalink
LVGL: Updated BSPs and examples for new ESP LVGL Port (LVGL9)
Browse files Browse the repository at this point in the history
  • Loading branch information
espzav committed May 7, 2024
1 parent 5aedd04 commit 4f4bfe6
Show file tree
Hide file tree
Showing 122 changed files with 1,850 additions and 705 deletions.
3 changes: 0 additions & 3 deletions SquareLine/boards/esp32_c3_lcdkit/sdkconfig.defaults
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
CONFIG_IDF_TARGET="esp32c3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
5 changes: 1 addition & 4 deletions SquareLine/boards/esp32_s2_kaluga_kit/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s2"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
5 changes: 1 addition & 4 deletions SquareLine/boards/esp32_s3_eye/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
5 changes: 1 addition & 4 deletions SquareLine/boards/esp32_s3_korvo_2/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
2 changes: 0 additions & 2 deletions SquareLine/boards/esp32_s3_lcd_ev_board/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ CONFIG_BSP_LCD_RGB_BUFFER_NUMS=2
CONFIG_BSP_LCD_RGB_BOUNCE_BUFFER_MODE=y
CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR=y
CONFIG_BSP_DISPLAY_LVGL_DIRECT_MODE=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y
5 changes: 1 addition & 4 deletions SquareLine/boards/esp32_s3_usb_otg/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
5 changes: 1 addition & 4 deletions SquareLine/boards/espbox/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
5 changes: 1 addition & 4 deletions SquareLine/boards/espbox_3/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
5 changes: 1 addition & 4 deletions SquareLine/boards/espbox_lite/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration
#
CONFIG_IDF_TARGET="esp32s3"
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_PERF_MONITOR=y
3 changes: 0 additions & 3 deletions SquareLine/boards/espwroverkit/sdkconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
#
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESP_DEFAULT_CPU_FREQ_240=y
CONFIG_LV_COLOR_16_SWAP=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_MEMCPY_MEMSET_STD=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_SPRINTF_CUSTOM=y
# CONFIG_LV_BUILD_EXAMPLES is not set
28 changes: 28 additions & 0 deletions bsp/esp-box-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,31 @@ ESP32-S3-BOX-3 also uses a Type-C USB connector that provides 5 V of power input
| SDCARD |:heavy_check_mark:| idf |>=4.4.5|
| IMU |:heavy_check_mark:| [espressif/icm42670](https://components.espressif.com/components/espressif/icm42670) | ^1 |
<!-- Autogenerated end: Dependencies -->
<!-- Autogenerated start: Dependencies -->
### Capabilities and dependencies
| Capability | Available | Component |Version|
|-------------|------------------|----------------------------------------------------------------------------------------------------------|-------|
| DISPLAY |:heavy_check_mark:| [espressif/esp_lcd_ili9341](https://components.espressif.com/components/espressif/esp_lcd_ili9341) | ^1 |
| LVGL_PORT |:heavy_check_mark:| [espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port) | ^2 |
| TOUCH |:heavy_check_mark:|[espressif/esp_lcd_touch_gt911](https://components.espressif.com/components/espressif/esp_lcd_touch_gt911)| ^1 |
| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) | >=2.5 |
| AUDIO |:heavy_check_mark:| [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ^1 |
|AUDIO_SPEAKER|:heavy_check_mark:| | |
| AUDIO_MIC |:heavy_check_mark:| | |
| SDCARD |:heavy_check_mark:| idf |>=4.4.5|
| IMU |:heavy_check_mark:| [espressif/icm42670](https://components.espressif.com/components/espressif/icm42670) | ^1 |
<!-- Autogenerated end: Dependencies -->
<!-- Autogenerated start: Dependencies -->
### Capabilities and dependencies
| Capability | Available | Component |Version|
|-------------|------------------|----------------------------------------------------------------------------------------------------------|-------|
| DISPLAY |:heavy_check_mark:| [espressif/esp_lcd_ili9341](https://components.espressif.com/components/espressif/esp_lcd_ili9341) | ^1 |
| LVGL_PORT |:heavy_check_mark:| [espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port) | ^2 |
| TOUCH |:heavy_check_mark:|[espressif/esp_lcd_touch_gt911](https://components.espressif.com/components/espressif/esp_lcd_touch_gt911)| ^1 |
| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) | >=2.5 |
| AUDIO |:heavy_check_mark:| [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ^1 |
|AUDIO_SPEAKER|:heavy_check_mark:| | |
| AUDIO_MIC |:heavy_check_mark:| | |
| SDCARD |:heavy_check_mark:| idf |>=4.4.5|
| IMU |:heavy_check_mark:| [espressif/icm42670](https://components.espressif.com/components/espressif/icm42670) | ^1 |
<!-- Autogenerated end: Dependencies -->
15 changes: 9 additions & 6 deletions bsp/esp-box-3/esp-box-3.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static const ili9341_lcd_init_cmd_t vendor_specific_init[] = {
{0, (uint8_t []){0}, 0xff, 0},
};

static lv_disp_t *disp;
static lv_display_t *disp;
static lv_indev_t *disp_indev = NULL;
static esp_lcd_touch_handle_t tp; // LCD touch handle
static esp_lcd_panel_handle_t panel_handle = NULL;
Expand Down Expand Up @@ -424,7 +424,7 @@ esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_hand
return ret;
}

static lv_disp_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
{
assert(cfg != NULL);
esp_lcd_panel_io_handle_t io_handle = NULL;
Expand Down Expand Up @@ -454,6 +454,9 @@ static lv_disp_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
.flags = {
.buff_dma = cfg->flags.buff_dma,
.buff_spiram = cfg->flags.buff_spiram,
#if LVGL_VERSION_MAJOR >= 9
.swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
#endif
}
};

Expand Down Expand Up @@ -534,7 +537,7 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t
return ESP_OK;
}

static lv_indev_t *bsp_display_indev_init(lv_disp_t *disp)
static lv_indev_t *bsp_display_indev_init(lv_display_t *disp)
{
BSP_ERROR_CHECK_RETURN_NULL(bsp_touch_new(NULL, &tp));
assert(tp);
Expand All @@ -548,7 +551,7 @@ static lv_indev_t *bsp_display_indev_init(lv_disp_t *disp)
return lvgl_port_add_touch(&touch_cfg);
}

lv_disp_t *bsp_display_start(void)
lv_display_t *bsp_display_start(void)
{
bsp_display_cfg_t cfg = {
.lvgl_port_cfg = ESP_LVGL_PORT_INIT_CONFIG(),
Expand All @@ -566,7 +569,7 @@ lv_disp_t *bsp_display_start(void)
return bsp_display_start_with_config(&cfg);
}

lv_disp_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
{
assert(cfg != NULL);
BSP_ERROR_CHECK_RETURN_NULL(lvgl_port_init(&cfg->lvgl_port_cfg));
Expand All @@ -585,7 +588,7 @@ lv_indev_t *bsp_display_get_input_dev(void)
return disp_indev;
}

void bsp_display_rotate(lv_disp_t *disp, lv_disp_rot_t rotation)
void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation)
{
lv_disp_set_rotation(disp, rotation);
}
Expand Down
1 change: 0 additions & 1 deletion bsp/esp-box-3/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies:
esp_lcd_touch_tt21100: "^1"
esp_lcd_touch_gt911: "^1"
esp_lcd_ili9341: "^1"
lvgl/lvgl: "^8"

espressif/esp_lvgl_port:
version: "^2"
Expand Down
6 changes: 3 additions & 3 deletions bsp/esp-box-3/include/bsp/esp-box-3.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ esp_err_t bsp_sdcard_unmount(void);
*
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_disp_t *bsp_display_start(void);
lv_display_t *bsp_display_start(void);

/**
* @brief Initialize display
Expand All @@ -363,7 +363,7 @@ lv_disp_t *bsp_display_start(void);
*
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_disp_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);
lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);

/**
* @brief Get pointer to input device (touch, buttons, ...)
Expand Down Expand Up @@ -419,7 +419,7 @@ esp_err_t bsp_display_exit_sleep(void);
* @param[in] disp Pointer to LVGL display
* @param[in] rotation Angle of the display rotation
*/
void bsp_display_rotate(lv_disp_t *disp, lv_disp_rot_t rotation);
void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation);
/**************************************************************************************************
*
* Button
Expand Down
28 changes: 28 additions & 0 deletions bsp/esp-box-lite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,31 @@ ESP32-S3-BOX-Lite also uses a Type-C USB connector that provides 5 V of power in
| SDCARD | :x: | | |
| IMU | :x: | | |
<!-- Autogenerated end: Dependencies -->
<!-- Autogenerated start: Dependencies -->
### Capabilities and dependencies
| Capability | Available | Component |Version|
|-------------|------------------|----------------------------------------------------------------------------------------------|-------|
| DISPLAY |:heavy_check_mark:| idf |>=4.4.5|
| LVGL_PORT |:heavy_check_mark:|[espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port)| ^2 |
| TOUCH | :x: | | |
| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) | >=2.4 |
| AUDIO |:heavy_check_mark:|[espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev)| ^1.0.3|
|AUDIO_SPEAKER|:heavy_check_mark:| | |
| AUDIO_MIC |:heavy_check_mark:| | |
| SDCARD | :x: | | |
| IMU | :x: | | |
<!-- Autogenerated end: Dependencies -->
<!-- Autogenerated start: Dependencies -->
### Capabilities and dependencies
| Capability | Available | Component |Version|
|-------------|------------------|----------------------------------------------------------------------------------------------|-------|
| DISPLAY |:heavy_check_mark:| idf |>=4.4.5|
| LVGL_PORT |:heavy_check_mark:|[espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port)| ^2 |
| TOUCH | :x: | | |
| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) | >=2.4 |
| AUDIO |:heavy_check_mark:|[espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev)| ^1.0.3|
|AUDIO_SPEAKER|:heavy_check_mark:| | |
| AUDIO_MIC |:heavy_check_mark:| | |
| SDCARD | :x: | | |
| IMU | :x: | | |
<!-- Autogenerated end: Dependencies -->
15 changes: 9 additions & 6 deletions bsp/esp-box-lite/esp-box-lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_hand
return ret;
}

static lv_disp_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
{
assert(cfg != NULL);
esp_lcd_panel_io_handle_t io_handle = NULL;
Expand Down Expand Up @@ -363,13 +363,16 @@ static lv_disp_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
.flags = {
.buff_dma = cfg->flags.buff_dma,
.buff_spiram = cfg->flags.buff_spiram,
#if LVGL_VERSION_MAJOR >= 9
.swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
#endif
}
};

return lvgl_port_add_disp(&disp_cfg);
}

static lv_indev_t *bsp_display_indev_init(lv_disp_t *disp)
static lv_indev_t *bsp_display_indev_init(lv_display_t *disp)
{
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
/* Initialize ADC and get ADC handle */
Expand All @@ -387,7 +390,7 @@ static lv_indev_t *bsp_display_indev_init(lv_disp_t *disp)
return lvgl_port_add_navigation_buttons(&btns);
}

lv_disp_t *bsp_display_start(void)
lv_display_t *bsp_display_start(void)
{
bsp_display_cfg_t cfg = {
.lvgl_port_cfg = ESP_LVGL_PORT_INIT_CONFIG(),
Expand All @@ -405,9 +408,9 @@ lv_disp_t *bsp_display_start(void)
return bsp_display_start_with_config(&cfg);
}

lv_disp_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
{
lv_disp_t *disp;
lv_display_t *disp;
assert(cfg != NULL);
BSP_ERROR_CHECK_RETURN_NULL(lvgl_port_init(&cfg->lvgl_port_cfg));

Expand All @@ -425,7 +428,7 @@ lv_indev_t *bsp_display_get_input_dev(void)
return disp_indev;
}

void bsp_display_rotate(lv_disp_t *disp, lv_disp_rot_t rotation)
void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation)
{
lv_disp_set_rotation(disp, rotation);
}
Expand Down
1 change: 0 additions & 1 deletion bsp/esp-box-lite/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ tags:

dependencies:
idf: ">=4.4.5"
lvgl/lvgl: "^8"

button:
version: ">=2.4"
Expand Down
6 changes: 3 additions & 3 deletions bsp/esp-box-lite/include/bsp/esp-box-lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ esp_err_t bsp_spiffs_unmount(void);
*
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_disp_t *bsp_display_start(void);
lv_display_t *bsp_display_start(void);

/**
* @brief Initialize display
Expand All @@ -308,7 +308,7 @@ lv_disp_t *bsp_display_start(void);
*
* @return Pointer to LVGL display or NULL when error occurred
*/
lv_disp_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);
lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg);

/**
* @brief Get pointer to input device (touch, buttons, ...)
Expand Down Expand Up @@ -342,7 +342,7 @@ void bsp_display_unlock(void);
* @param[in] disp Pointer to LVGL display
* @param[in] rotation Angle of the display rotation
*/
void bsp_display_rotate(lv_disp_t *disp, lv_disp_rot_t rotation);
void bsp_display_rotate(lv_display_t *disp, lv_disp_rotation_t rotation);

/**************************************************************************************************
*
Expand Down
Loading

0 comments on commit 4f4bfe6

Please sign in to comment.