新增demo界面演示
This commit is contained in:
151
MXC-A39/lv_user_code/app/spde_ipc.c
Normal file
151
MXC-A39/lv_user_code/app/spde_ipc.c
Normal file
@ -0,0 +1,151 @@
|
||||
#include "spde_ipc.h"
|
||||
|
||||
static uint8_t spde_ui_mode = UI_MODE_NORMAL;
|
||||
static lv_obj_t * g_parent_root_win=NULL; //屏幕 适用于弹窗
|
||||
lv_timer_t * ui_refresh_timer = NULL; //ui刷新定时器
|
||||
lv_timer_t * time_refresh_timer = NULL; //时间刷新定时器
|
||||
lv_group_t *scr_key_group = NULL; //按键组
|
||||
//lv_coord_t child_id = 0;
|
||||
|
||||
lv_obj_t *scr_parent_main = NULL;
|
||||
|
||||
lv_obj_t * clean_root_win(void);
|
||||
lv_obj_t * get_root_win(void);
|
||||
void init_root_win(void);
|
||||
|
||||
void spde_ipc_set_ui_mode(uint8_t mode)
|
||||
{
|
||||
spde_ui_mode = mode;
|
||||
}
|
||||
|
||||
uint8_t spde_ipc_get_ui_mode(void)
|
||||
{
|
||||
return spde_ui_mode;
|
||||
}
|
||||
|
||||
|
||||
void creatRootObj(void)
|
||||
{
|
||||
if (scr_parent_main)
|
||||
{
|
||||
lv_obj_del(scr_parent_main);
|
||||
scr_parent_main = NULL;
|
||||
}
|
||||
|
||||
scr_parent_main = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_style_pad_all(scr_parent_main, 0, 0);
|
||||
lv_obj_set_style_border_width(scr_parent_main, 0, 0);
|
||||
lv_obj_set_size(scr_parent_main, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_scrollbar_mode(scr_parent_main, LV_SCROLLBAR_MODE_ACTIVE);
|
||||
lv_obj_clear_flag(scr_parent_main, LV_OBJ_FLAG_SCROLL_ELASTIC);
|
||||
}
|
||||
|
||||
lv_obj_t * clean_root_win(void)
|
||||
{
|
||||
printf("clean_root_win \r\n");
|
||||
|
||||
if(g_parent_root_win)
|
||||
{
|
||||
lv_obj_clean(g_parent_root_win);
|
||||
}
|
||||
lv_obj_set_style_pad_all(g_parent_root_win, 0, 0);
|
||||
lv_obj_set_size(g_parent_root_win, LV_PCT(100), LV_PCT(100));
|
||||
}
|
||||
|
||||
lv_obj_t * get_root_win(void)
|
||||
{
|
||||
printf("get_root_win \r\n");
|
||||
if(g_parent_root_win==NULL)
|
||||
{
|
||||
init_root_win();
|
||||
}
|
||||
|
||||
return g_parent_root_win;
|
||||
}
|
||||
|
||||
lv_obj_t * del_root_win(void)
|
||||
{
|
||||
printf("del_root_win \r\n");
|
||||
|
||||
if(g_parent_root_win)
|
||||
lv_obj_del(g_parent_root_win);
|
||||
|
||||
g_parent_root_win=NULL;
|
||||
}
|
||||
|
||||
void init_root_win(void)//Ö÷ÆÁÄ»³õʼ»¯
|
||||
{
|
||||
printf("init_root_win %x \r\n",g_parent_root_win);
|
||||
if(g_parent_root_win==NULL)
|
||||
{
|
||||
g_parent_root_win=lv_obj_create(lv_scr_act());
|
||||
}
|
||||
else
|
||||
{
|
||||
del_root_win();
|
||||
g_parent_root_win=lv_obj_create(lv_scr_act());
|
||||
}
|
||||
|
||||
printf("init_root_win %x \r\n",g_parent_root_win);
|
||||
if(g_parent_root_win)
|
||||
{
|
||||
lv_obj_set_style_pad_all(g_parent_root_win, 0, 0);
|
||||
lv_obj_set_size(g_parent_root_win, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_style_bg_color(g_parent_root_win, lv_color_make(0x00,0x00,0x00), 0);
|
||||
lv_obj_set_scrollbar_mode(g_parent_root_win, LV_SCROLLBAR_MODE_OFF);
|
||||
lv_obj_set_style_radius(g_parent_root_win, 0, 0);
|
||||
lv_obj_set_style_border_width(g_parent_root_win, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_color(g_parent_root_win, lv_color_black(), 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lv_timer_t *get_ui_refresh_timer(void)
|
||||
{
|
||||
close_ui_refresh_timer();
|
||||
return ui_refresh_timer;
|
||||
}
|
||||
|
||||
void close_ui_refresh_timer(void)
|
||||
{
|
||||
if (ui_refresh_timer != NULL)
|
||||
{
|
||||
lv_timer_del(ui_refresh_timer);
|
||||
ui_refresh_timer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lv_timer_t * get_time_refresh_timer(){
|
||||
close_refresh_timer();
|
||||
return time_refresh_timer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void close_refresh_timer(){
|
||||
if(time_refresh_timer !=NULL){
|
||||
lv_timer_del(time_refresh_timer);
|
||||
time_refresh_timer = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
lv_group_t * get_key_group(){
|
||||
if(scr_key_group ==NULL){
|
||||
scr_key_group = lv_group_create();
|
||||
lv_win32_add_all_input_devices_to_group(scr_key_group);
|
||||
}
|
||||
|
||||
return scr_key_group;
|
||||
}
|
||||
|
||||
|
||||
void close_all_win(void)
|
||||
{
|
||||
printf("close_all_win\r\n");
|
||||
clean_root_win();
|
||||
}
|
||||
|
Reference in New Issue
Block a user