/* * Copyright 2024 NXP * NXP Proprietary. This software is owned or controlled by NXP and may only be used strictly in * accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing, * activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to * comply with and are bound by, such license terms. If you do not agree to be bound by the applicable license * terms, then you may not retain, install, activate or otherwise use the software. */ #include "lvgl.h" #include #include "gui_guider.h" #include "events_init.h" #include "widgets_init.h" #include "custom.h" void setup_scr_screen(lv_ui *ui) { //Write codes screen ui->screen = lv_obj_create(NULL); lv_obj_set_size(ui->screen, 240, 320); lv_obj_set_scrollbar_mode(ui->screen, LV_SCROLLBAR_MODE_OFF); //Write style for screen, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen, 239, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen, lv_color_hex(0x00ffa8), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes screen_bar_1 ui->screen_bar_1 = lv_bar_create(ui->screen); lv_obj_set_style_anim_time(ui->screen_bar_1, 1000, 0); lv_bar_set_mode(ui->screen_bar_1, LV_BAR_MODE_NORMAL); lv_bar_set_range(ui->screen_bar_1, 0, 100); lv_bar_set_value(ui->screen_bar_1, 50, LV_ANIM_OFF); lv_obj_set_pos(ui->screen_bar_1, 30, 33); lv_obj_set_size(ui->screen_bar_1, 177, 29); //Write style for screen_bar_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_bar_1, 195, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_bar_1, lv_color_hex(0xfbfbfb), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_bar_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_bar_1, 10, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_bar_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_bar_1, Part: LV_PART_INDICATOR, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_bar_1, 255, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_bar_1, lv_color_hex(0x2195f6), LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_bar_1, LV_GRAD_DIR_NONE, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_bar_1, 10, LV_PART_INDICATOR|LV_STATE_DEFAULT); //Write codes screen_bar_2 ui->screen_bar_2 = lv_bar_create(ui->screen); lv_obj_set_style_anim_time(ui->screen_bar_2, 1000, 0); lv_bar_set_mode(ui->screen_bar_2, LV_BAR_MODE_NORMAL); lv_bar_set_range(ui->screen_bar_2, 0, 100); lv_bar_set_value(ui->screen_bar_2, 50, LV_ANIM_OFF); lv_obj_set_pos(ui->screen_bar_2, 30, 146); lv_obj_set_size(ui->screen_bar_2, 177, 29); //Write style for screen_bar_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_bar_2, 195, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_bar_2, lv_color_hex(0xfbfbfb), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_bar_2, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_bar_2, 10, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_bar_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_bar_2, Part: LV_PART_INDICATOR, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_bar_2, 255, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_bar_2, lv_color_hex(0x2195f6), LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_bar_2, LV_GRAD_DIR_NONE, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_bar_2, 10, LV_PART_INDICATOR|LV_STATE_DEFAULT); //Write codes screen_bar_3 ui->screen_bar_3 = lv_bar_create(ui->screen); lv_obj_set_style_anim_time(ui->screen_bar_3, 1000, 0); lv_bar_set_mode(ui->screen_bar_3, LV_BAR_MODE_NORMAL); lv_bar_set_range(ui->screen_bar_3, 0, 100); lv_bar_set_value(ui->screen_bar_3, 50, LV_ANIM_OFF); lv_obj_set_pos(ui->screen_bar_3, 30, 258); lv_obj_set_size(ui->screen_bar_3, 177, 29); //Write style for screen_bar_3, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_bar_3, 195, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_bar_3, lv_color_hex(0xfbfbfb), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_bar_3, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_bar_3, 10, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_bar_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_bar_3, Part: LV_PART_INDICATOR, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_bar_3, 255, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_bar_3, lv_color_hex(0x2195f6), LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_bar_3, LV_GRAD_DIR_NONE, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_bar_3, 10, LV_PART_INDICATOR|LV_STATE_DEFAULT); //The custom code of screen. //Update current screen layout. lv_obj_update_layout(ui->screen); //Init events for screen. events_init_screen(ui); }