summaryrefslogtreecommitdiff
path: root/lib/lvgl/env_support/rt-thread
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-06-12 17:54:40 +1000
committerjacqueline <me@jacqueline.id.au>2024-06-12 17:54:40 +1000
commit64bd9053a25297f7a442ca831c7da5b44bd33f84 (patch)
treea90c6cad25a12028302ab1a5334510fba0229bae /lib/lvgl/env_support/rt-thread
parent611176ed667c4ed7ee9f609e958f9404f4aee91d (diff)
downloadtangara-fw-64bd9053a25297f7a442ca831c7da5b44bd33f84.tar.gz
Update LVGL to v9.1.0
Diffstat (limited to 'lib/lvgl/env_support/rt-thread')
-rw-r--r--lib/lvgl/env_support/rt-thread/SConscript11
-rw-r--r--lib/lvgl/env_support/rt-thread/lv_rt_thread_conf.h50
-rw-r--r--lib/lvgl/env_support/rt-thread/lv_rt_thread_port.c22
-rw-r--r--lib/lvgl/env_support/rt-thread/squareline/SConscript30
-rw-r--r--lib/lvgl/env_support/rt-thread/squareline/lv_ui_entry.c (renamed from lib/lvgl/env_support/rt-thread/squareline/ui/lv_ui_entry.c)2
-rw-r--r--lib/lvgl/env_support/rt-thread/squareline/ui/lvgl/lvgl.h15
6 files changed, 78 insertions, 52 deletions
diff --git a/lib/lvgl/env_support/rt-thread/SConscript b/lib/lvgl/env_support/rt-thread/SConscript
index 378c36f3..56983c0a 100644
--- a/lib/lvgl/env_support/rt-thread/SConscript
+++ b/lib/lvgl/env_support/rt-thread/SConscript
@@ -12,8 +12,8 @@ port_src = Glob('*.c')
port_inc = [cwd]
group = group + DefineGroup('LVGL-port', port_src, depend = ['PKG_USING_LVGL'], CPPPATH = port_inc)
-# check if .h or .hpp files exsit
-def check_h_hpp_exsit(path):
+# check if .h or .hpp files exists
+def check_h_hpp_exists(path):
file_dirs = os.listdir(path)
for file_dir in file_dirs:
if os.path.splitext(file_dir)[1] in ['.h', '.hpp']:
@@ -24,11 +24,12 @@ lvgl_cwd = cwd + '/../../'
lvgl_src_cwd = lvgl_cwd + 'src/'
inc = inc + [lvgl_src_cwd]
+src = src + Glob(os.path.join(lvgl_src_cwd,'*.c'))
for root, dirs, files in os.walk(lvgl_src_cwd):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files
- if check_h_hpp_exsit(current_path): # add .h and .hpp path
+ if check_h_hpp_exists(current_path): # add .h and .hpp path
inc = inc + [current_path]
@@ -39,7 +40,7 @@ if GetDepend('PKG_LVGL_USING_EXAMPLES'):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c'))
- if check_h_hpp_exsit(current_path):
+ if check_h_hpp_exists(current_path):
inc = inc + [current_path]
if GetDepend('PKG_LVGL_USING_DEMOS'):
@@ -49,7 +50,7 @@ if GetDepend('PKG_LVGL_USING_DEMOS'):
for dir in dirs:
current_path = os.path.join(root, dir)
src = src + Glob(os.path.join(current_path,'*.c'))
- if check_h_hpp_exsit(current_path):
+ if check_h_hpp_exists(current_path):
inc = inc + [current_path]
LOCAL_CFLAGS = ''
diff --git a/lib/lvgl/env_support/rt-thread/lv_rt_thread_conf.h b/lib/lvgl/env_support/rt-thread/lv_rt_thread_conf.h
index 92da372d..f1697cca 100644
--- a/lib/lvgl/env_support/rt-thread/lv_rt_thread_conf.h
+++ b/lib/lvgl/env_support/rt-thread/lv_rt_thread_conf.h
@@ -17,32 +17,24 @@
#include LV_RTTHREAD_INCLUDE
/*=========================
- MEMORY SETTINGS
+ STDLIB WRAPPER SETTINGS
*=========================*/
#ifdef RT_USING_HEAP
-# define LV_MEM_CUSTOM 1
-# define LV_MEM_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
-# define LV_MEM_CUSTOM_ALLOC rt_malloc
-# define LV_MEM_CUSTOM_FREE rt_free
-# define LV_MEM_CUSTOM_REALLOC rt_realloc
+ #define LV_USE_STDLIB_MALLOC LV_STDLIB_RTTHREAD
#endif
-/*====================
- HAL SETTINGS
- *====================*/
-
-#define LV_TICK_CUSTOM 1
-#define LV_TICK_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
-#define LV_TICK_CUSTOM_SYS_TIME_EXPR (rt_tick_get_millisecond()) /*Expression evaluating to current system time in ms*/
+#define LV_USE_STDLIB_STRING LV_STDLIB_RTTHREAD
-#ifdef PKG_LVGL_DISP_REFR_PERIOD
-#define LV_DISP_DEF_REFR_PERIOD PKG_LVGL_DISP_REFR_PERIOD
+#if LV_USE_FLOAT == 0
+ #define LV_USE_STDLIB_SPRINTF LV_STDLIB_RTTHREAD
#endif
-/*=======================
- * FEATURE CONFIGURATION
- *=======================*/
+/*=================
+ * OPERATING SYSTEM
+ *=================*/
+
+#define LV_USE_OS LV_OS_RTTHREAD
/*-------------
* Asserts
@@ -51,34 +43,28 @@
#define LV_ASSERT_HANDLER_INCLUDE LV_RTTHREAD_INCLUDE
#define LV_ASSERT_HANDLER RT_ASSERT(0);
-/*-------------
- * Others
- *-----------*/
-
-#define LV_SPRINTF_CUSTOM 1
-#define LV_SPRINTF_INCLUDE LV_RTTHREAD_INCLUDE
-#define lv_snprintf rt_snprintf
-#define lv_vsnprintf rt_vsnprintf
-#define LV_SPRINTF_USE_FLOAT 0
-
/*=====================
* COMPILER SETTINGS
*====================*/
#ifdef ARCH_CPU_BIG_ENDIAN
-# define LV_BIG_ENDIAN_SYSTEM 1
+ #define LV_BIG_ENDIAN_SYSTEM 1
#else
-# define LV_BIG_ENDIAN_SYSTEM 0
+ #define LV_BIG_ENDIAN_SYSTEM 0
#endif
-#define LV_ATTRIBUTE_MEM_ALIGN ALIGN(4)
+#ifdef rt_align /* >= RT-Thread v5.0.0 */
+ #define LV_ATTRIBUTE_MEM_ALIGN rt_align(RT_ALIGN_SIZE)
+#else
+ #define LV_ATTRIBUTE_MEM_ALIGN ALIGN(RT_ALIGN_SIZE)
+#endif
/*==================
* EXAMPLES
*==================*/
#ifdef PKG_LVGL_USING_EXAMPLES
-# define LV_BUILD_EXAMPLES 1
+ #define LV_BUILD_EXAMPLES 1
#endif
/*--END OF LV_RT_THREAD_CONF_H--*/
diff --git a/lib/lvgl/env_support/rt-thread/lv_rt_thread_port.c b/lib/lvgl/env_support/rt-thread/lv_rt_thread_port.c
index 98a1439b..4e49344a 100644
--- a/lib/lvgl/env_support/rt-thread/lv_rt_thread_port.c
+++ b/lib/lvgl/env_support/rt-thread/lv_rt_thread_port.c
@@ -19,19 +19,29 @@
#include <rtdbg.h>
#ifndef PKG_LVGL_THREAD_STACK_SIZE
-#define PKG_LVGL_THREAD_STACK_SIZE 4096
+ #define PKG_LVGL_THREAD_STACK_SIZE 4096
#endif /* PKG_LVGL_THREAD_STACK_SIZE */
#ifndef PKG_LVGL_THREAD_PRIO
-#define PKG_LVGL_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
+ #define PKG_LVGL_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
#endif /* PKG_LVGL_THREAD_PRIO */
+#ifndef PKG_LVGL_DISP_REFR_PERIOD
+ #define PKG_LVGL_DISP_REFR_PERIOD 33
+#endif /* PKG_LVGL_DISP_REFR_PERIOD */
+
extern void lv_port_disp_init(void);
extern void lv_port_indev_init(void);
extern void lv_user_gui_init(void);
static struct rt_thread lvgl_thread;
-static ALIGN(8) rt_uint8_t lvgl_thread_stack[PKG_LVGL_THREAD_STACK_SIZE];
+
+#ifdef rt_align
+ rt_align(RT_ALIGN_SIZE)
+#else
+ ALIGN(RT_ALIGN_SIZE)
+#endif
+static rt_uint8_t lvgl_thread_stack[PKG_LVGL_THREAD_STACK_SIZE];
#if LV_USE_LOG
static void lv_rt_log(const char *buf)
@@ -50,11 +60,13 @@ static void lvgl_thread_entry(void *parameter)
lv_port_indev_init();
lv_user_gui_init();
+ lv_tick_set_cb(&rt_tick_get_millisecond);
+
/* handle the tasks of LVGL */
while(1)
{
lv_task_handler();
- rt_thread_mdelay(LV_DISP_DEF_REFR_PERIOD);
+ rt_thread_mdelay(PKG_LVGL_DISP_REFR_PERIOD);
}
}
@@ -63,7 +75,7 @@ static int lvgl_thread_init(void)
rt_err_t err;
err = rt_thread_init(&lvgl_thread, "LVGL", lvgl_thread_entry, RT_NULL,
- &lvgl_thread_stack[0], sizeof(lvgl_thread_stack), PKG_LVGL_THREAD_PRIO, 0);
+ &lvgl_thread_stack[0], sizeof(lvgl_thread_stack), PKG_LVGL_THREAD_PRIO, 10);
if(err != RT_EOK)
{
LOG_E("Failed to create LVGL thread");
diff --git a/lib/lvgl/env_support/rt-thread/squareline/SConscript b/lib/lvgl/env_support/rt-thread/squareline/SConscript
index 89a50997..08220b45 100644
--- a/lib/lvgl/env_support/rt-thread/squareline/SConscript
+++ b/lib/lvgl/env_support/rt-thread/squareline/SConscript
@@ -1,13 +1,25 @@
from building import *
cwd = GetCurrentDir()
-group = []
-src = []
-CPPPATH =[]
-
-src += Glob(cwd + '/ui/*.c')
-CPPPATH += [cwd+'/ui']
-
-group = group + DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'], CPPPATH = CPPPATH)
-
+src = Glob('*.c')
+inc = [cwd]
+
+# check if .h or .hpp files exists
+def check_h_hpp_exists(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
+
+sls_src_cwd = cwd
+for root, dirs, files in os.walk(sls_src_cwd):
+ for dir in dirs:
+ current_path = os.path.join(root, dir)
+ src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files
+ if check_h_hpp_exists(current_path): # add .h and .hpp path
+ inc = inc + [current_path]
+
+group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'], CPPPATH = inc)
+
Return('group')
diff --git a/lib/lvgl/env_support/rt-thread/squareline/ui/lv_ui_entry.c b/lib/lvgl/env_support/rt-thread/squareline/lv_ui_entry.c
index 838b53c9..f08e1f58 100644
--- a/lib/lvgl/env_support/rt-thread/squareline/ui/lv_ui_entry.c
+++ b/lib/lvgl/env_support/rt-thread/squareline/lv_ui_entry.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
- * SPDX-License-Identifier: Apache-2.0
+ * SPDX-License-Identifier: MIT
*
* Change Logs:
* Date Author Notes
diff --git a/lib/lvgl/env_support/rt-thread/squareline/ui/lvgl/lvgl.h b/lib/lvgl/env_support/rt-thread/squareline/ui/lvgl/lvgl.h
new file mode 100644
index 00000000..f2d518f4
--- /dev/null
+++ b/lib/lvgl/env_support/rt-thread/squareline/ui/lvgl/lvgl.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-11-20 Meco Man The first version
+ */
+
+#ifdef __RTTHREAD__
+
+#include "../../../../../lvgl.h" /* back to the root folder's lvgl.h */
+
+#endif /* __RTTHREAD__ */