[stm32f469][lvgl] 优化LVGL文件结构
This commit is contained in:
parent
e6466d0fb7
commit
1b4f16f729
|
@ -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,54 +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 / 8)
|
||||
#endif
|
||||
|
||||
static struct rt_thread lvgl_thread;
|
||||
static rt_uint8_t lvgl_thread_stack[LV_THREAD_STACK_SIZE];
|
||||
|
||||
static void lvgl_entry(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_init(&lvgl_thread,
|
||||
"LVGL",
|
||||
lvgl_entry,
|
||||
RT_NULL,
|
||||
&lvgl_thread_stack[0],
|
||||
sizeof(lvgl_thread_stack),
|
||||
LV_THREAD_PRIO,
|
||||
10);
|
||||
rt_thread_startup(&lvgl_thread);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_APP_EXPORT(lvgl_demo_init);
|
|
@ -6,7 +6,7 @@
|
|||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-18 Meco Man The first version
|
||||
* 2021-12-24 Rb Refresh using dma2d
|
||||
* 2021-12-24 Rb Refresh using dma2d
|
||||
*/
|
||||
#include <lvgl.h>
|
||||
#include <lcd_port.h>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-18 Meco Man The first version
|
||||
*/
|
||||
#ifndef LV_PORT_DISP_H
|
||||
#define LV_PORT_DISP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void lv_port_disp_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -8,7 +8,6 @@
|
|||
* 2021-10-18 Meco Man The first version
|
||||
*/
|
||||
#include <lvgl.h>
|
||||
#include <stdbool.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#include <lcd_port.h>
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-18 Meco Man The first version
|
||||
*/
|
||||
#ifndef LV_PORT_INDEV_H
|
||||
#define LV_PORT_INDEV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void lv_port_indev_init(void);
|
||||
void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -30,9 +30,15 @@ menu "Onboard Peripheral Drivers"
|
|||
select BSP_USING_LCD_OTM8009A
|
||||
select BSP_USING_TOUCH
|
||||
select PKG_USING_LVGL
|
||||
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
|
||||
|
||||
config BSP_USING_QSPI_FLASH
|
||||
bool "Enable QSPI FLASH (N25Q128A qspi1)"
|
||||
select BSP_USING_QSPI
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
|
@ -8,9 +8,11 @@
|
|||
* 2018-02-08 Zhangyihong the first version
|
||||
*/
|
||||
|
||||
#include <rtconfig.h>
|
||||
|
||||
#ifdef BSP_USING_TOUCH
|
||||
#include "drv_touch.h"
|
||||
#include <string.h>
|
||||
#ifdef BSP_USING_TOUCH
|
||||
#ifdef PKG_USING_GUIENGINE
|
||||
#include <rtgui/event.h>
|
||||
#include <rtgui/rtgui_server.h>
|
||||
|
@ -18,13 +20,14 @@
|
|||
#include <littlevgl2rtt.h>
|
||||
#elif defined(PKG_USING_LVGL)
|
||||
#include <lvgl.h>
|
||||
#include <lv_port_indev.h>
|
||||
extern void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state);
|
||||
static rt_bool_t touch_down = RT_FALSE;
|
||||
#endif
|
||||
#endif /* PKG_USING_GUIENGINE */
|
||||
|
||||
#define BSP_TOUCH_SAMPLE_HZ (50)
|
||||
|
||||
#define DBG_ENABLE
|
||||
#define DBG_SECTION_NAME "TOUCH"
|
||||
#define DBG_SECTION_NAME "touch"
|
||||
#define DBG_LEVEL DBG_LOG
|
||||
#define DBG_COLOR
|
||||
#include <rtdbg.h>
|
||||
|
@ -44,7 +47,6 @@ static void post_down_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
|
|||
|
||||
emouse.parent.sender = RT_NULL;
|
||||
emouse.wid = RT_NULL;
|
||||
|
||||
emouse.parent.type = RTGUI_EVENT_MOUSE_BUTTON;
|
||||
emouse.button = RTGUI_MOUSE_BUTTON_LEFT | RTGUI_MOUSE_BUTTON_DOWN;
|
||||
emouse.x = x;
|
||||
|
@ -67,7 +69,6 @@ static void post_motion_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
|
|||
|
||||
emouse.parent.sender = RT_NULL;
|
||||
emouse.wid = RT_NULL;
|
||||
|
||||
emouse.button = RTGUI_MOUSE_BUTTON_LEFT | RTGUI_MOUSE_BUTTON_DOWN;
|
||||
emouse.parent.type = RTGUI_EVENT_MOUSE_MOTION;
|
||||
emouse.x = x;
|
||||
|
@ -79,7 +80,7 @@ static void post_motion_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
|
|||
littlevgl2rtt_send_input_event(x, y, LITTLEVGL2RTT_INPUT_MOVE);
|
||||
#elif defined(PKG_USING_LVGL)
|
||||
lv_port_indev_input(x, y, (touch_down == RT_TRUE) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL);
|
||||
#endif
|
||||
#endif /* PKG_USING_GUIENGINE */
|
||||
}
|
||||
|
||||
static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
|
||||
|
@ -89,7 +90,6 @@ static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
|
|||
|
||||
emouse.parent.sender = RT_NULL;
|
||||
emouse.wid = RT_NULL;
|
||||
|
||||
emouse.parent.type = RTGUI_EVENT_MOUSE_BUTTON;
|
||||
emouse.button = RTGUI_MOUSE_BUTTON_LEFT | RTGUI_MOUSE_BUTTON_UP;
|
||||
emouse.x = x;
|
||||
|
@ -102,7 +102,7 @@ static void post_up_event(rt_uint16_t x, rt_uint16_t y, rt_tick_t ts)
|
|||
#elif defined(PKG_USING_LVGL)
|
||||
touch_down = RT_FALSE;
|
||||
lv_port_indev_input(x, y, (touch_down == RT_TRUE) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL);
|
||||
#endif
|
||||
#endif /* PKG_USING_GUIENGINE */
|
||||
}
|
||||
|
||||
static void touch_thread_entry(void *parameter)
|
||||
|
@ -194,7 +194,7 @@ static void touch_init_thread_entry(void *parameter)
|
|||
static int touc_bg_init(void)
|
||||
{
|
||||
rt_thread_t tid = RT_NULL;
|
||||
tid = rt_thread_create("touchi", touch_init_thread_entry, RT_NULL, 2048, 28, 20);
|
||||
tid = rt_thread_create("touch", touch_init_thread_entry, RT_NULL, 2048, 28, 20);
|
||||
if (tid == RT_NULL)
|
||||
{
|
||||
return -1;
|
||||
|
@ -202,7 +202,6 @@ static int touc_bg_init(void)
|
|||
rt_thread_startup(tid);
|
||||
return 0;
|
||||
}
|
||||
INIT_APP_EXPORT(touc_bg_init);
|
||||
INIT_COMPONENT_EXPORT(touc_bg_init);
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* BSP_USING_TOUCH */
|
||||
|
|
Loading…
Reference in New Issue