SquareLine Studio 1.5.0是一款LVGL图形化的软件,LVGL官方的软件,针对这个软件我们主要做的除了开发,就是移植到自己的板端,过程中会遇到各种各样的问题。
下面附上源代码:
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.0
// LVGL version: 8.3.11
// Project name: SquareLine_Project
#include "ui.h"
void ui_Screen2_screen_init(void)
{
ui_Screen2 = lv_obj_create(NULL);
lv_obj_clear_flag(ui_Screen2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_bg_color(ui_Screen2, lv_color_hex(0xEBE7E7), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Screen2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_Container3 = lv_obj_create(ui_Screen2);
lv_obj_remove_style_all(ui_Container3);
lv_obj_set_width(ui_Container3, 261);
lv_obj_set_height(ui_Container3, 39);
lv_obj_set_x(ui_Container3, 1);
lv_obj_set_y(ui_Container3, 89);
lv_obj_set_align(ui_Container3, LV_ALIGN_CENTER);
lv_obj_clear_flag(ui_Container3, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_radius(ui_Container3, 10, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Container3, lv_color_hex(0xD7D6D6), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Container3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_Slider7 = lv_slider_create(ui_Container3);
lv_slider_set_range(ui_Slider7, 0, 255);
lv_slider_set_value(ui_Slider7, 0, LV_ANIM_OFF);
if(lv_slider_get_mode(ui_Slider7) == LV_SLIDER_MODE_RANGE) lv_slider_set_left_value(ui_Slider7, 0, LV_ANIM_OFF);
lv_obj_set_width(ui_Slider7, 195);
lv_obj_set_height(ui_Slider7, 10);
lv_obj_set_x(ui_Slider7, 4);
lv_obj_set_y(ui_Slider7, 1);
lv_obj_set_align(ui_Slider7, LV_ALIGN_CENTER);
lv_obj_clear_flag(ui_Slider7, LV_OBJ_FLAG_GESTURE_BUBBLE); /// Flags
lv_obj_set_style_bg_color(ui_Slider7, lv_color_hex(0xF4EDED), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Slider7, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui_Slider7, lv_color_hex(0xEA2F2F), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui_Slider7, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui_Slider7, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui_Slider7, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui_Slider7, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui_Slider7, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Slider7, lv_color_hex(0xB9B8B8), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Slider7, 255, LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Slider7, lv_color_hex(0x868585), LV_PART_KNOB | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Slider7, 255, LV_PART_KNOB | LV_STATE_DEFAULT);
ui_Image5 = lv_img_create(ui_Container3);
lv_img_set_src(ui_Image5, &ui_img_1_png);
lv_obj_set_width(ui_Image5, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image5, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image5, 115);
lv_obj_set_y(ui_Image5, 1);
lv_obj_set_align(ui_Image5, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image5, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image5, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_img_set_zoom(ui_Image5, 100);
ui_Image6 = lv_img_create(ui_Container3);
lv_img_set_src(ui_Image6, &ui_img_2_png);
lv_obj_set_width(ui_Image6, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image6, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image6, -114);
lv_obj_set_y(ui_Image6, 1);
lv_obj_set_align(ui_Image6, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image6, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image6, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_img_set_zoom(ui_Image6, 150);
ui_Container4 = lv_obj_create(ui_Screen2);
lv_obj_remove_style_all(ui_Container4);
lv_obj_set_width(ui_Container4, 262);
lv_obj_set_height(ui_Container4, 137);
lv_obj_set_x(ui_Container4, 2);
lv_obj_set_y(ui_Container4, -5);
lv_obj_set_align(ui_Container4, LV_ALIGN_CENTER);
lv_obj_clear_flag(ui_Container4, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_radius(ui_Container4, 15, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Container4, lv_color_hex(0xD7D6D6), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Container4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_Roller2 = lv_roller_create(ui_Container4);
lv_roller_set_options(ui_Roller2, "Hot Metal\nRainbow\nIron\nGrayscale\nBluewhite\nPurplered\nIronbow",
LV_ROLLER_MODE_NORMAL);
lv_obj_set_height(ui_Roller2, 113);
lv_obj_set_width(ui_Roller2, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Roller2, 73);
lv_obj_set_y(ui_Roller2, 0);
lv_obj_set_align(ui_Roller2, LV_ALIGN_CENTER);
lv_obj_set_style_radius(ui_Roller2, 12, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Roller2, lv_color_hex(0xEFE9E9), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Roller2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui_Roller2, lv_color_hex(0x736C6C), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui_Roller2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Roller2, lv_color_hex(0xC508D2), LV_PART_SELECTED | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Roller2, 255, LV_PART_SELECTED | LV_STATE_DEFAULT);
ui_Dropdown3 = lv_dropdown_create(ui_Container4);
lv_dropdown_set_options(ui_Dropdown3, "Non-interpol\nInterp");
lv_obj_set_width(ui_Dropdown3, 128);
lv_obj_set_height(ui_Dropdown3, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Dropdown3, -50);
lv_obj_set_y(ui_Dropdown3, 38);
lv_obj_set_align(ui_Dropdown3, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Dropdown3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_set_style_radius(ui_Dropdown3, 12, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Dropdown3, lv_color_hex(0xEFE9E9), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Dropdown3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(lv_dropdown_get_list(ui_Dropdown3), lv_color_hex(0xEFE9E9), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(lv_dropdown_get_list(ui_Dropdown3), 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(lv_dropdown_get_list(ui_Dropdown3), lv_color_hex(0xC508D2),
LV_PART_SELECTED | LV_STATE_CHECKED);
lv_obj_set_style_bg_opa(lv_dropdown_get_list(ui_Dropdown3), 255, LV_PART_SELECTED | LV_STATE_CHECKED);
ui_Switch1 = lv_switch_create(ui_Container4);
lv_obj_set_width(ui_Switch1, 50);
lv_obj_set_height(ui_Switch1, 25);
lv_obj_set_x(ui_Switch1, -11);
lv_obj_set_y(ui_Switch1, -9);
lv_obj_set_align(ui_Switch1, LV_ALIGN_CENTER);
lv_obj_set_style_bg_color(ui_Switch1, lv_color_hex(0xC9C5C5), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Switch1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Switch1, lv_color_hex(0xC508D2), LV_PART_INDICATOR | LV_STATE_CHECKED);
lv_obj_set_style_bg_opa(ui_Switch1, 255, LV_PART_INDICATOR | LV_STATE_CHECKED);
ui_Button3 = lv_btn_create(ui_Container4);
lv_obj_set_width(ui_Button3, 50);
lv_obj_set_height(ui_Button3, 24);
lv_obj_set_x(ui_Button3, -11);
lv_obj_set_y(ui_Button3, -40);
lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_clear_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_radius(ui_Button3, 40, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Button3, lv_color_hex(0xDADADA), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Button3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_color(ui_Button3, lv_color_hex(0x8E8989), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui_Button3, LV_GRAD_DIR_VER, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_Spinner2 = lv_spinner_create(ui_Container4, 1000, 90);
lv_obj_set_width(ui_Spinner2, 44);
lv_obj_set_height(ui_Spinner2, 43);
lv_obj_set_x(ui_Spinner2, -99);
lv_obj_set_y(ui_Spinner2, -25);
lv_obj_set_align(ui_Spinner2, LV_ALIGN_CENTER);
lv_obj_clear_flag(ui_Spinner2, LV_OBJ_FLAG_CLICKABLE); /// Flags
lv_obj_set_style_arc_color(ui_Spinner2, lv_color_hex(0xC508D2), LV_PART_INDICATOR | LV_STATE_DEFAULT);
lv_obj_set_style_arc_opa(ui_Spinner2, 255, LV_PART_INDICATOR | LV_STATE_DEFAULT);
ui_Image7 = lv_img_create(ui_Container4);
lv_img_set_src(ui_Image7, &ui_img_3_png);
lv_obj_set_width(ui_Image7, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image7, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image7, -54);
lv_obj_set_y(ui_Image7, -6);
lv_obj_set_align(ui_Image7, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image7, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image7, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_img_set_zoom(ui_Image7, 120);
ui_Image8 = lv_img_create(ui_Container4);
lv_img_set_src(ui_Image8, &ui_img_4_png);
lv_obj_set_width(ui_Image8, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image8, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image8, -53);
lv_obj_set_y(ui_Image8, -38);
lv_obj_set_align(ui_Image8, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image8, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image8, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_img_set_zoom(ui_Image8, 120);
ui_Container5 = lv_obj_create(ui_Screen2);
lv_obj_remove_style_all(ui_Container5);
lv_obj_set_width(ui_Container5, 261);
lv_obj_set_height(ui_Container5, 40);
lv_obj_set_x(ui_Container5, 1);
lv_obj_set_y(ui_Container5, -97);
lv_obj_set_align(ui_Container5, LV_ALIGN_CENTER);
lv_obj_clear_flag(ui_Container5, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_radius(ui_Container5, 10, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Container5, lv_color_hex(0xD7D6D6), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_Container5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_TextArea2 = lv_textarea_create(ui_Container5);
lv_obj_set_width(ui_TextArea2, 148);
lv_obj_set_height(ui_TextArea2, 30);
lv_obj_set_x(ui_TextArea2, -48);
lv_obj_set_y(ui_TextArea2, 1);
lv_obj_set_align(ui_TextArea2, LV_ALIGN_CENTER);
lv_obj_set_flex_flow(ui_TextArea2, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(ui_TextArea2, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
lv_textarea_set_text(ui_TextArea2, "7yewh \nThermal imaging");
lv_textarea_set_placeholder_text(ui_TextArea2, "Placeholder...");
lv_obj_set_style_radius(ui_TextArea2, 10, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_TextArea2, lv_color_hex(0xEFE9E9), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_TextArea2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_Label1 = lv_label_create(ui_Container5);
lv_obj_set_width(ui_Label1, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Label1, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Label1, 80);
lv_obj_set_y(ui_Label1, 2);
lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER);
lv_label_set_text(ui_Label1, "4.7V");
lv_obj_set_style_text_color(ui_Label1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui_Label1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_Label1, &lv_font_montserrat_14, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_Image9 = lv_img_create(ui_Container5);
lv_img_set_src(ui_Image9, &ui_img_5_png);
lv_obj_set_width(ui_Image9, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image9, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image9, 48);
lv_obj_set_y(ui_Image9, 2);
lv_obj_set_align(ui_Image9, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image9, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image9, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Image11 = lv_img_create(ui_Container5);
lv_img_set_src(ui_Image11, &ui_img_6_png);
lv_obj_set_width(ui_Image11, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Image11, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Image11, 109);
lv_obj_set_y(ui_Image11, 2);
lv_obj_set_align(ui_Image11, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image11, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image11, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_img_set_zoom(ui_Image11, 120);
lv_obj_add_event_cb(ui_Button3, ui_event_Button3, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(ui_Screen2, ui_event_Screen2, LV_EVENT_ALL, NULL);
}
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.0
// LVGL version: 8.3.11
// Project name: SquareLine_Project
#include "ui.h"
#include "ui_helpers.h"
/ VARIABLES
// SCREEN: ui_Screen1
void ui_Screen1_screen_init(void);
lv_obj_t * ui_Screen1;
// CUSTOM VARIABLES
// SCREEN: ui_Screen2
void ui_Screen2_screen_init(void);
void ui_event_Screen2(lv_event_t * e);
lv_obj_t * ui_Screen2;
lv_obj_t * ui_Container3;
lv_obj_t * ui_Slider7;
lv_obj_t * ui_Image5;
lv_obj_t * ui_Image6;
lv_obj_t * ui_Container4;
lv_obj_t * ui_Roller2;
lv_obj_t * ui_Dropdown3;
lv_obj_t * ui_Switch1;
void ui_event_Button3(lv_event_t * e);
lv_obj_t * ui_Button3;
lv_obj_t * ui_Spinner2;
lv_obj_t * ui_Image7;
lv_obj_t * ui_Image8;
lv_obj_t * ui_Container5;
lv_obj_t * ui_TextArea2;
lv_obj_t * ui_Label1;
lv_obj_t * ui_Image9;
lv_obj_t * ui_Image11;
// CUSTOM VARIABLES
// SCREEN: ui_Screen3
void ui_Screen3_screen_init(void);
lv_obj_t * ui_Screen3;
lv_obj_t * ui_Container8;
lv_obj_t * ui_Label4;
void ui_event_Button5(lv_event_t * e);
lv_obj_t * ui_Button5;
lv_obj_t * ui_Container9;
lv_obj_t * ui_Label5;
// CUSTOM VARIABLES
// SCREEN: ui_Screen4
void ui_Screen4_screen_init(void);
void ui_event_Screen4(lv_event_t * e);
lv_obj_t * ui_Screen4;
lv_obj_t * ui_Chart2;
lv_obj_t * ui_Label2;
// CUSTOM VARIABLES
// SCREEN: ui_Screen5
void ui_Screen5_screen_init(void);
void ui_event_Screen5(lv_event_t * e);
lv_obj_t * ui_Screen5;
lv_obj_t * ui_Spinner4;
lv_obj_t * ui_Spinner3;
lv_obj_t * ui_Spinner5;
lv_obj_t * ui_Bar3;
lv_obj_t * ui_Label3;
// CUSTOM VARIABLES
// EVENTS
lv_obj_t * ui____initial_actions0;
// IMAGES AND IMAGE SETS
const lv_img_dsc_t * ui_imgset_[6] = {&ui_img_1_png, &ui_img_2_png, &ui_img_3_png, &ui_img_4_png, &ui_img_5_png, &ui_img_6_png};
/ TEST LVGL SETTINGS
#if LV_COLOR_DEPTH != 16
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings"
#endif
#if LV_COLOR_16_SWAP !=0
#error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings"
#endif
/ ANIMATIONS
/ FUNCTIONS
void ui_event_Screen2(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
lv_indev_wait_release(lv_indev_get_act());
_ui_screen_change(&ui_Screen4, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 400, 0, &ui_Screen4_screen_init);
}
if(event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
lv_indev_wait_release(lv_indev_get_act());
_ui_screen_change(&ui_Screen5, LV_SCR_LOAD_ANIM_MOVE_LEFT, 400, 0, &ui_Screen5_screen_init);
}
}
void ui_event_Button3(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_CLICKED) {
_ui_screen_change(&ui_Screen3, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, &ui_Screen3_screen_init);
}
}
void ui_event_Button5(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_CLICKED) {
_ui_screen_change(&ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 500, 0, &ui_Screen2_screen_init);
}
}
void ui_event_Screen4(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_LEFT) {
lv_indev_wait_release(lv_indev_get_act());
_ui_screen_change(&ui_Screen2, LV_SCR_LOAD_ANIM_MOVE_LEFT, 400, 0, &ui_Screen2_screen_init);
}
}
void ui_event_Screen5(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_GESTURE && lv_indev_get_gesture_dir(lv_indev_get_act()) == LV_DIR_RIGHT) {
lv_indev_wait_release(lv_indev_get_act());
_ui_screen_change(&ui_Screen2, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 400, 0, &ui_Screen2_screen_init);
}
}
/ SCREENS
void ui_init(void)
{
lv_disp_t * dispp = lv_disp_get_default();
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
false, LV_FONT_DEFAULT);
lv_disp_set_theme(dispp, theme);
ui_Screen1_screen_init();
ui_Screen2_screen_init();
ui_Screen3_screen_init();
ui_Screen4_screen_init();
ui_Screen5_screen_init();
ui____initial_actions0 = lv_obj_create(NULL);
lv_disp_load_scr(ui_Screen1);
}
更多代码就不再赘述了,其次就是移植的内容了,这部分内容是主要的,如下所示:
由于我移植的是RP2040 pico 也就是树莓派的MCU,我的开发环境是arduino IDE以及VS code,因此配置也要选择好屏幕的分别率,我的是240以及280的,对应配置端也需要选择好。
更多小细节的移植问题在我之前的博客内容也有提到,可以去看看。
产生的上述文件移放到lib目录下即可,其次就是位于lv_conf.h中配置相关参数,要把log等配置置1,还有一些屏幕参数,位于TFT_eSPI进行修改,最重要就是LVGL与TFT的要点了,如果你屏幕配置不对,你的屏幕显示也有各种问题,例如博主遇到的就是坐标偏移的相关问题,TFT与LVGL显示发生了问题,因此一定要选好,TFT的配置位于UESR中了,一定要注意,并且两者的起始坐标也是相同的才行。(下述图就是移植成功的效果了,有点模糊,拍摄问题)