Browse Source

[imaxrt 1060] 优化LVGL文件结构

Meco Man 3 years ago
parent
commit
3344e38dd5

+ 5 - 42
bsp/imxrt/imxrt1060-nxp-evk/applications/lvgl/demo/lv_demo.c

@@ -1,54 +1,17 @@
 /*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
  *
  * SPDX-License-Identifier: Apache-2.0
  *
  * Change Logs:
  * Date           Author        Notes
- * 2022-05-05     Meco Man      First version
+ * 2021-10-17     Meco Man      First version
+ * 2022-05-10     Meco Man      improve rt-thread initialization process
  */
-#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_thread_entry(void *parameter)
+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();
-
-    while(1)
-    {
-        lv_task_handler();
-        rt_thread_mdelay(5);
-    }
-}
-
-static int lvgl_demo_init(void)
-{
-    rt_thread_init(&lvgl_thread,
-                   "LVGL",
-                   lvgl_thread_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);

+ 0 - 23
bsp/imxrt/imxrt1060-nxp-evk/applications/lvgl/lv_port_disp.h

@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2006-2022, 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

+ 0 - 31
bsp/imxrt/imxrt1060-nxp-evk/applications/lvgl/lv_port_indev.c

@@ -7,38 +7,7 @@
  * Date           Author       Notes
  * 2021-10-18     Meco Man     The first version
  */
-#include <lvgl.h>
-#include <rtdevice.h>
-
-static lv_indev_state_t last_state = LV_INDEV_STATE_REL;
-static rt_int16_t last_x = 0;
-static rt_int16_t last_y = 0;
-
-lv_indev_t * touch_indev;
-
-static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
-{
-    data->point.x = last_x;
-    data->point.y = last_y;
-    data->state = last_state;
-}
-
-void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state)
-{
-    last_state = state;
-    last_x = x;
-    last_y = LV_HOR_RES_MAX - y;
-}
 
 void lv_port_indev_init(void)
 {
-    static lv_indev_drv_t indev_drv;
-
-    /* Has not supported touch sensor! */
-    // lv_indev_drv_init(&indev_drv); /*Basic initialization*/
-    // indev_drv.type = LV_INDEV_TYPE_POINTER;
-    // indev_drv.read_cb = input_read;
-
-    // /*Register the driver in LVGL and save the created input device object*/
-    // touch_indev = lv_indev_drv_register(&indev_drv);
 }

+ 0 - 24
bsp/imxrt/imxrt1060-nxp-evk/applications/lvgl/lv_port_indev.h

@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2006-2022, 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