1 /*
2  * Copyright (c) 2018-2020 Jan Van Winkel <jan.van_winkel@dxplore.eu>
3  * Copyright (c) 2020 Teslabs Engineering S.L.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef ZEPHYR_MODULES_LVGL_LV_CONF_H_
9 #define ZEPHYR_MODULES_LVGL_LV_CONF_H_
10 
11 #include <zephyr/toolchain.h>
12 
13 /* Memory manager settings */
14 
15 #define LV_USE_STDLIB_MALLOC LV_STDLIB_CUSTOM
16 
17 #if defined(CONFIG_LV_Z_MEM_POOL_HEAP_LIB_C)
18 #define LV_STDLIB_INCLUDE "stdlib.h"
19 #define lv_malloc_core    malloc
20 #define lv_realloc_core   realloc
21 #define lv_free_core      free
22 #else
23 #define LV_STDLIB_INCLUDE "lvgl_mem.h"
24 #define lv_malloc_core    lvgl_malloc
25 #define lv_realloc_core   lvgl_realloc
26 #define lv_free_core      lvgl_free
27 #endif
28 
29 /* Misc settings */
30 #define lv_snprintf               snprintf
31 #define lv_vsnprintf              vsnprintf
32 #define LV_ASSERT_HANDLER         __ASSERT_NO_MSG(false);
33 #define LV_ASSERT_HANDLER_INCLUDE "zephyr/sys/__assert.h"
34 
35 /* Provide definition to align LVGL buffers */
36 #define LV_ATTRIBUTE_MEM_ALIGN __aligned(CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE)
37 
38 #ifdef CONFIG_LV_COLOR_16_SWAP
39 #define LV_COLOR_16_SWAP 1
40 #endif /* CONFIG_LV_COLOR_16_SWAP */
41 
42 #ifdef CONFIG_LV_Z_USE_OSAL
43 #define LV_USE_OS            LV_OS_CUSTOM
44 #define LV_OS_CUSTOM_INCLUDE "lvgl_zephyr_osal.h"
45 #endif /* CONFIG_LV_Z_USE_OSAL */
46 
47 /*
48  * Needed because of a workaround for a GCC bug,
49  * see https://github.com/lvgl/lvgl/issues/3078
50  */
51 #define LV_CONF_SUPPRESS_DEFINE_CHECK 1
52 
53 #endif /* ZEPHYR_MODULES_LVGL_LV_CONF_H_ */
54