Skip to content

Commit

Permalink
samples: modules: lvgl: transparency: Migrate to v9.2
Browse files Browse the repository at this point in the history
Removes the LV_COLOR_SCREEN_TRANSP Kconfig option as its not part of the
modules Kconfig anymore and renames the functions according to the new v9.2
API.

Signed-off-by: Fabian Blatz <[email protected]>
  • Loading branch information
faxe1008 committed Nov 21, 2024
1 parent db16b7d commit fa46844
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion samples/modules/lvgl/screen_transparency/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ CONFIG_LOG=y
CONFIG_LVGL=y
CONFIG_LV_Z_MEM_POOL_SIZE=16384
CONFIG_LV_COLOR_DEPTH_32=y
CONFIG_LV_COLOR_SCREEN_TRANSP=y

CONFIG_DISPLAY=y
13 changes: 6 additions & 7 deletions samples/modules/lvgl/screen_transparency/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ static void initialize_gui(void)
lv_obj_t *label;

/* Configure screen and background for transparency */
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, LV_PART_MAIN);
lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x000000), LV_PART_MAIN);
lv_obj_set_style_bg_opa(lv_screen_active(), LV_OPA_TRANSP, LV_PART_MAIN);
lv_obj_set_style_bg_opa(lv_layer_bottom(), LV_OPA_TRANSP, LV_PART_MAIN);

/* Create a label, set its text and align it to the center */
label = lv_label_create(lv_scr_act());
label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "Hello, world!");
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xff00ff), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_screen_active(), lv_color_hex(0xff00ff), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
}

Expand Down Expand Up @@ -60,11 +59,11 @@ int main(void)

initialize_gui();

lv_task_handler();
lv_timer_handler();
display_blanking_off(display_dev);

while (1) {
uint32_t sleep_ms = lv_task_handler();
uint32_t sleep_ms = lv_timer_handler();

k_msleep(MIN(sleep_ms, INT32_MAX));
}
Expand Down

0 comments on commit fa46844

Please sign in to comment.