lvgl ui support AiUIBuilder

This commit is contained in:
刘可亮
2024-11-26 13:23:39 +08:00
parent e4a45f6b7d
commit a89bc72654
57 changed files with 530 additions and 110 deletions

View File

@@ -1,17 +1,40 @@
from building import *
import os
cwd = GetCurrentDir()
# check if .h or .hpp files exist
def check_h_hpp_exist(path):
file_dirs = os.listdir(path)
for file_dir in file_dirs:
if os.path.splitext(file_dir)[1] in ['.h', '.hpp']:
return True
return False
src = []
inc = []
group = []
src = Glob('*.c')
CPPPATH = [cwd]
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
group = group + SConscript(os.path.join(d, 'SConscript'))
cwd = GetCurrentDir()
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = CPPPATH)
if GetDepend(['AIC_LVGL_UI_BUILDER']):
ui_path = 'ui_builder/'
src = Glob(ui_path + '*.c')
lvgl_cwd = cwd + '/'
lvgl_src_cwd = lvgl_cwd + ui_path
inc = inc + [lvgl_src_cwd]
for root, dirs, files in os.walk(lvgl_src_cwd):
for dir in dirs:
current_path = os.path.join(root, dir)
rela_path = current_path.replace(lvgl_cwd, '')
src = src + Glob(rela_path + '/*.c') # add all .c files
if check_h_hpp_exist(current_path): # add .h and .hpp path
inc = inc + [current_path]
else:
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
group = group + SConscript(os.path.join(d, 'SConscript'))
group = group + DefineGroup('LVGL-port', src, depend = ['AIC_LVGL_DEMO'], CPPPATH = inc)
Return('group')

View File

@@ -411,3 +411,8 @@ void base_ui_init()
lv_obj_add_event_cb(main_tabview, main_tapview_event, LV_EVENT_ALL, NULL);
}
void ui_init(void)
{
base_ui_init();
}

View File

@@ -1065,3 +1065,8 @@ void base_ui_init()
lv_obj_add_event_cb(main_tabview, main_tapview_event, LV_EVENT_ALL, NULL);
}
void ui_init(void)
{
base_ui_init();
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2023-2024 ArtinChip Technology Co., Ltd.
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Ning Fang <ning.fang@artinchip.com>
*/
@@ -383,3 +386,8 @@ void dashboard_ui_init()
lv_timer_create(trip_callback, 1000 * 5, 0);
lv_timer_create(signal_callback, 500, 0);
}
void ui_init(void)
{
dashboard_ui_init();
}

View File

@@ -1,8 +1,12 @@
/*
* Copyright (C) 2023-2024 ArtinChip Technology Co., Ltd.
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Ning Fang <ning.fang@artinchip.com>
*/
#ifndef DASHBOARD_H
#define DASHBOARD_H

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -121,3 +121,8 @@ void layer_sys_ui_invisible(int flag)
{
lv_obj_add_flag(sys_ui.home_btn, LV_OBJ_FLAG_HIDDEN);
}
void ui_init(void)
{
demo_hub_init();
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2023-2024 ArtinChip Technology Co., Ltd.
* Copyright (C) 2023-2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Huahui Mai <huahui.mai@artinchip.com>
*
*/

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2023-2024 ArtinChip Technology Co., Ltd.
* Copyright (C) 2023-2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Huahui Mai <huahui.mai@artinchip.com>
*
*/

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2023-2024 ArtinChip Technology Co., Ltd.
* Copyright (C) 2023-2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Keliang Liu <keliang.liu@artinchip.com>
* Huahui Mai <huahui.mai@artinchip.com>
*/
@@ -18,7 +21,7 @@
#include "elevator_uart.h"
FAKE_IMAGE_DECLARE(ELEVATOR_BG_WHITE)
FAKE_IMAGE_DECLARE(ELEVATOR_BG_WHITE);
LV_FONT_DECLARE(ui_font_h1);
LV_FONT_DECLARE(ui_font_regular);
@@ -577,3 +580,7 @@ void elevator_ui_init()
#endif
}
void ui_init(void)
{
elevator_ui_init();
}

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2023-2024 ArtinChip Technology Co., Ltd.
* Copyright (C) 2023-2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Keliang Liu <keliang.liu@artinchip.com>
* Huahui Mai <huahui.mai@artinchip.com>
*/

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -44,3 +44,8 @@ void gif_ui_init()
lv_obj_add_event_cb(img, gif_event, LV_EVENT_ALL, NULL);
printf("gif_ini_ok\n");
}
void ui_init(void)
{
gif_ui_init();
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -124,3 +124,8 @@ void image_ui_init(void)
lv_timer_create(change_file_image_callback, 1000, 0);
#endif
}
void ui_init(void)
{
image_ui_init();
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -27,3 +27,8 @@ void launcher_ui_init()
lv_scr_load(scr_launcher);
}
void ui_init(void)
{
launcher_ui_init();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -625,3 +625,8 @@ void meter_ui_init()
return;
}
void ui_init(void)
{
meter_ui_init();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -47,3 +47,8 @@ void lv_multi_lang_example(void)
lv_scr_load(screen_white);
}
void ui_init(void)
{
lv_multi_lang_example();
}

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Ning Fang <ning.fang@artinchip.com>
*/

View File

@@ -1,5 +1,8 @@
/*__cplusplus
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
/*
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Ning Fang <ning.fang@artinchip.com>
*/

View File

@@ -1,5 +1,8 @@
/*
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Ning Fang <ning.fang@artinchip.com>
*/

View File

@@ -1,5 +1,8 @@
/*__cplusplus
* Copyright (C) 2022-2023 ArtinChip Technology Co., Ltd.
/*
* Copyright (C) 2022-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Ning Fang <ning.fang@artinchip.com>
*/

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -386,3 +386,7 @@ void simple_player_ui_init()
lv_timer_create(player_callback, 20, 0);
}
void ui_init(void)
{
simple_player_ui_init();
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -23,3 +23,8 @@ void slide_ui_init()
scr_slide = hor_screen_init();
lv_scr_load(scr_slide);
}
void ui_init(void)
{
slide_ui_init();
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
#undef LV_USE_FREETYPE
#define LV_USE_FREETYPE 1
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: ArtInChip
*/
#include "ui_init.h"
void ui_init(void)
{
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "You can replace this code with the code generated by AiUIBuilder!");
lv_obj_center(label);
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: ArtInChip
*/
#ifndef _UI_INIT_H
#define _UI_INIT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "lvgl.h"
void ui_init(void);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif // _UI_INIT_H

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -454,3 +454,8 @@ void usb_osd_ui_init(void)
lv_timer_create(usb_osd_ui_callback, 200, 0);
}
void ui_init(void)
{
usb_osd_ui_init();
}

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2024 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024, ArtInChip Technology Co., Ltd
* Copyright (C) 2023-2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -22,3 +22,8 @@ void vscode_ui_init(void)
template_ui_init();
#endif
}
void ui_init(void)
{
vscode_ui_init();
}