diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/SConscript b/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/SConscript new file mode 100644 index 0000000000..9c1b6d1ebd --- /dev/null +++ b/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/SConscript @@ -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') diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/lv_demo.c b/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/lv_demo.c new file mode 100644 index 0000000000..77bdc0ac47 --- /dev/null +++ b/bsp/stm32/stm32f469-st-disco/applications/lvgl/demo/lv_demo.c @@ -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(); +} diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_demo.c b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_demo.c deleted file mode 100644 index 3059324258..0000000000 --- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_demo.c +++ /dev/null @@ -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 -#include -#include -#define DBG_TAG "LVGL.demo" -#define DBG_LVL DBG_INFO -#include - -#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); diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.c b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.c index 6660e08b50..93c314e8c1 100644 --- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.c +++ b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.c @@ -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 #include diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.h b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.h deleted file mode 100644 index ef39eb03cd..0000000000 --- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_disp.h +++ /dev/null @@ -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 diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c index 8014b183e4..cf9d3dfda3 100644 --- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c +++ b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.c @@ -8,7 +8,6 @@ * 2021-10-18 Meco Man The first version */ #include -#include #include #include diff --git a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h b/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h deleted file mode 100644 index 3fa1766800..0000000000 --- a/bsp/stm32/stm32f469-st-disco/applications/lvgl/lv_port_indev.h +++ /dev/null @@ -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 diff --git a/bsp/stm32/stm32f469-st-disco/board/Kconfig b/bsp/stm32/stm32f469-st-disco/board/Kconfig index d528711cf4..8f433171a8 100644 --- a/bsp/stm32/stm32f469-st-disco/board/Kconfig +++ b/bsp/stm32/stm32f469-st-disco/board/Kconfig @@ -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 diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c index 3dd47068ee..d6c29e059f 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c @@ -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 + +#ifdef BSP_USING_TOUCH #include "drv_touch.h" #include -#ifdef BSP_USING_TOUCH #ifdef PKG_USING_GUIENGINE #include #include @@ -18,13 +20,14 @@ #include #elif defined(PKG_USING_LVGL) #include -#include +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 @@ -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 */