mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
update a main page for test
This commit is contained in:
154
lv_sim_linux/GUI/screens/ui_mainPage.c
Normal file
154
lv_sim_linux/GUI/screens/ui_mainPage.c
Normal file
@@ -0,0 +1,154 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.5.3
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: PowerPico
|
||||
|
||||
#include "../ui.h"
|
||||
|
||||
lv_obj_t * ui_HomeScreen = NULL;
|
||||
lv_obj_t * ui_ButVal = NULL;
|
||||
lv_obj_t * ui_LabelUnitVal = NULL;
|
||||
lv_obj_t * ui_LabelValt = NULL;
|
||||
lv_obj_t * ui_ButCur = NULL;
|
||||
lv_obj_t * ui_LabelUnitCur = NULL;
|
||||
lv_obj_t * ui_LabelCur = NULL;
|
||||
lv_obj_t * ui_ButEnerge = NULL;
|
||||
lv_obj_t * ui_LabelUnitEnerge = NULL;
|
||||
lv_obj_t * ui_LabelEnerge = NULL;
|
||||
lv_obj_t * ui_ButTime = NULL;
|
||||
lv_obj_t * ui_LabelTime = NULL;
|
||||
// event funtions
|
||||
|
||||
// build funtions
|
||||
|
||||
void ui_main_screen_init(void)
|
||||
{
|
||||
ui_HomeScreen = lv_obj_create(NULL);
|
||||
lv_obj_remove_flag(ui_HomeScreen, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_ButVal = lv_button_create(ui_HomeScreen);
|
||||
lv_obj_set_width(ui_ButVal, 234);
|
||||
lv_obj_set_height(ui_ButVal, 55);
|
||||
lv_obj_set_x(ui_ButVal, 0);
|
||||
lv_obj_set_y(ui_ButVal, 4);
|
||||
lv_obj_set_align(ui_ButVal, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_ButVal, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_ButVal, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_ButVal, lv_color_hex(0xE36666), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_ButVal, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelUnitVal = lv_label_create(ui_ButVal);
|
||||
lv_obj_set_width(ui_LabelUnitVal, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelUnitVal, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelUnitVal, 70);
|
||||
lv_obj_set_y(ui_LabelUnitVal, 0);
|
||||
lv_obj_set_align(ui_LabelUnitVal, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelUnitVal, "V");
|
||||
lv_obj_set_style_text_font(ui_LabelUnitVal, &ui_font_HeiTi32, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelValt = lv_label_create(ui_ButVal);
|
||||
lv_obj_set_width(ui_LabelValt, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelValt, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelValt, -30);
|
||||
lv_obj_set_y(ui_LabelValt, 0);
|
||||
lv_obj_set_align(ui_LabelValt, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelValt, "17.23");
|
||||
lv_obj_set_style_text_font(ui_LabelValt, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_ButCur = lv_button_create(ui_HomeScreen);
|
||||
lv_obj_set_width(ui_ButCur, 234);
|
||||
lv_obj_set_height(ui_ButCur, 55);
|
||||
lv_obj_set_x(ui_ButCur, 0);
|
||||
lv_obj_set_y(ui_ButCur, 63);
|
||||
lv_obj_set_align(ui_ButCur, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_ButCur, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_ButCur, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_ButCur, lv_color_hex(0x509C55), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_ButCur, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelUnitCur = lv_label_create(ui_ButCur);
|
||||
lv_obj_set_width(ui_LabelUnitCur, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelUnitCur, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelUnitCur, 70);
|
||||
lv_obj_set_y(ui_LabelUnitCur, 0);
|
||||
lv_obj_set_align(ui_LabelUnitCur, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelUnitCur, "mA");
|
||||
lv_obj_set_style_text_font(ui_LabelUnitCur, &ui_font_HeiTi32, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelCur = lv_label_create(ui_ButCur);
|
||||
lv_obj_set_width(ui_LabelCur, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelCur, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelCur, -30);
|
||||
lv_obj_set_y(ui_LabelCur, 0);
|
||||
lv_obj_set_align(ui_LabelCur, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelCur, "28.32");
|
||||
lv_obj_set_style_text_font(ui_LabelCur, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_ButEnerge = lv_button_create(ui_HomeScreen);
|
||||
lv_obj_set_width(ui_ButEnerge, 234);
|
||||
lv_obj_set_height(ui_ButEnerge, 55);
|
||||
lv_obj_set_x(ui_ButEnerge, 0);
|
||||
lv_obj_set_y(ui_ButEnerge, 122);
|
||||
lv_obj_set_align(ui_ButEnerge, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_ButEnerge, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_ButEnerge, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_ButEnerge, lv_color_hex(0x4569C9), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_ButEnerge, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelUnitEnerge = lv_label_create(ui_ButEnerge);
|
||||
lv_obj_set_width(ui_LabelUnitEnerge, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelUnitEnerge, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelUnitEnerge, 70);
|
||||
lv_obj_set_y(ui_LabelUnitEnerge, 0);
|
||||
lv_obj_set_align(ui_LabelUnitEnerge, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelUnitEnerge, "mW");
|
||||
lv_obj_set_style_text_font(ui_LabelUnitEnerge, &ui_font_HeiTi32, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelEnerge = lv_label_create(ui_ButEnerge);
|
||||
lv_obj_set_width(ui_LabelEnerge, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelEnerge, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelEnerge, -30);
|
||||
lv_obj_set_y(ui_LabelEnerge, 0);
|
||||
lv_obj_set_align(ui_LabelEnerge, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelEnerge, "54.32");
|
||||
lv_obj_set_style_text_font(ui_LabelEnerge, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_ButTime = lv_button_create(ui_HomeScreen);
|
||||
lv_obj_set_width(ui_ButTime, 234);
|
||||
lv_obj_set_height(ui_ButTime, 55);
|
||||
lv_obj_set_x(ui_ButTime, 0);
|
||||
lv_obj_set_y(ui_ButTime, 181);
|
||||
lv_obj_set_align(ui_ButTime, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_ButTime, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_ButTime, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_ButTime, lv_color_hex(0x9F9960), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_ButTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelTime = lv_label_create(ui_ButTime);
|
||||
lv_obj_set_width(ui_LabelTime, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelTime, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelTime, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelTime, "00:00:00");
|
||||
lv_obj_set_style_text_font(ui_LabelTime, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
}
|
||||
|
||||
void ui_main_screen_destroy(void)
|
||||
{
|
||||
if(ui_HomeScreen) lv_obj_del(ui_HomeScreen);
|
||||
|
||||
// NULL screen variables
|
||||
ui_HomeScreen = NULL;
|
||||
ui_ButVal = NULL;
|
||||
ui_LabelUnitVal = NULL;
|
||||
ui_LabelValt = NULL;
|
||||
ui_ButCur = NULL;
|
||||
ui_LabelUnitCur = NULL;
|
||||
ui_LabelCur = NULL;
|
||||
ui_ButEnerge = NULL;
|
||||
ui_LabelUnitEnerge = NULL;
|
||||
ui_LabelEnerge = NULL;
|
||||
ui_ButTime = NULL;
|
||||
ui_LabelTime = NULL;
|
||||
|
||||
}
|
||||
19
lv_sim_linux/GUI/screens/ui_mainPage.h
Normal file
19
lv_sim_linux/GUI/screens/ui_mainPage.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef UI_MAINPAGE_H
|
||||
#define UI_MAINPAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SCREEN: ui_Screen1
|
||||
void ui_main_screen_init(void);
|
||||
void ui_main_screen_destroy(void);
|
||||
|
||||
extern lv_obj_t * ui_HomeScreen;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user