feat: 增强用户界面组件与功能
- 在 CMakeLists.txt 中添加新的源文件和依赖项以支持 UI 组件 - 新增 ui.c、ui_helpers.c、ui_events.h、ui.h、screens/ui_Screen1.c 和相关头文件,构建用户界面 - 更新 main.c 以初始化 UI 组件并调整 LVGL 任务栈大小 - 引入新的屏幕和控件,提升用户交互体验 - 添加 project.info 文件以记录项目元数据
This commit is contained in:
+12
-2
@@ -1,3 +1,13 @@
|
||||
idf_component_register(SRCS "main.c" "lvgl_demo_ui.c"
|
||||
PRIV_REQUIRES esp_wifi nvs_flash esp_driver_ledc
|
||||
idf_component_register(SRCS
|
||||
"main.c"
|
||||
"lvgl_demo_ui.c"
|
||||
"ui.c"
|
||||
"ui_helpers.c"
|
||||
"screens/ui_Screen1.c"
|
||||
"components/ui_comp_hook.c"
|
||||
PRIV_REQUIRES
|
||||
esp_wifi
|
||||
nvs_flash
|
||||
esp_driver_ledc
|
||||
lvgl
|
||||
INCLUDE_DIRS ".")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
screens/ui_Screen1.c
|
||||
ui.c
|
||||
components/ui_comp_hook.c
|
||||
ui_helpers.c
|
||||
+8
-4
@@ -34,6 +34,8 @@
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include "ui.h"
|
||||
|
||||
/* The examples use WiFi configuration that you can set via project
|
||||
configuration menu
|
||||
|
||||
@@ -129,7 +131,8 @@
|
||||
#define EXAMPLE_LVGL_TICK_PERIOD_MS 2
|
||||
#define EXAMPLE_LVGL_TASK_MAX_DELAY_MS 500
|
||||
#define EXAMPLE_LVGL_TASK_MIN_DELAY_MS 1000 / CONFIG_FREERTOS_HZ
|
||||
#define EXAMPLE_LVGL_TASK_STACK_SIZE (4 * 1024)
|
||||
// 8KB stack size for LVGL task
|
||||
#define EXAMPLE_LVGL_TASK_STACK_SIZE (8 * 1024)
|
||||
#define EXAMPLE_LVGL_TASK_PRIORITY 2
|
||||
|
||||
// 开启触摸屏支持
|
||||
@@ -197,7 +200,7 @@ static const char *TAG = "example";
|
||||
|
||||
static int s_retry_num = 0;
|
||||
|
||||
extern void example_lvgl_demo_ui(lv_disp_t *disp);
|
||||
// extern void example_lvgl_demo_ui(lv_disp_t *disp);
|
||||
|
||||
/**
|
||||
* @brief 设置 LCD 背光亮度
|
||||
@@ -544,10 +547,11 @@ void app_main(void) {
|
||||
xTaskCreate(example_lvgl_port_task, "LVGL", EXAMPLE_LVGL_TASK_STACK_SIZE,
|
||||
NULL, EXAMPLE_LVGL_TASK_PRIORITY, NULL);
|
||||
|
||||
ESP_LOGI(TAG, "Display LVGL Meter Widget");
|
||||
ESP_LOGI(TAG, "Lock the mutex due to the LVGL APIs are not thread-safe");
|
||||
// Lock the mutex due to the LVGL APIs are not thread-safe
|
||||
_lock_acquire(&lvgl_api_lock);
|
||||
example_lvgl_demo_ui(display);
|
||||
// example_lvgl_demo_ui(display);
|
||||
ui_init();
|
||||
_lock_release(&lvgl_api_lock);
|
||||
|
||||
// Initialize NVS
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"project_name": "HeavenlyHeroStar.spj",
|
||||
"datetime": "2026-06-30T17:42:22.1833279+08:00",
|
||||
"editor_version": "1.6.1",
|
||||
"project_version": 0,
|
||||
"user": "tzyd rsgl",
|
||||
"export_datetime": "2026-06-30T17:42:22.1833279+08:00",
|
||||
"export_user": "tzyd rsgl"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#include "../ui.h"
|
||||
|
||||
lv_obj_t * uic_Calendar1;
|
||||
lv_obj_t * ui_Screen1 = NULL;
|
||||
lv_obj_t * ui_Calendar1 = NULL;
|
||||
// event funtions
|
||||
|
||||
// build funtions
|
||||
|
||||
void ui_Screen1_screen_init(void)
|
||||
{
|
||||
ui_Screen1 = lv_obj_create(NULL);
|
||||
lv_obj_remove_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_Calendar1 = lv_calendar_create(ui_Screen1);
|
||||
lv_obj_t * ui_Calendar1_header = lv_calendar_header_arrow_create(ui_Calendar1);
|
||||
lv_obj_set_width(ui_Calendar1, 170);
|
||||
lv_obj_set_height(ui_Calendar1, 320);
|
||||
lv_obj_set_align(ui_Calendar1, LV_ALIGN_CENTER);
|
||||
|
||||
uic_Calendar1 = ui_Calendar1;
|
||||
|
||||
}
|
||||
|
||||
void ui_Screen1_screen_destroy(void)
|
||||
{
|
||||
if(ui_Screen1) lv_obj_del(ui_Screen1);
|
||||
|
||||
// NULL screen variables
|
||||
ui_Screen1 = NULL;
|
||||
uic_Calendar1 = NULL;
|
||||
ui_Calendar1 = NULL;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#ifndef UI_SCREEN1_H
|
||||
#define UI_SCREEN1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SCREEN: ui_Screen1
|
||||
extern void ui_Screen1_screen_init(void);
|
||||
extern void ui_Screen1_screen_destroy(void);
|
||||
extern lv_obj_t * ui_Screen1;
|
||||
extern lv_obj_t * ui_Calendar1;
|
||||
// CUSTOM VARIABLES
|
||||
extern lv_obj_t * uic_Calendar1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#include "ui.h"
|
||||
#include "ui_helpers.h"
|
||||
|
||||
///////////////////// VARIABLES ////////////////////
|
||||
|
||||
// EVENTS
|
||||
lv_obj_t * ui____initial_actions0;
|
||||
|
||||
// IMAGES AND IMAGE SETS
|
||||
|
||||
///////////////////// TEST LVGL SETTINGS ////////////////////
|
||||
#if LV_COLOR_DEPTH != 16
|
||||
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings"
|
||||
#endif
|
||||
|
||||
///////////////////// ANIMATIONS ////////////////////
|
||||
|
||||
///////////////////// FUNCTIONS ////////////////////
|
||||
|
||||
///////////////////// SCREENS ////////////////////
|
||||
|
||||
void ui_init(void)
|
||||
{
|
||||
lv_disp_t * dispp = lv_display_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____initial_actions0 = lv_obj_create(NULL);
|
||||
lv_disp_load_scr(ui_Screen1);
|
||||
}
|
||||
|
||||
void ui_destroy(void)
|
||||
{
|
||||
ui_Screen1_screen_destroy();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#ifndef _HEAVENLYHEROSTAR_UI_H
|
||||
#define _HEAVENLYHEROSTAR_UI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lvgl.h"
|
||||
|
||||
#include "ui_helpers.h"
|
||||
#include "ui_events.h"
|
||||
|
||||
|
||||
///////////////////// SCREENS ////////////////////
|
||||
|
||||
#include "screens/ui_Screen1.h"
|
||||
|
||||
///////////////////// VARIABLES ////////////////////
|
||||
|
||||
|
||||
// EVENTS
|
||||
|
||||
extern lv_obj_t * ui____initial_actions0;
|
||||
|
||||
// UI INIT
|
||||
void ui_init(void);
|
||||
void ui_destroy(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#ifndef _UI_EVENTS_H
|
||||
#define _UI_EVENTS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,353 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#include "ui_helpers.h"
|
||||
|
||||
void _ui_bar_set_property(lv_obj_t * target, int id, int val)
|
||||
{
|
||||
if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON);
|
||||
if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void _ui_basic_set_property(lv_obj_t * target, int id, int val)
|
||||
{
|
||||
if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val);
|
||||
if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val);
|
||||
if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val);
|
||||
if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val);
|
||||
}
|
||||
|
||||
|
||||
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val)
|
||||
{
|
||||
if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val);
|
||||
}
|
||||
|
||||
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val)
|
||||
{
|
||||
if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_image_set_src(target, val);
|
||||
}
|
||||
|
||||
void _ui_label_set_property(lv_obj_t * target, int id, const char * val)
|
||||
{
|
||||
if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val);
|
||||
}
|
||||
|
||||
|
||||
void _ui_roller_set_property(lv_obj_t * target, int id, int val)
|
||||
{
|
||||
if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON);
|
||||
if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
void _ui_slider_set_property(lv_obj_t * target, int id, int val)
|
||||
{
|
||||
if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON);
|
||||
if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
|
||||
void _ui_screen_change(lv_obj_t ** target, lv_screen_load_anim_t fademode, int spd, int delay,
|
||||
void (*target_init)(void))
|
||||
{
|
||||
if(*target == NULL)
|
||||
target_init();
|
||||
lv_screen_load_anim(*target, fademode, spd, delay, false);
|
||||
}
|
||||
|
||||
void _ui_screen_delete(void (*target)(void))
|
||||
{
|
||||
if(target != NULL) {
|
||||
target();
|
||||
}
|
||||
}
|
||||
|
||||
void _ui_arc_increment(lv_obj_t * target, int val)
|
||||
{
|
||||
int old = lv_arc_get_value(target);
|
||||
lv_arc_set_value(target, old + val);
|
||||
lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0);
|
||||
}
|
||||
|
||||
void _ui_bar_increment(lv_obj_t * target, int val, int anm)
|
||||
{
|
||||
int old = lv_bar_get_value(target);
|
||||
lv_bar_set_value(target, old + val, anm);
|
||||
}
|
||||
|
||||
void _ui_slider_increment(lv_obj_t * target, int val, int anm)
|
||||
{
|
||||
int old = lv_slider_get_value(target);
|
||||
lv_slider_set_value(target, old + val, anm);
|
||||
lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0);
|
||||
}
|
||||
|
||||
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea)
|
||||
{
|
||||
lv_keyboard_set_textarea(keyboard, textarea);
|
||||
}
|
||||
|
||||
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value)
|
||||
{
|
||||
if(value == _UI_MODIFY_FLAG_TOGGLE) {
|
||||
if(lv_obj_has_flag(target, flag)) lv_obj_remove_flag(target, flag);
|
||||
else lv_obj_add_flag(target, flag);
|
||||
}
|
||||
else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag);
|
||||
else lv_obj_remove_flag(target, flag);
|
||||
}
|
||||
void _ui_state_modify(lv_obj_t * target, int32_t state, int value)
|
||||
{
|
||||
if(value == _UI_MODIFY_STATE_TOGGLE) {
|
||||
if(lv_obj_has_state(target, state)) lv_obj_remove_state(target, state);
|
||||
else lv_obj_add_state(target, state);
|
||||
}
|
||||
else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state);
|
||||
else lv_obj_remove_state(target, state);
|
||||
}
|
||||
|
||||
|
||||
void _ui_textarea_move_cursor(lv_obj_t * target, int val)
|
||||
|
||||
{
|
||||
|
||||
if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target);
|
||||
if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target);
|
||||
if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target);
|
||||
if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target);
|
||||
lv_obj_add_state(target, LV_STATE_FOCUSED);
|
||||
}
|
||||
|
||||
typedef void (*screen_destroy_cb_t)(void);
|
||||
|
||||
void scr_unloaded_delete_cb(lv_event_t * e)
|
||||
|
||||
{
|
||||
|
||||
// Get the destroy callback from user_data
|
||||
|
||||
screen_destroy_cb_t destroy_cb = lv_event_get_user_data(e);
|
||||
if(destroy_cb) {
|
||||
|
||||
destroy_cb(); // call the specific screen destroy function
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
void _ui_opacity_set(lv_obj_t * target, int val)
|
||||
{
|
||||
lv_obj_set_style_opa(target, val, 0);
|
||||
}
|
||||
|
||||
void _ui_anim_callback_free_user_data(lv_anim_t * a)
|
||||
{
|
||||
lv_free(a->user_data);
|
||||
a->user_data = NULL;
|
||||
}
|
||||
|
||||
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_obj_set_x(usr->target, v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_obj_set_y(usr->target, v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_obj_set_width(usr->target, v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_obj_set_height(usr->target, v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_obj_set_style_opa(usr->target, v, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_image_set_scale(usr->target, v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
lv_image_set_rotation(usr->target, v);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
usr->val = v;
|
||||
|
||||
if(v < 0) v = 0;
|
||||
if(v >= usr->imgset_size) v = usr->imgset_size - 1;
|
||||
lv_image_set_src(usr->target, usr->imgset[v]);
|
||||
}
|
||||
|
||||
int32_t _ui_anim_callback_get_x(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_obj_get_x_aligned(usr->target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_y(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_obj_get_y_aligned(usr->target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_width(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_obj_get_width(usr->target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_height(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_obj_get_height(usr->target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_obj_get_style_opa(usr->target, 0);
|
||||
|
||||
}
|
||||
|
||||
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_image_get_scale(usr->target);
|
||||
|
||||
}
|
||||
|
||||
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return lv_image_get_rotation(usr->target);
|
||||
|
||||
}
|
||||
|
||||
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a)
|
||||
|
||||
{
|
||||
|
||||
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
|
||||
return usr->val;
|
||||
|
||||
}
|
||||
|
||||
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix)
|
||||
{
|
||||
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE];
|
||||
|
||||
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix);
|
||||
|
||||
lv_label_set_text(trg, buf);
|
||||
}
|
||||
|
||||
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix)
|
||||
{
|
||||
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE];
|
||||
|
||||
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix);
|
||||
|
||||
lv_label_set_text(trg, buf);
|
||||
}
|
||||
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off)
|
||||
{
|
||||
if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on);
|
||||
else lv_label_set_text(trg, txt_off);
|
||||
}
|
||||
|
||||
|
||||
void _ui_spinbox_step(lv_obj_t * target, int val)
|
||||
|
||||
{
|
||||
|
||||
if(val > 0) lv_spinbox_increment(target);
|
||||
|
||||
else lv_spinbox_decrement(target);
|
||||
|
||||
|
||||
lv_obj_send_event(target, LV_EVENT_VALUE_CHANGED, 0);
|
||||
}
|
||||
|
||||
void _ui_switch_theme(int val)
|
||||
|
||||
{
|
||||
|
||||
#ifdef UI_THEME_ACTIVE
|
||||
ui_theme_set(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.6.1
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: HeavenlyHeroStar
|
||||
|
||||
#ifndef _HEAVENLYHEROSTAR_UI_HELPERS_H
|
||||
#define _HEAVENLYHEROSTAR_UI_HELPERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "ui.h"
|
||||
|
||||
#define _UI_TEMPORARY_STRING_BUFFER_SIZE 32
|
||||
#define _UI_BAR_PROPERTY_VALUE 0
|
||||
#define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1
|
||||
void _ui_bar_set_property(lv_obj_t * target, int id, int val);
|
||||
|
||||
#define _UI_BASIC_PROPERTY_POSITION_X 0
|
||||
#define _UI_BASIC_PROPERTY_POSITION_Y 1
|
||||
#define _UI_BASIC_PROPERTY_WIDTH 2
|
||||
#define _UI_BASIC_PROPERTY_HEIGHT 3
|
||||
void _ui_basic_set_property(lv_obj_t * target, int id, int val);
|
||||
|
||||
#define _UI_DROPDOWN_PROPERTY_SELECTED 0
|
||||
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val);
|
||||
|
||||
#define _UI_IMAGE_PROPERTY_IMAGE 0
|
||||
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val);
|
||||
|
||||
#define _UI_LABEL_PROPERTY_TEXT 0
|
||||
void _ui_label_set_property(lv_obj_t * target, int id, const char * val);
|
||||
|
||||
#define _UI_ROLLER_PROPERTY_SELECTED 0
|
||||
#define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1
|
||||
void _ui_roller_set_property(lv_obj_t * target, int id, int val);
|
||||
|
||||
#define _UI_SLIDER_PROPERTY_VALUE 0
|
||||
#define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1
|
||||
void _ui_slider_set_property(lv_obj_t * target, int id, int val);
|
||||
|
||||
void _ui_screen_change(lv_obj_t ** target, lv_screen_load_anim_t fademode, int spd, int delay,
|
||||
void (*target_init)(void));
|
||||
|
||||
void _ui_screen_delete(void (*target)(void));
|
||||
|
||||
void _ui_arc_increment(lv_obj_t * target, int val);
|
||||
|
||||
void _ui_bar_increment(lv_obj_t * target, int val, int anm);
|
||||
|
||||
void _ui_slider_increment(lv_obj_t * target, int val, int anm);
|
||||
|
||||
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea);
|
||||
|
||||
#define _UI_MODIFY_FLAG_ADD 0
|
||||
#define _UI_MODIFY_FLAG_REMOVE 1
|
||||
#define _UI_MODIFY_FLAG_TOGGLE 2
|
||||
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value);
|
||||
|
||||
#define _UI_MODIFY_STATE_ADD 0
|
||||
#define _UI_MODIFY_STATE_REMOVE 1
|
||||
#define _UI_MODIFY_STATE_TOGGLE 2
|
||||
void _ui_state_modify(lv_obj_t * target, int32_t state, int value);
|
||||
|
||||
#define UI_MOVE_CURSOR_UP 0
|
||||
#define UI_MOVE_CURSOR_RIGHT 1
|
||||
#define UI_MOVE_CURSOR_DOWN 2
|
||||
#define UI_MOVE_CURSOR_LEFT 3
|
||||
void _ui_textarea_move_cursor(lv_obj_t * target, int val)
|
||||
;
|
||||
|
||||
|
||||
void scr_unloaded_delete_cb(lv_event_t * e);
|
||||
|
||||
void _ui_opacity_set(lv_obj_t * target, int val);
|
||||
|
||||
/** Describes an animation*/
|
||||
typedef struct _ui_anim_user_data_t {
|
||||
lv_obj_t * target;
|
||||
lv_image_dsc_t ** imgset;
|
||||
int32_t imgset_size;
|
||||
int32_t val;
|
||||
} ui_anim_user_data_t;
|
||||
void _ui_anim_callback_free_user_data(lv_anim_t * a);
|
||||
|
||||
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v);
|
||||
|
||||
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v);
|
||||
|
||||
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v);
|
||||
|
||||
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v);
|
||||
|
||||
|
||||
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v);
|
||||
|
||||
|
||||
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v);
|
||||
|
||||
|
||||
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v);
|
||||
|
||||
|
||||
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v);
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_x(lv_anim_t * a);
|
||||
|
||||
int32_t _ui_anim_callback_get_y(lv_anim_t * a);
|
||||
|
||||
int32_t _ui_anim_callback_get_width(lv_anim_t * a);
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_height(lv_anim_t * a);
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a);
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a);
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a);
|
||||
|
||||
|
||||
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a);
|
||||
|
||||
|
||||
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix);
|
||||
|
||||
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix);
|
||||
|
||||
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off);
|
||||
|
||||
void _ui_spinbox_step(lv_obj_t * target, int val)
|
||||
;
|
||||
|
||||
|
||||
void _ui_switch_theme(int val)
|
||||
;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user