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 Feb 1, 2024
1 parent 72a3756 commit fb8e804
Show file tree
Hide file tree
Showing 90 changed files with 974 additions and 688 deletions.
15 changes: 8 additions & 7 deletions bsp/esp-box-3/esp-box-3.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down 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(void)
static lv_display_t *bsp_display_lcd_init(void)
{
esp_lcd_panel_io_handle_t io_handle = NULL;
const bsp_display_config_t bsp_disp_cfg = {
Expand Down Expand Up @@ -456,6 +456,7 @@ static lv_disp_t *bsp_display_lcd_init(void)
},
.flags = {
.buff_dma = true,
.swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
}
};

Expand Down Expand Up @@ -536,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 @@ -550,15 +551,15 @@ 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()
};
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 @@ -577,7 +578,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
3 changes: 2 additions & 1 deletion bsp/esp-box-3/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ dependencies:
esp_lcd_touch_gt911: "^1"
esp_lcd_ili9341: "^1"

esp_lvgl_port:
espressif/esp_lvgl_port:
version: "^1"
public: true
override_path: "../../components/esp_lvgl_port"

esp_codec_dev:
version: "^1"
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 @@ -346,7 +346,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 @@ -358,7 +358,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 @@ -448,7 +448,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
15 changes: 8 additions & 7 deletions bsp/esp-box-lite/esp-box-lite.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down 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(void)
static lv_display_t *bsp_display_lcd_init(void)
{
esp_lcd_panel_io_handle_t io_handle = NULL;
esp_lcd_panel_handle_t panel_handle = NULL;
Expand Down Expand Up @@ -365,13 +365,14 @@ static lv_disp_t *bsp_display_lcd_init(void)
},
.flags = {
.buff_dma = true,
.swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
}
};

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 @@ -389,17 +390,17 @@ 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()
};
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 @@ -417,7 +418,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
3 changes: 2 additions & 1 deletion bsp/esp-box-lite/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ dependencies:
version: ">=2.4"
public: true

esp_lvgl_port:
espressif/esp_lvgl_port:
version: "^1"
public: true
override_path: "../../components/esp_lvgl_port"

esp_codec_dev:
version: "^1.0.3"
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 @@ -291,7 +291,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 @@ -303,7 +303,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 @@ -371,7 +371,7 @@ esp_err_t bsp_display_backlight_off(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
15 changes: 8 additions & 7 deletions bsp/esp-box/esp-box.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -30,7 +30,7 @@ static const char *TAG = "ESP-BOX";
_Static_assert(CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS > 0, "Touch buttons must be supported for this BSP");
/** @endcond */

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 bool i2c_initialized = false;
Expand Down Expand Up @@ -318,7 +318,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(void)
static lv_display_t *bsp_display_lcd_init(void)
{
esp_lcd_panel_io_handle_t io_handle = NULL;
esp_lcd_panel_handle_t panel_handle = NULL;
Expand Down Expand Up @@ -351,6 +351,7 @@ static lv_disp_t *bsp_display_lcd_init(void)
},
.flags = {
.buff_dma = true,
.swap_bytes = (BSP_LCD_BIGENDIAN ? true : false),
}
};

Expand Down Expand Up @@ -384,7 +385,7 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t
return esp_lcd_touch_new_i2c_tt21100(tp_io_handle, &tp_cfg, ret_touch);
}

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 @@ -398,15 +399,15 @@ 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()
};
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 @@ -425,7 +426,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
3 changes: 2 additions & 1 deletion bsp/esp-box/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ dependencies:
idf: ">=4.4.5"
esp_lcd_touch_tt21100: "^1"

esp_lvgl_port:
espressif/esp_lvgl_port:
version: "^1"
public: true
override_path: "../../components/esp_lvgl_port"

esp_codec_dev:
version: "^1.0.3"
Expand Down
6 changes: 3 additions & 3 deletions bsp/esp-box/include/bsp/esp-box.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,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 @@ -300,7 +300,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 @@ -368,7 +368,7 @@ esp_err_t bsp_display_backlight_off(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
12 changes: 6 additions & 6 deletions bsp/esp32_azure_iot_kit/esp32_azure_iot_kit.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -19,7 +19,7 @@

static const char *TAG = "Azure-IoT";

static lv_disp_t *disp;
static lv_display_t *disp;
sdmmc_card_t *bsp_sdcard = NULL; // Global uSD card handler
static bool i2c_initialized = false;

Expand Down Expand Up @@ -244,7 +244,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(void)
static lv_display_t *bsp_display_lcd_init(void)
{
esp_lcd_panel_io_handle_t io_handle = NULL;
esp_lcd_panel_handle_t panel_handle = NULL;
Expand Down Expand Up @@ -276,15 +276,15 @@ static lv_disp_t *bsp_display_lcd_init(void)
return lvgl_port_add_disp(&disp_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()
};
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 @@ -299,7 +299,7 @@ lv_indev_t *bsp_display_get_input_dev(void)
return NULL;
}

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
3 changes: 2 additions & 1 deletion bsp/esp32_azure_iot_kit/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ targets:
dependencies:
idf: ">=4.4.5"

esp_lvgl_port:
espressif/esp_lvgl_port:
version: "^1"
public: true
override_path: "../../components/esp_lvgl_port"

button:
version: ">=2.5,<4.0"
Expand Down
Loading

0 comments on commit fb8e804

Please sign in to comment.