优化 LVGL文件结构
This commit is contained in:
parent
8579f19ceb
commit
63f8811c89
|
@ -2,9 +2,7 @@ from building import *
|
|||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
src = ['main.c']
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
from building import *
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
group = DefineGroup('LVGL-port', src, depend = ['BSP_USING_LVGL'], CPPPATH = CPPPATH)
|
||||
|
||||
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 = ['BSP_USING_LVGL'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
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'))
|
||||
|
||||
group = group + DefineGroup('LVGL-demo', src, depend = ['BSP_USING_LVGL', 'BSP_USING_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-17 Meco Man First version
|
||||
* 2022-05-10 Meco Man improve rt-thread initialization process
|
||||
*/
|
||||
|
||||
void lv_user_gui_init(void)
|
||||
{
|
||||
/* display demo; you may replace with your LVGL application at here */
|
||||
extern void lv_demo_music(void);
|
||||
lv_demo_music();
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-17 Meco Man First version
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <lvgl.h>
|
||||
#include <lv_port_indev.h>
|
||||
#define DBG_TAG "LVGL.demo"
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#ifndef LV_THREAD_STACK_SIZE
|
||||
#define LV_THREAD_STACK_SIZE 4096
|
||||
#endif
|
||||
|
||||
#ifndef LV_THREAD_PRIO
|
||||
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 3)
|
||||
#endif
|
||||
|
||||
static void lvgl_thread(void *parameter)
|
||||
{
|
||||
extern void lv_demo_music(void);
|
||||
lv_demo_music();
|
||||
while (1)
|
||||
{
|
||||
lv_task_handler();
|
||||
rt_thread_mdelay(5);
|
||||
}
|
||||
}
|
||||
|
||||
static int lvgl_demo_init(void)
|
||||
{
|
||||
rt_thread_t tid;
|
||||
|
||||
tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 0);
|
||||
if (tid == RT_NULL)
|
||||
{
|
||||
LOG_E("Fail to create 'LVGL' thread");
|
||||
}
|
||||
rt_thread_startup(tid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_APP_EXPORT(lvgl_demo_init);
|
|
@ -12,12 +12,14 @@ menu "Onboard Peripheral Drivers"
|
|||
bool "Enable LVGL for LCD"
|
||||
select PKG_USING_LVGL
|
||||
select BSP_USING_SPI_LCD
|
||||
select PKG_USING_LV_MUSIC_DEMO
|
||||
default n
|
||||
|
||||
if BSP_USING_LVGL
|
||||
config BSP_USING_LVGL_DEMO
|
||||
bool "Enable LVGL demo"
|
||||
select PKG_USING_LV_MUSIC_DEMO
|
||||
default n
|
||||
endif
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue