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 #include <string.h>
13 #include <stdint.h>
14 
15 /* Memory manager settings */
16 
17 #define LV_USE_STDLIB_MALLOC  LV_STDLIB_CUSTOM
18 #define LV_USE_STDLIB_STRING  LV_STDLIB_CLIB
19 #define LV_USE_STDLIB_SPRINTF LV_STDLIB_CLIB
20 
21 #if defined(CONFIG_LV_Z_MEM_POOL_HEAP_LIB_C)
22 #define LV_STDLIB_INCLUDE "stdlib.h"
23 #define lv_malloc_core    malloc
24 #define lv_realloc_core   realloc
25 #define lv_free_core      free
26 #else
27 #define LV_STDLIB_INCLUDE "lvgl_mem.h"
28 #define lv_malloc_core    lvgl_malloc
29 #define lv_realloc_core   lvgl_realloc
30 #define lv_free_core      lvgl_free
31 #endif
32 
33 #define LV_ASSERT_HANDLER         __ASSERT_NO_MSG(false);
34 #define LV_ASSERT_HANDLER_INCLUDE "zephyr/sys/__assert.h"
35 
36 /* Provide definition to align LVGL buffers */
37 #define LV_ATTRIBUTE_MEM_ALIGN __aligned(CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE)
38 
39 #ifdef CONFIG_LV_COLOR_16_SWAP
40 #define LV_COLOR_16_SWAP 1
41 #endif /* CONFIG_LV_COLOR_16_SWAP */
42 
43 #ifdef CONFIG_LV_Z_USE_OSAL
44 #define LV_USE_OS            LV_OS_CUSTOM
45 #define LV_OS_CUSTOM_INCLUDE "lvgl_zephyr_osal.h"
46 #endif /* CONFIG_LV_Z_USE_OSAL */
47 
48 /*
49  * Needed because of a workaround for a GCC bug,
50  * see https://github.com/lvgl/lvgl/issues/3078
51  */
52 #define LV_CONF_SUPPRESS_DEFINE_CHECK 1
53 
54 #endif /* ZEPHYR_MODULES_LVGL_LV_CONF_H_ */
55