diff --git a/CHANGELOG.md b/CHANGELOG.md index cbf6cd671..762e870dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - feat(chart) add lv_chart_remove_series and lv_chart_hide_series - feat(img_cahce) allow disabling image cacheing - calendar: make get_day_of_week() public +- Added support for Zephyr integration ### Bugfixes - fix(draw_rect) free buffer used for arabic processing diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f9caf709..4f9d82570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,33 @@ if (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM) target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR") endif() +elseif(ZEPHYR_BASE) + +if(CONFIG_LVGL) + +zephyr_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl) + +target_include_directories(lvgl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +zephyr_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE=) + +zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM + LV_MEM_CUSTOM_ALLOC=${CONFIG_LV_MEM_CUSTOM_ALLOC} + ) +zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM + LV_MEM_CUSTOM_FREE=${CONFIG_LV_MEM_CUSTOM_FREE} + ) +zephyr_compile_definitions_ifdef(CONFIG_LV_TICK_CUSTOM + LV_TICK_CUSTOM_SYS_TIME_EXPR=${CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR} + ) + +zephyr_library() + +file(GLOB_RECURSE SOURCES src/*.c) +zephyr_library_sources(${SOURCES}) + +endif() # CONFIG_LVGL + else() message(FATAL_ERROR "Unknown platform.") endif() diff --git a/src/lv_conf_zephyr.h b/src/lv_conf_zephyr.h deleted file mode 100644 index e4e338f2b..000000000 --- a/src/lv_conf_zephyr.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2020 Jan Van Winkel - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifdef __ZEPHYR__ - - #include - - #define LV_MEM_CUSTOM 1 - - #define LV_MEMCPY_MEMSET_STD 1 - - #ifdef CONFIG_LVGL_MEM_POOL_HEAP_KERNEL - - #define LV_MEM_CUSTOM_INCLUDE "kernel.h" - #define LV_MEM_CUSTOM_ALLOC k_malloc - #define LV_MEM_CUTOM_FREE k_free - - #elif defined(CONFIG_LVGL_MEM_POOL_HEAP_LIB_C) - - #define LV_MEM_CUSTOM_INCLUDE "stdlib.h" - #define LV_MEM_CUSTOM_ALLOC malloc - #define LV_MEM_CUTOM_FREE free - - #else - - #define LV_MEM_CUSTOM_INCLUDE "lvgl_mem.h" - #define LV_MEM_CUSTOM_ALLOC lvgl_malloc - #define LV_MEM_CUTOM_FREE lvgl_free - - #endif - - #define LV_ENABLE_GC 0 - - #define LV_TICK_CUSTOM 1 - #define LV_TICK_CUSTOM_INCLUDE "kernel.h" - #define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32()) - - #define LV_SPRINTF_CUSTOM 1 - - #if LV_SPRINTF_CUSTOM - #define LV_SPRINTF_INCLUDE "stdio.h" - #define lv_snprintf snprintf - #define lv_vsnprintf vsnprintf - #endif - -#endif diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 000000000..eb317c3ce --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,2 @@ +build: + cmake: .