feat(i2c_oled): adapt i2c_oled example to LVGL v9

This commit simplified the example and removed esp_lvgl_port component.
And adapted example to LVGL v9.

Closes https://github.com/espressif/esp-idf/issues/14179
This commit is contained in:
Chen Jichang
2024-09-13 14:14:49 +08:00
parent cf2291a2d1
commit 21b38e8b97
4 changed files with 123 additions and 33 deletions

View File

@@ -1,18 +1,18 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0-1.0
*/
#include "lvgl.h"
void example_lvgl_demo_ui(lv_disp_t *disp)
void example_lvgl_demo_ui(lv_display_t *disp)
{
lv_obj_t *scr = lv_disp_get_scr_act(disp);
lv_obj_t *scr = lv_display_get_screen_active(disp);
lv_obj_t *label = lv_label_create(scr);
lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR); /* Circular scroll */
lv_label_set_text(label, "Hello Espressif, Hello LVGL.");
/* Size of the screen (if you use rotation 90 or 270, please set disp->driver->ver_res) */
lv_obj_set_width(label, disp->driver->hor_res);
/* Size of the screen (if you use rotation 90 or 270, please use lv_display_get_vertical_resolution) */
lv_obj_set_width(label, lv_display_get_horizontal_resolution(disp));
lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 0);
}