1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2021-10-15     Meco Man     The first version
9  */
10 
11 #ifndef LV_RT_THREAD_CONF_H
12 #define LV_RT_THREAD_CONF_H
13 
14 #ifdef __RTTHREAD__
15 
16 #define LV_RTTHREAD_INCLUDE <rtthread.h>
17 #include LV_RTTHREAD_INCLUDE
18 
19 /*=========================
20    MEMORY SETTINGS
21  *=========================*/
22 
23 #ifdef RT_USING_HEAP
24 #  define LV_MEM_CUSTOM 1
25 #  define LV_MEM_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
26 #  define LV_MEM_CUSTOM_ALLOC   rt_malloc
27 #  define LV_MEM_CUSTOM_FREE    rt_free
28 #  define LV_MEM_CUSTOM_REALLOC rt_realloc
29 #endif
30 
31 /*====================
32    HAL SETTINGS
33  *====================*/
34 
35 #define LV_TICK_CUSTOM 1
36 #define LV_TICK_CUSTOM_INCLUDE LV_RTTHREAD_INCLUDE
37 #define LV_TICK_CUSTOM_SYS_TIME_EXPR (rt_tick_get_millisecond())    /*Expression evaluating to current system time in ms*/
38 
39 #ifdef PKG_LVGL_DISP_REFR_PERIOD
40 #define LV_DISP_DEF_REFR_PERIOD   PKG_LVGL_DISP_REFR_PERIOD
41 #endif
42 
43 /*=======================
44  * FEATURE CONFIGURATION
45  *=======================*/
46 
47 /*-------------
48  * Asserts
49  *-----------*/
50 
51 #define LV_ASSERT_HANDLER_INCLUDE LV_RTTHREAD_INCLUDE
52 #define LV_ASSERT_HANDLER RT_ASSERT(0);
53 
54 /*-------------
55  * Others
56  *-----------*/
57 
58 #define LV_SPRINTF_CUSTOM 1
59 #define LV_SPRINTF_INCLUDE LV_RTTHREAD_INCLUDE
60 #define lv_snprintf  rt_snprintf
61 #define lv_vsnprintf rt_vsnprintf
62 #define LV_SPRINTF_USE_FLOAT 0
63 
64 /*=====================
65  *  COMPILER SETTINGS
66  *====================*/
67 
68 #ifdef ARCH_CPU_BIG_ENDIAN
69 #  define LV_BIG_ENDIAN_SYSTEM 1
70 #else
71 #  define LV_BIG_ENDIAN_SYSTEM 0
72 #endif
73 
74 #ifdef rt_align /* >= RT-Thread v5.0.0 */
75 #  define LV_ATTRIBUTE_MEM_ALIGN rt_align(RT_ALIGN_SIZE)
76 #else
77 #  define LV_ATTRIBUTE_MEM_ALIGN ALIGN(RT_ALIGN_SIZE)
78 #endif
79 
80 /*==================
81 * EXAMPLES
82 *==================*/
83 
84 #ifdef PKG_LVGL_USING_EXAMPLES
85 #  define LV_BUILD_EXAMPLES 1
86 #endif
87 
88 /*--END OF LV_RT_THREAD_CONF_H--*/
89 
90 #endif /*__RTTHREAD__*/
91 
92 #endif /*LV_CONF_H*/
93