/* * Copyright 2024 NXP * NXP Confidential and 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_main_screen(lv_ui *ui) { //Write codes main_screen ui->main_screen = lv_obj_create(NULL); lv_obj_set_size(ui->main_screen, 320, 172); lv_obj_set_scrollbar_mode(ui->main_screen, LV_SCROLLBAR_MODE_OFF); //Write style for main_screen, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->main_screen, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->main_screen, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->main_screen, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->main_screen, lv_color_hex(0xb1b1b1), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_main_stop(ui->main_screen, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_stop(ui->main_screen, 255, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_power_bar ui->main_screen_power_bar = lv_bar_create(ui->main_screen); lv_obj_set_style_anim_time(ui->main_screen_power_bar, 1000, 0); lv_bar_set_mode(ui->main_screen_power_bar, LV_BAR_MODE_NORMAL); lv_bar_set_range(ui->main_screen_power_bar, 0, 100); lv_bar_set_value(ui->main_screen_power_bar, 0, LV_ANIM_OFF); lv_obj_set_pos(ui->main_screen_power_bar, 265, 10); lv_obj_set_size(ui->main_screen_power_bar, 40, 10); //Write style for main_screen_power_bar, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->main_screen_power_bar, 60, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->main_screen_power_bar, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->main_screen_power_bar, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_power_bar, 10, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_power_bar, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for main_screen_power_bar, Part: LV_PART_INDICATOR, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->main_screen_power_bar, 255, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->main_screen_power_bar, lv_color_hex(0x2195f6), LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->main_screen_power_bar, LV_GRAD_DIR_NONE, LV_PART_INDICATOR|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_power_bar, 10, LV_PART_INDICATOR|LV_STATE_DEFAULT); //Write codes main_screen_flash_img ui->main_screen_flash_img = lv_img_create(ui->main_screen); lv_obj_add_flag(ui->main_screen_flash_img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->main_screen_flash_img, &_flash_alpha_15x15); lv_img_set_pivot(ui->main_screen_flash_img, 50,50); lv_img_set_angle(ui->main_screen_flash_img, 0); lv_obj_set_pos(ui->main_screen_flash_img, 250, 7); lv_obj_set_size(ui->main_screen_flash_img, 15, 15); //Write style for main_screen_flash_img, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_img_opa(ui->main_screen_flash_img, 255, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_main_cont ui->main_screen_main_cont = lv_obj_create(ui->main_screen); lv_obj_set_pos(ui->main_screen_main_cont, 20, 36); lv_obj_set_size(ui->main_screen_main_cont, 280, 100); lv_obj_set_scrollbar_mode(ui->main_screen_main_cont, LV_SCROLLBAR_MODE_OFF); //Write style for main_screen_main_cont, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_main_cont, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->main_screen_main_cont, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->main_screen_main_cont, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_side(ui->main_screen_main_cont, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_main_cont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_label_1 ui->main_screen_label_1 = lv_label_create(ui->main_screen_main_cont); lv_label_set_text(ui->main_screen_label_1, "Type:"); lv_label_set_long_mode(ui->main_screen_label_1, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_label_1, 0, 65); lv_obj_set_size(ui->main_screen_label_1, 60, 25); //Write style for main_screen_label_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_label_1, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_label_1, &lv_font_montserratMedium_18, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_label_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_label_1, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_label_1, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_label_2 ui->main_screen_label_2 = lv_label_create(ui->main_screen_main_cont); lv_label_set_text(ui->main_screen_label_2, "Real-time Voltage"); lv_label_set_long_mode(ui->main_screen_label_2, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_label_2, 0, 10); lv_obj_set_size(ui->main_screen_label_2, 280, 25); //Write style for main_screen_label_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_label_2, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_label_2, &lv_font_montserratMedium_18, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_label_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_label_2, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_label_2, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_label_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_label_3 ui->main_screen_label_3 = lv_label_create(ui->main_screen_main_cont); lv_label_set_text(ui->main_screen_label_3, "Linearity:"); lv_label_set_long_mode(ui->main_screen_label_3, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_label_3, 115, 65); lv_obj_set_size(ui->main_screen_label_3, 105, 25); //Write style for main_screen_label_3, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_label_3, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_label_3, &lv_font_montserratMedium_18, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_label_3, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_label_3, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_label_3, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_label_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // //Write codes main_screen_label_4 // ui->main_screen_label_4 = lv_label_create(ui->main_screen_main_cont); // lv_label_set_text(ui->main_screen_label_4, "Max bias position:"); // lv_label_set_long_mode(ui->main_screen_label_4, LV_LABEL_LONG_WRAP); // lv_obj_set_pos(ui->main_screen_label_4, 5, 60); // lv_obj_set_size(ui->main_screen_label_4, 165, 15); // //Write style for main_screen_label_4, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. // lv_obj_set_style_border_width(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_radius(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_color(ui->main_screen_label_4, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_font(ui->main_screen_label_4, &lv_font_montserratMedium_14, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_opa(ui->main_screen_label_4, 255, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_letter_space(ui->main_screen_label_4, 2, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_line_space(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_align(ui->main_screen_label_4, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_bg_opa(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_top(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_right(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_bottom(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_left(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_shadow_width(ui->main_screen_label_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // //Write codes main_screen_label_5 // ui->main_screen_label_5 = lv_label_create(ui->main_screen_main_cont); // lv_label_set_text(ui->main_screen_label_5, "Move direction:"); // lv_label_set_long_mode(ui->main_screen_label_5, LV_LABEL_LONG_WRAP); // lv_obj_set_pos(ui->main_screen_label_5, 5, 80); // lv_obj_set_size(ui->main_screen_label_5, 145, 15); // //Write style for main_screen_label_5, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. // lv_obj_set_style_border_width(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_radius(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_color(ui->main_screen_label_5, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_font(ui->main_screen_label_5, &lv_font_montserratMedium_14, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_opa(ui->main_screen_label_5, 255, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_letter_space(ui->main_screen_label_5, 2, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_line_space(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_align(ui->main_screen_label_5, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_bg_opa(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_top(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_right(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_bottom(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_left(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_shadow_width(ui->main_screen_label_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_type_label ui->main_screen_type_label = lv_label_create(ui->main_screen_main_cont); lv_label_set_text(ui->main_screen_type_label, "null"); lv_label_set_long_mode(ui->main_screen_type_label, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_type_label, 60, 65); lv_obj_set_size(ui->main_screen_type_label, 45, 25); //Write style for main_screen_type_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_type_label, lv_color_hex(0x2F35DA), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_type_label, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_type_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_type_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_type_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_type_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_currv_label ui->main_screen_currv_label = lv_label_create(ui->main_screen_main_cont); lv_label_set_text(ui->main_screen_currv_label, "0mv"); lv_label_set_long_mode(ui->main_screen_currv_label, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_currv_label, 0, 40); lv_obj_set_size(ui->main_screen_currv_label, 280, 25); //Write style for main_screen_currv_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_currv_label, lv_color_hex(0x2F35DA), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_currv_label, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_currv_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_currv_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_currv_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_currv_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_linear_label ui->main_screen_linear_label = lv_label_create(ui->main_screen_main_cont); lv_label_set_text(ui->main_screen_linear_label, "0.00%"); lv_label_set_long_mode(ui->main_screen_linear_label, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_linear_label, 220, 65); lv_obj_set_size(ui->main_screen_linear_label, 55, 25); //Write style for main_screen_linear_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_linear_label, lv_color_hex(0x2F35DA), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_linear_label, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_linear_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_linear_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_linear_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_linear_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // //Write codes main_screen_mbp_label // ui->main_screen_mbp_label = lv_label_create(ui->main_screen_main_cont); // lv_label_set_text(ui->main_screen_mbp_label, "0mm"); // lv_label_set_long_mode(ui->main_screen_mbp_label, LV_LABEL_LONG_WRAP); // lv_obj_set_pos(ui->main_screen_mbp_label, 170, 60); // lv_obj_set_size(ui->main_screen_mbp_label, 105, 15); // //Write style for main_screen_mbp_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. // lv_obj_set_style_border_width(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_radius(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_color(ui->main_screen_mbp_label, lv_color_hex(0x2F35DA), LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_font(ui->main_screen_mbp_label, &lv_font_montserratMedium_14, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_opa(ui->main_screen_mbp_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_letter_space(ui->main_screen_mbp_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_line_space(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_align(ui->main_screen_mbp_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_bg_opa(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_top(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_right(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_bottom(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_left(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_shadow_width(ui->main_screen_mbp_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // //Write codes main_screen_move_label // ui->main_screen_move_label = lv_label_create(ui->main_screen_main_cont); // lv_label_set_text(ui->main_screen_move_label, "start to end"); // lv_label_set_long_mode(ui->main_screen_move_label, LV_LABEL_LONG_WRAP); // lv_obj_set_pos(ui->main_screen_move_label, 150, 80); // lv_obj_set_size(ui->main_screen_move_label, 125, 15); // //Write style for main_screen_move_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. // lv_obj_set_style_border_width(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_radius(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_color(ui->main_screen_move_label, lv_color_hex(0x2F35DA), LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_font(ui->main_screen_move_label, &lv_font_montserratMedium_14, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_opa(ui->main_screen_move_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_letter_space(ui->main_screen_move_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_line_space(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_align(ui->main_screen_move_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_bg_opa(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_top(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_right(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_bottom(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_pad_left(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_shadow_width(ui->main_screen_move_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_history_btn ui->main_screen_history_btn = lv_btn_create(ui->main_screen); ui->main_screen_history_btn_label = lv_label_create(ui->main_screen_history_btn); lv_label_set_text(ui->main_screen_history_btn_label, "history"); lv_label_set_long_mode(ui->main_screen_history_btn_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->main_screen_history_btn_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->main_screen_history_btn, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->main_screen_history_btn_label, LV_PCT(100)); lv_obj_set_pos(ui->main_screen_history_btn, 180, 144); lv_obj_set_size(ui->main_screen_history_btn, 80, 20); //Write style for main_screen_history_btn, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->main_screen_history_btn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->main_screen_history_btn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->main_screen_history_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->main_screen_history_btn, lv_color_hex(0xD01FBB), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_side(ui->main_screen_history_btn, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_history_btn, 25, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_history_btn, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_color(ui->main_screen_history_btn, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_opa(ui->main_screen_history_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_spread(ui->main_screen_history_btn, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_ofs_x(ui->main_screen_history_btn, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_ofs_y(ui->main_screen_history_btn, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_history_btn, lv_color_hex(0x191717), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_history_btn, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_history_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_history_btn, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_test_btn ui->main_screen_test_btn = lv_btn_create(ui->main_screen); ui->main_screen_test_btn_label = lv_label_create(ui->main_screen_test_btn); lv_label_set_text(ui->main_screen_test_btn_label, "start"); lv_label_set_long_mode(ui->main_screen_test_btn_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->main_screen_test_btn_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->main_screen_test_btn, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->main_screen_test_btn_label, LV_PCT(100)); lv_obj_set_pos(ui->main_screen_test_btn, 60, 144); lv_obj_set_size(ui->main_screen_test_btn, 80, 20); //Write style for main_screen_test_btn, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->main_screen_test_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->main_screen_test_btn, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->main_screen_test_btn, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->main_screen_test_btn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->main_screen_test_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->main_screen_test_btn, lv_color_hex(0xD01FBB), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_side(ui->main_screen_test_btn, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_test_btn, 25, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_test_btn, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_color(ui->main_screen_test_btn, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_opa(ui->main_screen_test_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_spread(ui->main_screen_test_btn, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_ofs_x(ui->main_screen_test_btn, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_ofs_y(ui->main_screen_test_btn, 1, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_test_btn, lv_color_hex(0x191717), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_test_btn, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_test_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_test_btn, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes main_screen_label_6 ui->main_screen_label_6 = lv_label_create(ui->main_screen); lv_label_set_text(ui->main_screen_label_6, "Magnetic Stripe Test"); lv_label_set_long_mode(ui->main_screen_label_6, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->main_screen_label_6, 5, 10); lv_obj_set_size(ui->main_screen_label_6, 213, 20); //Write style for main_screen_label_6, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->main_screen_label_6, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->main_screen_label_6, &lv_font_montserratMedium_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->main_screen_label_6, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->main_screen_label_6, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->main_screen_label_6, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->main_screen_label_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //The custom code of main_screen. extern lv_indev_t * indev_keypad; lv_group_t *group=lv_group_create(); lv_indev_set_group(indev_keypad, group); //将组绑定到输入设备 lv_group_set_editing(group, false); //导航模式 lv_group_add_obj(group ,ui->main_screen_test_btn); lv_group_add_obj(group ,ui->main_screen_history_btn); static lv_style_t btn_focused_stytle; lv_style_init(&btn_focused_stytle); lv_style_set_border_width(&btn_focused_stytle, 3); lv_obj_add_style(ui->main_screen_history_btn,&btn_focused_stytle,LV_STATE_FOCUSED); lv_obj_add_style(ui->main_screen_test_btn,&btn_focused_stytle,LV_STATE_FOCUSED); //Update current screen layout. lv_obj_update_layout(ui->main_screen); //Init events for screen. events_init_main_screen(ui); }