gui: Added glue logic for LittlevGL GUI library
Added glue logic to interface Zephyr with LittlevGL GUI library This includes: * KConfig options for all lvgl options * Kernel & user space memory management * Zephyr to lvgl FS call mapping * Color space conversion function Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
This commit is contained in:
parent
49ffca4553
commit
cbfcae7a1f
21 changed files with 2201 additions and 0 deletions
|
@ -12,3 +12,4 @@ add_subdirectory_ifdef(CONFIG_POSIX_API posix)
|
||||||
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V1 cmsis_rtos_v1)
|
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V1 cmsis_rtos_v1)
|
||||||
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V2 cmsis_rtos_v2)
|
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V2 cmsis_rtos_v2)
|
||||||
add_subdirectory(rbtree)
|
add_subdirectory(rbtree)
|
||||||
|
add_subdirectory(gui)
|
||||||
|
|
|
@ -30,4 +30,7 @@ source "lib/posix/Kconfig"
|
||||||
|
|
||||||
source "lib/cmsis_rtos_v1/Kconfig"
|
source "lib/cmsis_rtos_v1/Kconfig"
|
||||||
source "lib/cmsis_rtos_v2/Kconfig"
|
source "lib/cmsis_rtos_v2/Kconfig"
|
||||||
|
|
||||||
|
source "lib/gui/Kconfig"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
1
lib/gui/CMakeLists.txt
Normal file
1
lib/gui/CMakeLists.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
add_subdirectory_if_kconfig(lvgl)
|
11
lib/gui/Kconfig
Normal file
11
lib/gui/Kconfig
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
menu "Graphical user interface"
|
||||||
|
|
||||||
|
rsource "lvgl/Kconfig"
|
||||||
|
|
||||||
|
endmenu
|
175
lib/gui/lvgl/CMakeLists.txt
Normal file
175
lib/gui/lvgl/CMakeLists.txt
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
set(lv_name lvgl)
|
||||||
|
|
||||||
|
set(ep_base ${PROJECT_BINARY_DIR}/ext_proj)
|
||||||
|
set_property(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
|
||||||
|
|
||||||
|
set(lv_SOURCE_DIR ${ep_base}/Source/${lv_name})
|
||||||
|
set(lv_SUBBUILD_DIR ${ep_base}/Subbuild/${lv_name})
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
${lv_name}
|
||||||
|
GIT_REPOSITORY https://github.com/littlevgl/lvgl.git
|
||||||
|
GIT_TAG v5.2
|
||||||
|
SOURCE_DIR ${lv_SOURCE_DIR}
|
||||||
|
BINARY_DIR ${lv_SOURCE_DIR}
|
||||||
|
SUBBUILD_DIR ${lv_SUBBUILD_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(${lv_name})
|
||||||
|
if(NOT ${lv_name}_POPULATED)
|
||||||
|
FetchContent_Populate(${lv_name})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
zephyr_interface_library_named(lvgl)
|
||||||
|
|
||||||
|
set(LVGL_SOURCE_DIR ${${lv_name}_SOURCE_DIR})
|
||||||
|
|
||||||
|
target_include_directories(lvgl INTERFACE ${LVGL_SOURCE_DIR})
|
||||||
|
target_include_directories(lvgl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
zephyr_compile_definitions(LV_CONF_INCLUDE_SIMPLE=1)
|
||||||
|
|
||||||
|
zephyr_library()
|
||||||
|
|
||||||
|
zephyr_library_sources(
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_core/lv_group.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_core/lv_indev.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_core/lv_obj.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_core/lv_refr.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_core/lv_style.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_core/lv_vdb.c
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_arc.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_img.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_label.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_line.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_rbasic.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_rect.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_triangle.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_draw/lv_draw_vbasic.c
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_hal/lv_hal_disp.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_hal/lv_hal_indev.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_hal/lv_hal_tick.c
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_anim.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_area.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_circ.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_color.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_font.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_fs.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_ll.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_log.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_math.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_mem.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_task.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_templ.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_misc/lv_txt.c
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_arc.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_bar.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_btn.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_btnm.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_calendar.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_cb.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_chart.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_cont.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_ddlist.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_gauge.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_img.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_imgbtn.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_kb.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_label.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_led.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_line.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_list.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_lmeter.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_mbox.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_objx_templ.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_page.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_preload.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_roller.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_slider.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_sw.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_ta.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_tabview.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_objx/lv_win.c
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_alien.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_default.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_material.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_mono.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_nemo.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_night.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_templ.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_themes/lv_theme_zen.c
|
||||||
|
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_builtin.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_BUILD_IN_FONT_10
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_10.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_10_cyrillic.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_10_latin_sup.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_symbol_10.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_BUILD_IN_FONT_20
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_20.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_20_cyrillic.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_20_latin_sup.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_symbol_20.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_BUILD_IN_FONT_30
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_30.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_30_cyrillic.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_30_latin_sup.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_symbol_30.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_BUILD_IN_FONT_40
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_40.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_40_cyrillic.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_dejavu_40_latin_sup.c
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_symbol_40.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_BUILD_IN_FONT_MONOSPACE
|
||||||
|
${LVGL_SOURCE_DIR}/lv_fonts/lv_font_monospace_8.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_COLOR_DEPTH_32
|
||||||
|
lvgl_color_32.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_COLOR_DEPTH_16
|
||||||
|
lvgl_color_16.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_COLOR_DEPTH_8
|
||||||
|
lvgl_color_8.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_COLOR_DEPTH_1
|
||||||
|
lvgl_color_1.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_FILESYSTEM
|
||||||
|
lvgl_fs.c
|
||||||
|
)
|
||||||
|
|
||||||
|
zephyr_library_sources(lvgl.c)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_MEM_POOL_USER lvgl_mem_user.c)
|
||||||
|
|
||||||
|
zephyr_library_sources_ifdef( CONFIG_LVGL_MEM_POOL_KERNEL lvgl_mem_kernel.c)
|
||||||
|
|
||||||
|
zephyr_library_link_libraries(lvgl)
|
||||||
|
|
||||||
|
target_link_libraries(lvgl INTERFACE zephyr_interface)
|
341
lib/gui/lvgl/Kconfig
Normal file
341
lib/gui/lvgl/Kconfig
Normal file
|
@ -0,0 +1,341 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
config LVGL
|
||||||
|
bool "LittlevGL Support"
|
||||||
|
help
|
||||||
|
This option enables the LittlevGL GUI library.
|
||||||
|
|
||||||
|
if LVGL
|
||||||
|
|
||||||
|
module = LVGL
|
||||||
|
module-str = lvgl
|
||||||
|
source "subsys/logging/Kconfig.template.log_config"
|
||||||
|
|
||||||
|
config LVGL_DISPLAY_DEV_NAME
|
||||||
|
string "Display device name"
|
||||||
|
default "DISPLAY"
|
||||||
|
help
|
||||||
|
Name of the display device to use for rendering.
|
||||||
|
|
||||||
|
config LVGL_HOR_RES
|
||||||
|
int "Horizontal Screen Resolution"
|
||||||
|
default 320
|
||||||
|
help
|
||||||
|
Horizontal screen resolution in pixels
|
||||||
|
|
||||||
|
config LVGL_VER_RES
|
||||||
|
int "Vertical Screen Resolution"
|
||||||
|
default 240
|
||||||
|
help
|
||||||
|
Vertical screen resolution in pixels
|
||||||
|
|
||||||
|
config LVGL_DPI
|
||||||
|
int "DPI"
|
||||||
|
default 100
|
||||||
|
help
|
||||||
|
Dots per inch (DPI)
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Color Depth"
|
||||||
|
default LVGL_COLOR_DEPTH_32
|
||||||
|
help
|
||||||
|
Color depth to be used by library
|
||||||
|
|
||||||
|
config LVGL_COLOR_DEPTH_32
|
||||||
|
bool "32-bit"
|
||||||
|
|
||||||
|
config LVGL_COLOR_DEPTH_16
|
||||||
|
bool "16-bit"
|
||||||
|
|
||||||
|
config LVGL_COLOR_DEPTH_8
|
||||||
|
bool "8-bit"
|
||||||
|
|
||||||
|
config LVGL_COLOR_DEPTH_1
|
||||||
|
bool "1-bit"
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config LVGL_BITS_PER_PIXEL
|
||||||
|
int "Bits per pixel"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Number of bits per pixel, in case the number of pixels should be derived
|
||||||
|
from the color depth set the number of pixels to zero.
|
||||||
|
|
||||||
|
if LVGL_COLOR_DEPTH_16
|
||||||
|
|
||||||
|
config LVGL_COLOR_16_SWAP
|
||||||
|
bool "RGB565 byte swap"
|
||||||
|
help
|
||||||
|
Swap the 2 bytes of a RGB565 pixel.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if LVGL_COLOR_DEPTH_32
|
||||||
|
|
||||||
|
config CONFIG_LVGL_COLOR_SCREEN_TRANSP
|
||||||
|
bool "Transparency support"
|
||||||
|
help
|
||||||
|
Enable screen transparency. Useful for OSD or other overlapping GUISs.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Chroma key color"
|
||||||
|
default LVGL_CHROMA_KEY_GREEN
|
||||||
|
help
|
||||||
|
Color to to use as chroma key
|
||||||
|
|
||||||
|
config LVGL_CHROMA_KEY_RED
|
||||||
|
bool "Red"
|
||||||
|
|
||||||
|
config LVGL_CHROMA_KEY_GREEN
|
||||||
|
bool "Green"
|
||||||
|
|
||||||
|
config LVGL_CHROMA_KEY_BLUE
|
||||||
|
bool "Blue"
|
||||||
|
|
||||||
|
config LVGL_CHROMA_KEY_CUSTOM
|
||||||
|
bool "Custom"
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
if LVGL_CHROMA_KEY_CUSTOM
|
||||||
|
|
||||||
|
config LVGL_CUSTOM_CHROMA_KEY_RED
|
||||||
|
hex "Chroma Key Red"
|
||||||
|
range 0x00 0xFF
|
||||||
|
default 0x00
|
||||||
|
help
|
||||||
|
Value of the color red to be used in the chroma key
|
||||||
|
|
||||||
|
config LVGL_CUSTOM_CHROMA_KEY_GREEN
|
||||||
|
hex "Chroma Key Green"
|
||||||
|
range 0x00 0xFF
|
||||||
|
default 0xFF
|
||||||
|
help
|
||||||
|
Value of the color green to be used in the chroma key
|
||||||
|
|
||||||
|
config LVGL_CUSTOM_CHROMA_KEY_BLUE
|
||||||
|
hex "Chroma Key Blue"
|
||||||
|
range 0x00 0xFF
|
||||||
|
default 0x00
|
||||||
|
help
|
||||||
|
Value of the color blue to be used in the chroma key
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Memory pool"
|
||||||
|
default LVGL_MEM_POOL_HEAP_KERNEL
|
||||||
|
help
|
||||||
|
Memory pool to use for lvgl allocated objects
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_HEAP_KERNEL
|
||||||
|
bool "Kernel Heap"
|
||||||
|
depends on HEAP_MEM_POOL_SIZE != 0
|
||||||
|
help
|
||||||
|
Use k_malloc and k_free to allocate objects on the kernel heap
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_HEAP_LIB_C
|
||||||
|
bool "C library Heap"
|
||||||
|
depends on NEWLIB_LIBC || (MINIMAL_LIBC_MALLOC_ARENA_SIZE != 0)
|
||||||
|
help
|
||||||
|
Use C library malloc and free to allocate objects on the C library heap
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_KERNEL
|
||||||
|
bool "Kernel space lvgl pool"
|
||||||
|
help
|
||||||
|
Use a dedicated memory pool in kernel space to allocate lvgl objects
|
||||||
|
on
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_USER
|
||||||
|
bool "User space lvgl pool"
|
||||||
|
help
|
||||||
|
Use a dedicated memory pool in user space to allocate lvgl objects on
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
if LVGL_MEM_POOL_KERNEL || LVGL_MEM_POOL_USER
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_MIN_SIZE
|
||||||
|
int "Minimum memory pool block size"
|
||||||
|
default 16
|
||||||
|
help
|
||||||
|
Size of the smallest block in the memory pool in bytes
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_MAX_SIZE
|
||||||
|
int "Maximum memory pool block size"
|
||||||
|
default 2048
|
||||||
|
help
|
||||||
|
Size of the largest block in the memory pool in bytes
|
||||||
|
|
||||||
|
config LVGL_MEM_POOL_NUMBER_BLOCKS
|
||||||
|
int "Number of max size blocks in memory pool"
|
||||||
|
default 1
|
||||||
|
help
|
||||||
|
Number of maximum sized blocks in the memory pool.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_VDB_SIZE
|
||||||
|
int "Virtual Display Buffer Size"
|
||||||
|
default 10
|
||||||
|
range 1 100
|
||||||
|
help
|
||||||
|
Virtual Display Buffer (double buffering) size as a percentage of
|
||||||
|
total display size.
|
||||||
|
|
||||||
|
config LVGL_VDB_STATIC
|
||||||
|
bool "Statically allocate virtual display buffer"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Statically allocate virtual display buffer. If disabled pointer should be
|
||||||
|
passed via lv_vdb_set_adr().
|
||||||
|
|
||||||
|
config LVGL_DOUBLE_VDB
|
||||||
|
bool "Use 2 Virtual Display Buffers"
|
||||||
|
help
|
||||||
|
Use 2 virtual display buffers to render and flush data in parallel
|
||||||
|
|
||||||
|
config LVGL_SCREEN_REFRESH_PERIOD
|
||||||
|
int "Screen refresh period"
|
||||||
|
default 50
|
||||||
|
help
|
||||||
|
Screen refresh period in milliseconds
|
||||||
|
|
||||||
|
config LVGL_INPUT_REFRESH_PERIOD
|
||||||
|
int "Input device refresh period"
|
||||||
|
default 50
|
||||||
|
help
|
||||||
|
Refresh period for input devices in milliseconds
|
||||||
|
|
||||||
|
config LVGL_INPUT_MARK_PRESSED_POINTS
|
||||||
|
bool "Mark pressed points"
|
||||||
|
depends on LVGL_DIRECT_DRAW
|
||||||
|
help
|
||||||
|
Mark the pressed points on the screen.
|
||||||
|
|
||||||
|
config LVGL_INPUT_DRAG_THRESHOLD
|
||||||
|
int "Drag Threshold"
|
||||||
|
default 10
|
||||||
|
help
|
||||||
|
Threshold in pixels before entering drag mode
|
||||||
|
|
||||||
|
config LVGL_INPUT_DRAG_THROW_SLOW_DOWN
|
||||||
|
int "Drag throw slow-down"
|
||||||
|
default 20
|
||||||
|
range 0 100
|
||||||
|
help
|
||||||
|
Percentage of slow down of a throw following a drag.
|
||||||
|
Greater percentage means faster slow-down.
|
||||||
|
|
||||||
|
config LVGL_INPUT_LONG_PRESS_TIME
|
||||||
|
int "Long press time"
|
||||||
|
default 400
|
||||||
|
help
|
||||||
|
Period in milliseconds before a press is seen as a long press
|
||||||
|
|
||||||
|
config LVGL_INPUT_LONG_RESS_REPEAT_TIME
|
||||||
|
int "Long press repeat time"
|
||||||
|
default 100
|
||||||
|
help
|
||||||
|
Period in milliseconds after which a new trigger is generated
|
||||||
|
for a long press
|
||||||
|
|
||||||
|
config LVGL_AVG_OBJ_COUNT
|
||||||
|
int "Average object counter"
|
||||||
|
default 32
|
||||||
|
help
|
||||||
|
Average object counter on a screen
|
||||||
|
|
||||||
|
config LVGL_UTF_8
|
||||||
|
bool "Enable UTF-8 support"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable UTF-8 support
|
||||||
|
|
||||||
|
config LVGL_TEXT_BREAK_CHARACTERS
|
||||||
|
string "Text break characters"
|
||||||
|
default " ,.;:-_"
|
||||||
|
help
|
||||||
|
Characters on which a text break can take place
|
||||||
|
|
||||||
|
config LVGL_ANTIALIAS
|
||||||
|
bool "Enable anti-aliasing"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable anti-aliasing
|
||||||
|
|
||||||
|
config LVGL_ANIMATION
|
||||||
|
bool "Enable animations"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable animations
|
||||||
|
|
||||||
|
config LVGL_SHADOW
|
||||||
|
bool "Enable shadows"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable shadows
|
||||||
|
|
||||||
|
config LVGL_GROUP
|
||||||
|
bool "Enable group support"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable group support.
|
||||||
|
Used by keyboard and button input
|
||||||
|
|
||||||
|
config LVGL_GPU
|
||||||
|
bool "Enable GPU support"
|
||||||
|
help
|
||||||
|
Enable GPU support
|
||||||
|
|
||||||
|
config LVGL_DIRECT_DRAW
|
||||||
|
bool "Enable direct draw"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable direct draw support.
|
||||||
|
Direct draw bypasses virtual display buffer and directly writes to
|
||||||
|
frame buffer
|
||||||
|
|
||||||
|
config LVGL_FILESYSTEM
|
||||||
|
bool "Enable file system"
|
||||||
|
depends on FILE_SYSTEM
|
||||||
|
default y if FILE_SYSTEM
|
||||||
|
help
|
||||||
|
Enable LittlevGL file system
|
||||||
|
|
||||||
|
config LVGL_VLA_SUPPORT
|
||||||
|
bool "Enable variable length array support"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable variable length array support
|
||||||
|
|
||||||
|
config LVGL_COMPILER_NON_CONST_INIT_SUPPORTED
|
||||||
|
bool "Enable non constant init"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Indicate if initialization with non constant values is supported
|
||||||
|
|
||||||
|
rsource "Kconfig.themes"
|
||||||
|
|
||||||
|
rsource "Kconfig.fonts"
|
||||||
|
|
||||||
|
rsource "Kconfig.objects"
|
||||||
|
|
||||||
|
config APP_LINK_WITH_LVGL
|
||||||
|
bool "Link 'app' with LVGL"
|
||||||
|
default y
|
||||||
|
depends on LVGL
|
||||||
|
help
|
||||||
|
Add LVGL header files to the 'app' include path. It may be
|
||||||
|
disabled if the include paths for LVGL are causing aliasing
|
||||||
|
issues for 'app'.
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
189
lib/gui/lvgl/Kconfig.fonts
Normal file
189
lib/gui/lvgl/Kconfig.fonts
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
menu "Fonts"
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONTS
|
||||||
|
bool "Enable build-in fonts"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable build-in font support
|
||||||
|
|
||||||
|
if LVGL_BUILD_IN_FONTS
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_10
|
||||||
|
bool "Enable build-in 10px fonts"
|
||||||
|
help
|
||||||
|
Enable build-in font support, size 10 pixels
|
||||||
|
|
||||||
|
if LVGL_BUILD_IN_FONT_10
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_10_ASCII_BPP
|
||||||
|
int "ASCII character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_10_LATIN_SUP_BPP
|
||||||
|
int "Latin supplement character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_10_CYRILLIC_BPP
|
||||||
|
int "Cyrillic character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_10_SYMBOL_BPP
|
||||||
|
int "Symbol character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_20
|
||||||
|
bool "Enable build-in 20px fonts"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable build-in font support, size 20 pixels
|
||||||
|
|
||||||
|
if LVGL_BUILD_IN_FONT_20
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_20_ASCII_BPP
|
||||||
|
int "ASCII character set BPP"
|
||||||
|
default 4
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_20_LATIN_SUP_BPP
|
||||||
|
int "Latin supplement character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_20_CYRILLIC_BPP
|
||||||
|
int "Cyrillic character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_20_SYMBOL_BPP
|
||||||
|
int "Symbol character set BPP"
|
||||||
|
default 4
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_30
|
||||||
|
bool "Enable build-in 30px fonts"
|
||||||
|
help
|
||||||
|
Enable build-in font support, size 30 pixels
|
||||||
|
|
||||||
|
if LVGL_BUILD_IN_FONT_30
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_30_ASCII_BPP
|
||||||
|
int "ASCII character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_30_LATIN_SUP_BPP
|
||||||
|
int "Latin supplement character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_30_CYRILLIC_BPP
|
||||||
|
int "Cyrillic character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_30_SYMBOL_BPP
|
||||||
|
int "Symbol character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_40
|
||||||
|
bool "Enable build-in 40px fonts"
|
||||||
|
help
|
||||||
|
Enable build-in font support, size 40 pixels
|
||||||
|
|
||||||
|
if LVGL_BUILD_IN_FONT_40
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_40_ASCII_BPP
|
||||||
|
int "ASCII character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_40_LATIN_SUP_BPP
|
||||||
|
int "Latin supplement character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_40_CYRILLIC_BPP
|
||||||
|
int "Cyrillic character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_40_SYMBOL_BPP
|
||||||
|
int "Symbol character set BPP"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Bits per pixel (1,2,4,8) for font, 0 will disable font
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_BUILD_IN_FONT_MONOSPACE
|
||||||
|
bool "Enable build-in monospace font"
|
||||||
|
help
|
||||||
|
Enable build-in monospace font support
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Default LVGL font"
|
||||||
|
default LVGL_DEFAULT_FONT_BUILD_IN_20_ASCII
|
||||||
|
|
||||||
|
config LVGL_DEFAULT_FONT_BUILD_IN_10_ASCII
|
||||||
|
bool "Build-in ASCII font 10"
|
||||||
|
depends on LVGL_BUILD_IN_FONT_10 && LVGL_BUILD_IN_FONT_10_ASCII_BPP != 0
|
||||||
|
|
||||||
|
config LVGL_DEFAULT_FONT_BUILD_IN_20_ASCII
|
||||||
|
bool "Build-in ASCII font 20"
|
||||||
|
depends on LVGL_BUILD_IN_FONT_20 && LVGL_BUILD_IN_FONT_20_ASCII_BPP != 0
|
||||||
|
|
||||||
|
config LVGL_DEFAULT_FONT_BUILD_IN_30_ASCII
|
||||||
|
bool "Build-in ASCII font 30"
|
||||||
|
depends on LVGL_BUILD_IN_FONT_30 && LVGL_BUILD_IN_FONT_30_ASCII_BPP != 0
|
||||||
|
|
||||||
|
config LVGL_DEFAULT_FONT_BUILD_IN_40_ASCII
|
||||||
|
bool "Build-in ASCII font 40"
|
||||||
|
depends on LVGL_BUILD_IN_FONT_40 && LVGL_BUILD_IN_FONT_40_ASCII_BPP != 0
|
||||||
|
|
||||||
|
config LVGL_DEFAULT_FONT_BUILD_IN_MONOSPACE
|
||||||
|
bool "Build-in monospace font"
|
||||||
|
depends on LVGL_BUILD_IN_FONT_MONOSPACE
|
||||||
|
|
||||||
|
config LVGL_DEFAULT_FONT_CUSTOM
|
||||||
|
bool "Custom font"
|
||||||
|
help
|
||||||
|
Use a none build-in font as default font. A pointer named lv_default_font_custom_ptr
|
||||||
|
should exists as a global variable and pint yo a valid font structure
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
endmenu
|
296
lib/gui/lvgl/Kconfig.objects
Normal file
296
lib/gui/lvgl/Kconfig.objects
Normal file
|
@ -0,0 +1,296 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
menu "Objects"
|
||||||
|
|
||||||
|
config LVGL_OBJ_LABEL
|
||||||
|
bool "Label Object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable label support
|
||||||
|
|
||||||
|
if LVGL_OBJ_LABEL
|
||||||
|
|
||||||
|
config LVGL_OBJ_LABEL_SCROLL_SPEED
|
||||||
|
int "Label scroll speed"
|
||||||
|
default 25
|
||||||
|
help
|
||||||
|
Scroll speed in pixels per second if scroll mode is enabled for a label
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_IMAGE
|
||||||
|
bool "Image Object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_LABEL
|
||||||
|
help
|
||||||
|
Enable image object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_IMAGE
|
||||||
|
|
||||||
|
config LVGL_IMG_CF_INDEXED
|
||||||
|
bool "Enable indexed image support"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable support for indexed images
|
||||||
|
|
||||||
|
config LVGL_IMG_CF_ALPHA
|
||||||
|
bool "Enable alpha indexed image support"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable support for alpha indexed images
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_LINE
|
||||||
|
bool "Line Object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable line object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_ARC
|
||||||
|
bool "Arc Object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable arc object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_CONTAINER
|
||||||
|
bool "Container Object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable container object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_PAGE
|
||||||
|
bool "Page object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_CONTAINER
|
||||||
|
help
|
||||||
|
Enable page object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_WINDOW
|
||||||
|
bool "Window object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_CONTAINER && LVGL_OBJ_BUTTON && LVGL_OBJ_LABEL && LVGL_OBJ_IMAGE && LVGL_OBJ_PAGE
|
||||||
|
help
|
||||||
|
Enable window object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_TAB_VIEW
|
||||||
|
bool "Tab view object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_PAGE && LVGL_OBJ_BUTTON_MATRIX
|
||||||
|
help
|
||||||
|
Enable tab view object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_TAB_VIEW
|
||||||
|
|
||||||
|
config LVGL_OBJ_TAB_VIEW_ANIMATION_TIME
|
||||||
|
int "Tab view animation time"
|
||||||
|
default 300
|
||||||
|
help
|
||||||
|
Tab view animation time in milliseconds
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_CALENDAR
|
||||||
|
bool "Calendar object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable calendar object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_PRELOAD
|
||||||
|
bool "Pre-load object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_ARC
|
||||||
|
help
|
||||||
|
Enabled pre-load object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_PRELOAD
|
||||||
|
|
||||||
|
config LVGL_OBJ_PRELOAD_DEF_ARC_LENGTH
|
||||||
|
int "Default arc length"
|
||||||
|
range 1 360
|
||||||
|
default 60
|
||||||
|
help
|
||||||
|
Default arc length for pre-load in degrees
|
||||||
|
|
||||||
|
config LVGL_OBJ_PRELOAD_DEF_SPIN_TIME
|
||||||
|
int "Default spin time"
|
||||||
|
default 1000
|
||||||
|
help
|
||||||
|
Default spin time for pre-load in ms
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_BAR
|
||||||
|
bool "Bar object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable bar object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_LINE_METER
|
||||||
|
bool "Line meter object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable line meter object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_GAUGE
|
||||||
|
bool "Gauge object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_BAR && LVGL_OBJ_LINE_METER
|
||||||
|
help
|
||||||
|
Enable gauge object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_CHART
|
||||||
|
bool "Chart object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable chart object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_LED
|
||||||
|
bool "LED object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable LED object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_MSG_BOX
|
||||||
|
bool "Message box object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_BUTTON_MATRIX && LVGL_OBJ_LABEL
|
||||||
|
help
|
||||||
|
Enable message box object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_TEXT_AREA
|
||||||
|
bool "Text area object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_LABEL && LVGL_OBJ_PAGE
|
||||||
|
help
|
||||||
|
Enable text area object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_TEXT_AREA
|
||||||
|
|
||||||
|
config LVGL_OBJ_TEXT_AREA_CURSOR_BLINK_TIME
|
||||||
|
int "Cursor Blink Time"
|
||||||
|
default 400
|
||||||
|
help
|
||||||
|
Text area cursor blink time in milliseconds
|
||||||
|
|
||||||
|
config LVGL_OBJ_TEXT_AREA_PWD_SHOW_TIME
|
||||||
|
int "Label scroll speed"
|
||||||
|
default 1500
|
||||||
|
help
|
||||||
|
Password character show time in milliseconds
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_BUTTON
|
||||||
|
bool "Button object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_CONTAINER
|
||||||
|
help
|
||||||
|
Enable button object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_BUTTON
|
||||||
|
|
||||||
|
config LVGL_OBJ_BUTTON_INK_EFFECT
|
||||||
|
bool "Enable ink effect"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable ink, press, effect for buttons
|
||||||
|
|
||||||
|
config LVGL_OBJ_IMG_BUTTON
|
||||||
|
bool "Image Button"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable image button object support
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_BUTTON_MATRIX
|
||||||
|
bool "Button Matrix object"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Enable button matrix object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_KEYBOARD
|
||||||
|
bool "Keyboard object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_BUTTON_MATRIX
|
||||||
|
help
|
||||||
|
Enable keyboard object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_CHECK_BOX
|
||||||
|
bool "Check box object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_BUTTON && LVGL_OBJ_LABEL
|
||||||
|
help
|
||||||
|
Enable check box object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_LIST
|
||||||
|
bool "List object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_BUTTON && LVGL_OBJ_LABEL && LVGL_OBJ_PAGE
|
||||||
|
help
|
||||||
|
Enable list object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_LIST
|
||||||
|
|
||||||
|
config LVGL_OBJ_LIST_FOCUS_TIME
|
||||||
|
int "List focus time"
|
||||||
|
default 100
|
||||||
|
help
|
||||||
|
List focus animation time in milliseconds
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_DROP_DOWN_LIST
|
||||||
|
bool "Drop Down List object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_LABEL && LVGL_OBJ_PAGE
|
||||||
|
help
|
||||||
|
Enable drop down list object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_DROP_DOWN_LIST
|
||||||
|
|
||||||
|
config LVGL_OBJ_DROP_DOWN_LIST_ANIM_TIME
|
||||||
|
int "Drop Down list animation time"
|
||||||
|
default 200
|
||||||
|
help
|
||||||
|
Drop down list animation time in milliseconds
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_ROLLER
|
||||||
|
bool "Roller object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_DROP_DOWN_LIST
|
||||||
|
help
|
||||||
|
Enable roller object support
|
||||||
|
|
||||||
|
if LVGL_OBJ_ROLLER
|
||||||
|
|
||||||
|
config LVGL_OBJ_ROLLER_ANIM_TIME
|
||||||
|
int "Roller animation time"
|
||||||
|
default 200
|
||||||
|
help
|
||||||
|
Roller animation time in milliseconds
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
config LVGL_OBJ_SLIDER
|
||||||
|
bool "Slider object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_BAR
|
||||||
|
help
|
||||||
|
Enable slider object support
|
||||||
|
|
||||||
|
config LVGL_OBJ_SWITCH
|
||||||
|
bool "Switch object"
|
||||||
|
default y
|
||||||
|
depends on LVGL_OBJ_SLIDER
|
||||||
|
help
|
||||||
|
Enable switch object support
|
||||||
|
|
||||||
|
endmenu
|
59
lib/gui/lvgl/Kconfig.themes
Normal file
59
lib/gui/lvgl/Kconfig.themes
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
menu "Themes"
|
||||||
|
|
||||||
|
config LVGL_THEMES
|
||||||
|
bool "Enable build-in themes"
|
||||||
|
help
|
||||||
|
Enable build-in themes
|
||||||
|
|
||||||
|
if LVGL_THEMES
|
||||||
|
|
||||||
|
config LVGL_THEME_LIVE_UPDATE
|
||||||
|
bool "Enable runtime theme switching"
|
||||||
|
help
|
||||||
|
Enable runtime theme switching, this will consume 8 to 10kB of RAM.
|
||||||
|
|
||||||
|
config LVGL_THEME_DEFAULT
|
||||||
|
bool "Enable default theme support"
|
||||||
|
help
|
||||||
|
Enable default theme support.
|
||||||
|
Low RAM footprint theme.
|
||||||
|
|
||||||
|
config LVGL_THEME_ALIEN
|
||||||
|
bool "Enable alien theme support"
|
||||||
|
help
|
||||||
|
Enable alien theme, dark futuristic, support
|
||||||
|
|
||||||
|
config LVGL_THEME_NIGHT
|
||||||
|
bool "Enable night theme support"
|
||||||
|
help
|
||||||
|
Enable night theme, dark elegant, support
|
||||||
|
|
||||||
|
config LVGL_THEME_MONO
|
||||||
|
bool "Enable mono theme support"
|
||||||
|
help
|
||||||
|
Enable mono theme, monochrome, support
|
||||||
|
|
||||||
|
config LVGL_THEME_MATERIAL
|
||||||
|
bool "Enable material theme support"
|
||||||
|
help
|
||||||
|
Enable material theme, flat theme with bold colors and light shadow, support
|
||||||
|
|
||||||
|
config LVGL_THEME_ZEN
|
||||||
|
bool "Enable zen theme support"
|
||||||
|
help
|
||||||
|
Enable zen theme, peaceful light theme, support
|
||||||
|
|
||||||
|
config LVGL_THEME_NEMO
|
||||||
|
bool "Enable nemo theme support"
|
||||||
|
help
|
||||||
|
Enable water-like theme based on the movie "Finding Nemo"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
endmenu
|
374
lib/gui/lvgl/lv_conf.h
Normal file
374
lib/gui/lvgl/lv_conf.h
Normal file
|
@ -0,0 +1,374 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_LIB_GUI_LVGL_LV_CONF_H_
|
||||||
|
#define ZEPHYR_LIB_GUI_LVGL_LV_CONF_H_
|
||||||
|
|
||||||
|
/* Dynamic memory */
|
||||||
|
|
||||||
|
#define LV_MEM_CUSTOM 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_CUSTOM_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_CUSTOM_FREE free
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define LV_MEM_CUSTOM_INCLUDE "lvgl_mem.h"
|
||||||
|
#define LV_MEM_CUSTOM_ALLOC lvgl_malloc
|
||||||
|
#define LV_MEM_CUSTOM_FREE lvgl_free
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Graphics settings */
|
||||||
|
|
||||||
|
#define LV_HOR_RES CONFIG_LVGL_HOR_RES
|
||||||
|
#define LV_VER_RES CONFIG_LVGL_VER_RES
|
||||||
|
#define LV_DPI CONFIG_LVGL_DPI
|
||||||
|
|
||||||
|
#define LV_VDB_SIZE (CONFIG_LVGL_VDB_SIZE * CONFIG_LVGL_HOR_RES \
|
||||||
|
* CONFIG_LVGL_VER_RES / 100)
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BITS_PER_PIXEL == 0
|
||||||
|
#define LV_VDB_PX_BPP LV_COLOR_SIZE
|
||||||
|
#else
|
||||||
|
#define LV_VDB_PX_BPP CONFIG_LVGL_BITS_PER_PIXEL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_VDB_STATIC
|
||||||
|
#define LV_VDB_ADR 0
|
||||||
|
#else
|
||||||
|
#define LV_VDB_ADR LV_VDB_ADR_INV
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define LV_VDB_DOUBLE CONFIG_LVGL_DOUBLE_VDB
|
||||||
|
#ifdef CONFIG_LVGL_VDB_STATIC
|
||||||
|
#define LV_VDB2_ADR 0
|
||||||
|
#else
|
||||||
|
#define LV_VDB2_ADR LV_VDB_ADR_INV
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_ANTIALIAS
|
||||||
|
#define LV_ANTIALIAS CONFIG_LVGL_ANTIALIAS
|
||||||
|
#else
|
||||||
|
#define LV_ANTIALIAS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LV_REFR_PERIOD CONFIG_LVGL_SCREEN_REFRESH_PERIOD
|
||||||
|
#define LV_INV_FIFO_SIZE CONFIG_LVGL_AVG_OBJ_COUNT
|
||||||
|
|
||||||
|
/* Miscellaneous setting */
|
||||||
|
|
||||||
|
#define LV_INDEV_READ_PERIOD CONFIG_LVGL_INPUT_REFRESH_PERIOD
|
||||||
|
#define LV_INDEV_POINT_MARKER CONFIG_LVGL_INPUT_MARK_PRESSED_POINTS
|
||||||
|
#define LV_INDEV_DRAG_LIMIT CONFIG_LVGL_INPUT_DRAG_THRESHOLD
|
||||||
|
#define LV_INDEV_DRAG_THROW CONFIG_LVGL_INPUT_DRAG_THROW_SLOW_DOWN
|
||||||
|
#define LV_INDEV_LONG_PRESS_TIME CONFIG_LVGL_INPUT_LONG_PRESS_TIME
|
||||||
|
#define LV_INDEV_LONG_PRESS_REP_TIME CONFIG_LVGL_INPUT_LONG_RESS_REPEAT_TIME
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_COLOR_DEPTH_32
|
||||||
|
#define LV_COLOR_DEPTH 32
|
||||||
|
#elif defined(CONFIG_LVGL_COLOR_DEPTH_16)
|
||||||
|
#define LV_COLOR_DEPTH 16
|
||||||
|
#elif defined(CONFIG_LVGL_COLOR_DEPTH_8)
|
||||||
|
#define LV_COLOR_DEPTH 8
|
||||||
|
#elif defined(CONFIG_LVGL_COLOR_DEPTH_1)
|
||||||
|
#define LV_COLOR_DEPTH 1
|
||||||
|
#else
|
||||||
|
#error No color depth defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LV_COLOR_16_SWAP CONFIG_LVGL_COLOR_16_SWAP
|
||||||
|
#define LV_COLOR_SCREEN_TRANSP CONFIG_LVGL_COLOR_SCREEN_TRANSP
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_CHROMA_KEY_RED
|
||||||
|
#define LV_COLOR_TRANSP LV_COLOR_RED
|
||||||
|
#elif defined(CONFIG_LVGL_CHROMA_KEY_GREEN)
|
||||||
|
#define LV_COLOR_TRANSP LV_COLOR_LIME
|
||||||
|
#elif defined(CONFIG_LVGL_CHROMA_KEY_BLUE)
|
||||||
|
#define LV_COLOR_TRANSP LV_COLOR_BLUE
|
||||||
|
#elif defined(CONFIG_LVGL_CHROMA_KEY_CUSTOM)
|
||||||
|
#define LV_COLOR_TRANSP LV_COLOR_MAKE(CONFIG_LVGL_CUSTOM_CHROMA_KEY_RED, \
|
||||||
|
CONFIG_LVGL_CUSTOM_CHROMA_KEY_GREEN, \
|
||||||
|
CONFIG_LVGL_CUSTOM_CHROMA_KEY_BLUE)
|
||||||
|
#else
|
||||||
|
#error No chroma key defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LV_TXT_UTF8 CONFIG_LVGL_UTF_8
|
||||||
|
#define LV_TXT_BREAK_CHARS CONFIG_LVGL_TEXT_BREAK_CHARACTERS
|
||||||
|
|
||||||
|
#define USE_LV_ANIMATION CONFIG_LVGL_ANIMATION
|
||||||
|
#define USE_LV_SHADOW CONFIG_LVGL_SHADOW
|
||||||
|
#define USE_LV_GROUP CONFIG_LVGL_GROUP
|
||||||
|
#define USE_LV_GPU CONFIG_LVGL_GPU
|
||||||
|
#define USE_LV_REAL_DRAW CONFIG_LVGL_DIRECT_DRAW
|
||||||
|
#define USE_LV_FILESYSTEM CONFIG_LVGL_FILESYSTEM
|
||||||
|
|
||||||
|
#define LV_ATTRIBUTE_TICK_INC
|
||||||
|
#define LV_ATTRIBUTE_TASK_HANDLER
|
||||||
|
#define LV_COMPILER_VLA_SUPPORTED CONFIG_LVGL_VLA_SUPPORT
|
||||||
|
#define LV_COMPILER_NON_CONST_INIT_SUPPORTED \
|
||||||
|
CONFIG_LVGL_COMPILER_NON_CONST_INIT_SUPPORTED
|
||||||
|
|
||||||
|
#define LV_TICK_CUSTOM 1
|
||||||
|
#define LV_TICK_CUSTOM_INCLUDE "kernel.h"
|
||||||
|
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32())
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_LOG_LEVEL == 0
|
||||||
|
#define USE_LV_LOG 0
|
||||||
|
#else
|
||||||
|
#define USE_LV_LOG 1
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_LOG_LEVEL == 1
|
||||||
|
#define LV_LOG_LEVEL LV_LOG_LEVEL_ERROR
|
||||||
|
#elif CONFIG_LVGL_LOG_LEVEL == 2
|
||||||
|
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||||
|
#elif CONFIG_LVGL_LOG_LEVEL == 3
|
||||||
|
#define LV_LOG_LEVEL LV_LOG_LEVEL_INFO
|
||||||
|
#elif CONFIG_LVGL_LOG_LEVEL == 4
|
||||||
|
#define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
|
||||||
|
#else
|
||||||
|
#error Invalid log level defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LV_LOG_PRINTF 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Theme support */
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_THEMES
|
||||||
|
|
||||||
|
#define LV_THEME_LIVE_UPDATE CONFIG_LVGL_THEME_LIVE_UPDATE
|
||||||
|
|
||||||
|
#define USE_LV_THEME_TEMPL 0
|
||||||
|
#define USE_LV_THEME_DEFAULT CONFIG_LVGL_THEME_DEFAULT
|
||||||
|
#define USE_LV_THEME_ALIEN CONFIG_LVGL_THEME_ALIEN
|
||||||
|
#define USE_LV_THEME_NIGHT CONFIG_LVGL_THEME_NIGHT
|
||||||
|
#define USE_LV_THEME_MONO CONFIG_LVGL_THEME_MONO
|
||||||
|
#define USE_LV_THEME_MATERIAL CONFIG_LVGL_THEME_MATERIAL
|
||||||
|
#define USE_LV_THEME_ZEN CONFIG_LVGL_THEME_ZEN
|
||||||
|
#define USE_LV_THEME_NEMO CONFIG_LVGL_THEME_NEMO
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define LV_THEME_LIVE_UPDATE 0
|
||||||
|
|
||||||
|
#define USE_LV_THEME_TEMPL 0
|
||||||
|
#define USE_LV_THEME_DEFAULT 0
|
||||||
|
#define USE_LV_THEME_ALIEN 0
|
||||||
|
#define USE_LV_THEME_NIGHT 0
|
||||||
|
#define USE_LV_THEME_MONO 0
|
||||||
|
#define USE_LV_THEME_MATERIAL 0
|
||||||
|
#define USE_LV_THEME_ZEN 0
|
||||||
|
#define USE_LV_THEME_NEMO 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Font support */
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_10_ASCII
|
||||||
|
#define LV_FONT_DEFAULT (&lv_font_dejavu_10)
|
||||||
|
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_20_ASCII)
|
||||||
|
#define LV_FONT_DEFAULT (&lv_font_dejavu_20)
|
||||||
|
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_30_ASCII)
|
||||||
|
#define LV_FONT_DEFAULT (&lv_font_dejavu_30)
|
||||||
|
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_40_ASCII)
|
||||||
|
#define LV_FONT_DEFAULT (&lv_font_dejavu_40)
|
||||||
|
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_MONOSPACE)
|
||||||
|
#define LV_FONT_DEFAULT (&lv_font_monospace_8)
|
||||||
|
#elif defined(CONFIG_LVGL_DEFAULT_FONT_CUSTOM)
|
||||||
|
extern void *lv_default_font_custom_ptr;
|
||||||
|
#define LV_FONT_DEFAULT ((lv_font_t *) lv_default_font_custom_ptr)
|
||||||
|
#else
|
||||||
|
#error No defulat font defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_BUILD_IN_FONT_10
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_10 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_10_ASCII_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_10_LATIN_SUP \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_10_LATIN_SUP_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_10_CYRILLIC \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_10_CYRILLIC_BPP
|
||||||
|
#define USE_LV_FONT_SYMBOL_10 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_10_SYMBOL_BPP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_10 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_10_LATIN_SUP 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_10_CYRILLIC 0
|
||||||
|
#define USE_LV_FONT_SYMBOL_10 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BUILD_IN_FONT_20
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_20 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_20_ASCII_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_20_LATIN_SUP \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_20_LATIN_SUP_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_20_CYRILLIC \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_20_CYRILLIC_BPP
|
||||||
|
#define USE_LV_FONT_SYMBOL_20 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_20_SYMBOL_BPP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_20 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_20_LATIN_SUP 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_20_CYRILLIC 0
|
||||||
|
#define USE_LV_FONT_SYMBOL_20 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BUILD_IN_FONT_30
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_30 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_30_ASCII_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_30_LATIN_SUP \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_30_LATIN_SUP_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_30_CYRILLIC \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_30_CYRILLIC_BPP
|
||||||
|
#define USE_LV_FONT_SYMBOL_30 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_30_SYMBOL_BPP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_30 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_30_LATIN_SUP 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_30_CYRILLIC 0
|
||||||
|
#define USE_LV_FONT_SYMBOL_30 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BUILD_IN_FONT_40
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_40 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_40_ASCII_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_40_LATIN_SUP \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_40_LATIN_SUP_BPP
|
||||||
|
#define USE_LV_FONT_DEJAVU_40_CYRILLIC \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_40_CYRILLIC_BPP
|
||||||
|
#define USE_LV_FONT_SYMBOL_40 \
|
||||||
|
CONFIG_LVGL_BUILD_IN_FONT_40_SYMBOL_BPP
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define USE_LV_FONT_DEJAVU_40 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_40_LATIN_SUP 0
|
||||||
|
#define USE_LV_FONT_DEJAVU_40_CYRILLIC 0
|
||||||
|
#define USE_LV_FONT_SYMBOL_40 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_FONT_MONOSPACE_8 CONFIG_LVGL_BUILD_IN_FONT_MONOSPACE
|
||||||
|
|
||||||
|
#define LV_FONT_CUSTOM_DECLARE
|
||||||
|
|
||||||
|
/* Objects */
|
||||||
|
#define LV_OBJ_FREE_NUM_TYPE uint32_t
|
||||||
|
#define LV_OBJ_FREE_PTR 1
|
||||||
|
|
||||||
|
#define USE_LV_LABEL CONFIG_LVGL_OBJ_LABEL
|
||||||
|
#if USE_LV_LABEL != 0
|
||||||
|
#define LV_LABEL_SCROLL_SPEED CONFIG_LVGL_OBJ_LABEL_SCROLL_SPEED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_IMG CONFIG_LVGL_OBJ_IMAGE
|
||||||
|
#if USE_LV_IMG != 0
|
||||||
|
#define LV_IMG_CF_INDEXED CONFIG_LVGL_IMG_CF_INDEXED
|
||||||
|
#define LV_IMG_CF_ALPHA CONFIG_LVGL_IMG_CF_ALPHA
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_LINE CONFIG_LVGL_OBJ_LINE
|
||||||
|
|
||||||
|
#define USE_LV_ARC CONFIG_LVGL_OBJ_ARC
|
||||||
|
|
||||||
|
#define USE_LV_CONT CONFIG_LVGL_OBJ_CONTAINER
|
||||||
|
|
||||||
|
#define USE_LV_PAGE CONFIG_LVGL_OBJ_PAGE
|
||||||
|
|
||||||
|
#define USE_LV_WIN CONFIG_LVGL_OBJ_WINDOW
|
||||||
|
|
||||||
|
#define USE_LV_TABVIEW CONFIG_LVGL_OBJ_TAB_VIEW
|
||||||
|
#if USE_LV_TABVIEW != 0
|
||||||
|
#define LV_TABVIEW_ANIM_TIME CONFIG_LVGL_OBJ_TAB_VIEW_ANIMATION_TIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_CALENDAR CONFIG_LVGL_OBJ_CALENDAR
|
||||||
|
|
||||||
|
#define USE_LV_PRELOAD CONFIG_LVGL_OBJ_PRELOAD
|
||||||
|
#if USE_LV_PRELOAD != 0
|
||||||
|
#define LV_PRELOAD_DEF_ARC_LENGTH CONFIG_LVGL_OBJ_PRELOAD_DEF_ARC_LENGTH
|
||||||
|
#define LV_PRELOAD_DEF_SPIN_TIME CONFIG_LVGL_OBJ_PRELOAD_DEF_SPIN_TIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_BAR CONFIG_LVGL_OBJ_BAR
|
||||||
|
|
||||||
|
#define USE_LV_LMETER CONFIG_LVGL_OBJ_LINE_METER
|
||||||
|
|
||||||
|
#define USE_LV_GAUGE CONFIG_LVGL_OBJ_GAUGE
|
||||||
|
|
||||||
|
#define USE_LV_CHART CONFIG_LVGL_OBJ_CHART
|
||||||
|
|
||||||
|
#define USE_LV_LED CONFIG_LVGL_OBJ_LED
|
||||||
|
|
||||||
|
#define USE_LV_MBOX CONFIG_LVGL_OBJ_MSG_BOX
|
||||||
|
|
||||||
|
#define USE_LV_TA CONFIG_LVGL_OBJ_TEXT_AREA
|
||||||
|
#if USE_LV_TA != 0
|
||||||
|
#define LV_TA_CURSOR_BLINK_TIME \
|
||||||
|
CONFIG_LVGL_OBJ_TEXT_AREA_CURSOR_BLINK_TIME
|
||||||
|
#define LV_TA_PWD_SHOW_TIME \
|
||||||
|
CONFIG_LVGL_OBJ_TEXT_AREA_PWD_SHOW_TIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_BTN CONFIG_LVGL_OBJ_BUTTON
|
||||||
|
|
||||||
|
#if USE_LV_BTN != 0
|
||||||
|
#define LV_BTN_INK_EFFECT CONFIG_LVGL_OBJ_BUTTON_INK_EFFECT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_IMGBTN CONFIG_LVGL_OBJ_IMG_BUTTON
|
||||||
|
|
||||||
|
#define USE_LV_BTNM CONFIG_LVGL_OBJ_BUTTON_MATRIX
|
||||||
|
|
||||||
|
#define USE_LV_KB CONFIG_LVGL_OBJ_KEYBOARD
|
||||||
|
|
||||||
|
#define USE_LV_CB CONFIG_LVGL_OBJ_CHECK_BOX
|
||||||
|
|
||||||
|
#define USE_LV_LIST CONFIG_LVGL_OBJ_LIST
|
||||||
|
#if USE_LV_LIST != 0
|
||||||
|
#define LV_LIST_FOCUS_TIME CONFIG_LVGL_OBJ_LIST_FOCUS_TIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_DDLIST CONFIG_LVGL_OBJ_DROP_DOWN_LIST
|
||||||
|
#if USE_LV_DDLIST != 0
|
||||||
|
#define LV_DDLIST_ANIM_TIME CONFIG_LVGL_OBJ_DROP_DOWN_LIST_ANIM_TIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_ROLLER CONFIG_LVGL_OBJ_ROLLER
|
||||||
|
#if USE_LV_ROLLER != 0
|
||||||
|
#define LV_ROLLER_ANIM_TIME CONFIG_LVGL_OBJ_ROLLER_ANIM_TIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USE_LV_SLIDER CONFIG_LVGL_OBJ_SLIDER
|
||||||
|
|
||||||
|
#define USE_LV_SW CONFIG_LVGL_OBJ_SWITCH
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_LIB_GUI_LVGL_LV_CONF_H_ */
|
89
lib/gui/lvgl/lvgl.c
Normal file
89
lib/gui/lvgl/lvgl.c
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <init.h>
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include <lv_core/lv_refr.h>
|
||||||
|
#include "lvgl_color.h"
|
||||||
|
#include "lvgl_fs.h"
|
||||||
|
|
||||||
|
#define LOG_LEVEL CONFIG_LVGL_LOG_LEVEL
|
||||||
|
#include <logging/log.h>
|
||||||
|
LOG_MODULE_REGISTER(lvgl);
|
||||||
|
|
||||||
|
struct device *lvgl_display_dev;
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_LOG_LEVEL != 0
|
||||||
|
static void lvgl_log(lv_log_level_t level, const char *file, uint32_t line,
|
||||||
|
const char *dsc)
|
||||||
|
{
|
||||||
|
/* Convert LVGL log level to Zephyr log lvel
|
||||||
|
*
|
||||||
|
* LVGL log level mapping:
|
||||||
|
* * LV_LOG_LEVEL_TRACE 0
|
||||||
|
* * LV_LOG_LEVEL_INFO 1
|
||||||
|
* * LV_LOG_LEVEL_WARN 2
|
||||||
|
* * LV_LOG_LEVEL_ERROR 3
|
||||||
|
* * LV_LOG_LEVEL_NUM 4
|
||||||
|
*
|
||||||
|
* Zephyr log level mapping:
|
||||||
|
* * LOG_LEVEL_NONE 0
|
||||||
|
* * LOG_LEVEL_ERR 1
|
||||||
|
* * LOG_LEVEL_WRN 2
|
||||||
|
* * LOG_LEVEL_INF 3
|
||||||
|
* * LOG_LEVEL_DBG 4
|
||||||
|
*/
|
||||||
|
u8_t zephyr_level = LOG_LEVEL_DBG - level;
|
||||||
|
|
||||||
|
ARG_UNUSED(file);
|
||||||
|
ARG_UNUSED(line);
|
||||||
|
|
||||||
|
_LOG(zephyr_level, "%s", dsc);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static int lvgl_init(struct device *dev)
|
||||||
|
{
|
||||||
|
lv_disp_drv_t disp_drv;
|
||||||
|
|
||||||
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
|
lvgl_display_dev = device_get_binding(CONFIG_LVGL_DISPLAY_DEV_NAME);
|
||||||
|
|
||||||
|
if (lvgl_display_dev == NULL) {
|
||||||
|
LOG_ERR("Display device not found.");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_LOG_LEVEL != 0
|
||||||
|
lv_log_register_print(lvgl_log);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lv_init();
|
||||||
|
|
||||||
|
#ifdef CONFIG_LVGL_FILESYSTEM
|
||||||
|
lvgl_fs_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lv_refr_set_round_cb(get_round_func());
|
||||||
|
|
||||||
|
lv_disp_drv_init(&disp_drv);
|
||||||
|
disp_drv.disp_flush = get_disp_flush();
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_VDB_SIZE != 0
|
||||||
|
disp_drv.vdb_wr = get_vdb_write();
|
||||||
|
#endif
|
||||||
|
if (lv_disp_drv_register(&disp_drv) == NULL) {
|
||||||
|
LOG_ERR("Failed to register display device.");
|
||||||
|
return -EPERM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYS_INIT(lvgl_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);
|
26
lib/gui/lvgl/lvgl_color.h
Normal file
26
lib/gui/lvgl/lvgl_color.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_LIB_GUI_LVGL_LVGL_COLOR_H_
|
||||||
|
#define ZEPHYR_LIB_GUI_LVGL_LVGL_COLOR_H_
|
||||||
|
|
||||||
|
#include <display.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern struct device *lvgl_display_dev;
|
||||||
|
|
||||||
|
void *get_disp_flush(void);
|
||||||
|
void *get_vdb_write(void);
|
||||||
|
void *get_round_func(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_LIB_GUI_LVGL_LVGL_COLOR_H */
|
100
lib/gui/lvgl/lvgl_color_1.c
Normal file
100
lib/gui/lvgl/lvgl_color_1.c
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include "lvgl_color.h"
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BITS_PER_PIXEL == 1
|
||||||
|
|
||||||
|
static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
|
||||||
|
const lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
u16_t w = x2 - x1 + 1;
|
||||||
|
u16_t h = y2 - y1 + 1;
|
||||||
|
struct display_capabilities cap;
|
||||||
|
struct display_buffer_descriptor desc;
|
||||||
|
|
||||||
|
display_get_capabilities(lvgl_display_dev, &cap);
|
||||||
|
|
||||||
|
desc.buf_size = (w * h)/8;
|
||||||
|
desc.width = w;
|
||||||
|
desc.pitch = w;
|
||||||
|
desc.height = h;
|
||||||
|
display_write(lvgl_display_dev, x1, y1, &desc, (void *) color_p);
|
||||||
|
if (cap.screen_info & SCREEN_INFO_DOUBLE_BUFFER) {
|
||||||
|
display_write(lvgl_display_dev, x1, y1, &desc,
|
||||||
|
(void *) color_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
lv_flush_ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
void zephyr_vdb_write(u8_t *buf, lv_coord_t buf_w, lv_coord_t x,
|
||||||
|
lv_coord_t y, lv_color_t color, lv_opa_t opa)
|
||||||
|
{
|
||||||
|
u8_t *buf_xy = buf + x + y/8 * buf_w;
|
||||||
|
u8_t bit;
|
||||||
|
struct display_capabilities cap;
|
||||||
|
|
||||||
|
display_get_capabilities(lvgl_display_dev, &cap);
|
||||||
|
|
||||||
|
if (cap.screen_info & SCREEN_INFO_MONO_MSB_FIRST) {
|
||||||
|
bit = 7 - y%8;
|
||||||
|
} else {
|
||||||
|
bit = y%8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cap.current_pixel_format == PIXEL_FORMAT_MONO10) {
|
||||||
|
if (color.full == 0) {
|
||||||
|
*buf_xy &= ~BIT(bit);
|
||||||
|
} else {
|
||||||
|
*buf_xy |= BIT(bit);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (color.full == 0) {
|
||||||
|
*buf_xy |= BIT(bit);
|
||||||
|
} else {
|
||||||
|
*buf_xy &= ~BIT(bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void zephyr_round_area(lv_area_t *a)
|
||||||
|
{
|
||||||
|
struct display_capabilities cap;
|
||||||
|
|
||||||
|
display_get_capabilities(lvgl_display_dev, &cap);
|
||||||
|
|
||||||
|
if (cap.screen_info & SCREEN_INFO_MONO_VTILED) {
|
||||||
|
a->y1 &= ~0x7;
|
||||||
|
a->y2 |= 0x7;
|
||||||
|
} else {
|
||||||
|
a->x1 &= ~0x7;
|
||||||
|
a->x2 |= 0x7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Unsupported pixel format conversion"
|
||||||
|
|
||||||
|
#endif /* CONFIG_LVGL_BITS_PER_PIXEL */
|
||||||
|
|
||||||
|
void *get_disp_flush(void)
|
||||||
|
{
|
||||||
|
return zephyr_disp_flush;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_vdb_write(void)
|
||||||
|
{
|
||||||
|
return zephyr_vdb_write;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_round_func(void)
|
||||||
|
{
|
||||||
|
return zephyr_round_area;
|
||||||
|
}
|
50
lib/gui/lvgl/lvgl_color_16.c
Normal file
50
lib/gui/lvgl/lvgl_color_16.c
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include "lvgl_color.h"
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BITS_PER_PIXEL == 0
|
||||||
|
|
||||||
|
static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
|
||||||
|
const lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
u16_t w = x2 - x1 + 1;
|
||||||
|
u16_t h = y2 - y1 + 1;
|
||||||
|
struct display_buffer_descriptor desc;
|
||||||
|
|
||||||
|
desc.buf_size = 2 * w * h;
|
||||||
|
desc.width = w;
|
||||||
|
desc.pitch = w;
|
||||||
|
desc.height = h;
|
||||||
|
display_write(lvgl_display_dev, x1, y1, &desc, (void *) color_p);
|
||||||
|
|
||||||
|
lv_flush_ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
#define zephyr_vdb_write NULL
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Unsupported pixel format conversion"
|
||||||
|
|
||||||
|
#endif /* CONFIG_LVGL_BITS_PER_PIXEL */
|
||||||
|
|
||||||
|
void *get_disp_flush(void)
|
||||||
|
{
|
||||||
|
return zephyr_disp_flush;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_vdb_write(void)
|
||||||
|
{
|
||||||
|
return zephyr_vdb_write;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_round_func(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
87
lib/gui/lvgl/lvgl_color_32.c
Normal file
87
lib/gui/lvgl/lvgl_color_32.c
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include "lvgl_color.h"
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BITS_PER_PIXEL == 0
|
||||||
|
|
||||||
|
static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
|
||||||
|
const lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
u16_t w = x2 - x1 + 1;
|
||||||
|
u16_t h = y2 - y1 + 1;
|
||||||
|
struct display_buffer_descriptor desc;
|
||||||
|
|
||||||
|
desc.buf_size = 4 * w * h;
|
||||||
|
desc.width = w;
|
||||||
|
desc.pitch = w;
|
||||||
|
desc.height = h;
|
||||||
|
display_write(lvgl_display_dev, x1, y1, &desc, (void *) color_p);
|
||||||
|
|
||||||
|
lv_flush_ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
#define zephyr_vdb_write NULL
|
||||||
|
|
||||||
|
#elif CONFIG_LVGL_BITS_PER_PIXEL == 24
|
||||||
|
|
||||||
|
static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
|
||||||
|
const lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
u16_t w = x2 - x1 + 1;
|
||||||
|
u16_t h = y2 - y1 + 1;
|
||||||
|
struct display_buffer_descriptor desc;
|
||||||
|
|
||||||
|
desc.buf_size = 3 * w * h;
|
||||||
|
desc.width = w;
|
||||||
|
desc.pitch = w;
|
||||||
|
desc.height = h;
|
||||||
|
display_write(lvgl_display_dev, x1, y1, &desc, (void *) color_p);
|
||||||
|
|
||||||
|
lv_flush_ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void zephyr_vdb_write(u8_t *buf, lv_coord_t buf_w, lv_coord_t x,
|
||||||
|
lv_coord_t y, lv_color_t color, lv_opa_t opa)
|
||||||
|
{
|
||||||
|
u8_t *buf_xy = buf + x + y * buf_w;
|
||||||
|
|
||||||
|
if (opa != LV_OPA_COVER) {
|
||||||
|
lv_color_t mix_color;
|
||||||
|
|
||||||
|
mix_color.red = *buf_xy;
|
||||||
|
mix_color.green = *(buf_xy+1);
|
||||||
|
mix_color.blue = *(buf_xy+2);
|
||||||
|
color = lv_color_mix(color, mix_color, opa);
|
||||||
|
}
|
||||||
|
|
||||||
|
*buf_xy = color.red;
|
||||||
|
*(buf_xy + 1) = color.green;
|
||||||
|
*(buf_xy + 2) = color.blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Unsupported pixel format conversion"
|
||||||
|
|
||||||
|
#endif /* CONFIG_LVGL_BITS_PER_PIXEL */
|
||||||
|
|
||||||
|
void *get_disp_flush(void)
|
||||||
|
{
|
||||||
|
return zephyr_disp_flush;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_vdb_write(void)
|
||||||
|
{
|
||||||
|
return zephyr_vdb_write;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_round_func(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
50
lib/gui/lvgl/lvgl_color_8.c
Normal file
50
lib/gui/lvgl/lvgl_color_8.c
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include "lvgl_color.h"
|
||||||
|
|
||||||
|
#if CONFIG_LVGL_BITS_PER_PIXEL == 0
|
||||||
|
|
||||||
|
static void zephyr_disp_flush(s32_t x1, s32_t y1, s32_t x2, s32_t y2,
|
||||||
|
const lv_color_t *color_p)
|
||||||
|
{
|
||||||
|
u16_t w = x2 - x1 + 1;
|
||||||
|
u16_t h = y2 - y1 + 1;
|
||||||
|
struct display_buffer_descriptor desc;
|
||||||
|
|
||||||
|
desc.buf_size = w * h;
|
||||||
|
desc.width = w;
|
||||||
|
desc.pitch = w;
|
||||||
|
desc.height = h;
|
||||||
|
display_write(lvgl_display_dev, x1, y1, &desc, (void *) color_p);
|
||||||
|
|
||||||
|
lv_flush_ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
#define zephyr_vdb_write NULL
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "Unsupported pixel format conversion"
|
||||||
|
|
||||||
|
#endif /* CONFIG_LVGL_BITS_PER_PIXEL */
|
||||||
|
|
||||||
|
void *get_disp_flush(void)
|
||||||
|
{
|
||||||
|
return zephyr_disp_flush;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_vdb_write(void)
|
||||||
|
{
|
||||||
|
return zephyr_vdb_write;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *get_round_func(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
243
lib/gui/lvgl/lvgl_fs.c
Normal file
243
lib/gui/lvgl/lvgl_fs.c
Normal file
|
@ -0,0 +1,243 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <lvgl.h>
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <fs.h>
|
||||||
|
|
||||||
|
/* Stub for LVGL ufs (ram based FS) init function
|
||||||
|
* as we use Zephyr FS API instead
|
||||||
|
*/
|
||||||
|
void lv_ufs_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool lvgl_fs_ready(void)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t errno_to_lv_fs_res(int err)
|
||||||
|
{
|
||||||
|
switch (err) {
|
||||||
|
case 0:
|
||||||
|
return LV_FS_RES_OK;
|
||||||
|
case -EIO:
|
||||||
|
/*Low level hardware error*/
|
||||||
|
return LV_FS_RES_HW_ERR;
|
||||||
|
case -EBADF:
|
||||||
|
/*Error in the file system structure */
|
||||||
|
return LV_FS_RES_FS_ERR;
|
||||||
|
case -ENOENT:
|
||||||
|
/*Driver, file or directory is not exists*/
|
||||||
|
return LV_FS_RES_NOT_EX;
|
||||||
|
case -EFBIG:
|
||||||
|
/*Disk full*/
|
||||||
|
return LV_FS_RES_FULL;
|
||||||
|
case -EACCES:
|
||||||
|
/*Access denied. Check 'fs_open' modes and write protect*/
|
||||||
|
return LV_FS_RES_DENIED;
|
||||||
|
case -EBUSY:
|
||||||
|
/*The file system now can't handle it, try later*/
|
||||||
|
return LV_FS_RES_BUSY;
|
||||||
|
case -ENOMEM:
|
||||||
|
/*Not enough memory for an internal operation*/
|
||||||
|
return LV_FS_RES_OUT_OF_MEM;
|
||||||
|
case -EINVAL:
|
||||||
|
/*Invalid parameter among arguments*/
|
||||||
|
return LV_FS_RES_INV_PARAM;
|
||||||
|
default:
|
||||||
|
return LV_FS_RES_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_open(void *file, const char *path,
|
||||||
|
lv_fs_mode_t mode)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_open((struct fs_file_t *)file, path);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_close(void *file)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_close((struct fs_file_t *)file);
|
||||||
|
return LV_FS_RES_NOT_IMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_remove(const char *path)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_unlink(path);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_read(void *file, void *buf, u32_t btr,
|
||||||
|
u32_t *br)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_read((struct fs_file_t *)file, buf, btr);
|
||||||
|
if (err > 0) {
|
||||||
|
if (br != NULL) {
|
||||||
|
*br = err;
|
||||||
|
}
|
||||||
|
err = 0;
|
||||||
|
} else if (br != NULL) {
|
||||||
|
*br = 0;
|
||||||
|
}
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_write(void *file, const void *buf, u32_t btw,
|
||||||
|
u32_t *bw)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_write((struct fs_file_t *)file, buf, btw);
|
||||||
|
if (err == btw) {
|
||||||
|
if (bw != NULL) {
|
||||||
|
*bw = btw;
|
||||||
|
}
|
||||||
|
err = 0;
|
||||||
|
} else if (err < 0) {
|
||||||
|
if (bw != NULL) {
|
||||||
|
*bw = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bw != NULL) {
|
||||||
|
*bw = err;
|
||||||
|
}
|
||||||
|
err = -EFBIG;
|
||||||
|
}
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_seek(void *file, u32_t pos)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_seek((struct fs_file_t *)file, pos, FS_SEEK_SET);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_tell(void *file, u32_t *pos_p)
|
||||||
|
{
|
||||||
|
*pos_p = fs_tell((struct fs_file_t *)file);
|
||||||
|
return LV_FS_RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_trunc(void *file)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
off_t length;
|
||||||
|
|
||||||
|
length = fs_tell((struct fs_file_t *) file);
|
||||||
|
++length;
|
||||||
|
err = fs_truncate((struct fs_file_t *)file, length);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_size(void *file, u32_t *fsize)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
off_t org_pos;
|
||||||
|
|
||||||
|
/* LVGL does not provided path but pointer to file struct as such
|
||||||
|
* we can not use fs_stat, instead use a combination of fs_tell and
|
||||||
|
* fs_seek to get the files size.
|
||||||
|
*/
|
||||||
|
|
||||||
|
org_pos = fs_tell((struct fs_file_t *) file);
|
||||||
|
|
||||||
|
err = fs_seek((struct fs_file_t *) file, 0, FS_SEEK_END);
|
||||||
|
if (err != 0) {
|
||||||
|
*fsize = 0;
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
*fsize = fs_tell((struct fs_file_t *) file) + 1;
|
||||||
|
|
||||||
|
err = fs_seek((struct fs_file_t *) file, org_pos, FS_SEEK_SET);
|
||||||
|
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_rename(const char *from, const char *to)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_rename(from, to);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_free(u32_t *total_p, u32_t *free_p)
|
||||||
|
{
|
||||||
|
/* We have no easy way of telling the total file system size.
|
||||||
|
* Zephyr can only return this information per mount point.
|
||||||
|
*/
|
||||||
|
return LV_FS_RES_NOT_IMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_dir_open(void *dir, const char *path)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_opendir((struct fs_dir_t *)dir, path);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_dir_read(void *dir, char *fn)
|
||||||
|
{
|
||||||
|
/* LVGL expects a string as return parameter but the format of the
|
||||||
|
* string is not documented.
|
||||||
|
*/
|
||||||
|
return LV_FS_RES_NOT_IMP;
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_fs_res_t lvgl_fs_dir_close(void *dir)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = fs_closedir((struct fs_dir_t *)dir);
|
||||||
|
return errno_to_lv_fs_res(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void lvgl_fs_init(void)
|
||||||
|
{
|
||||||
|
lv_fs_drv_t fs_drv;
|
||||||
|
|
||||||
|
memset(&fs_drv, 0, sizeof(lv_fs_drv_t));
|
||||||
|
|
||||||
|
fs_drv.file_size = sizeof(struct fs_file_t);
|
||||||
|
fs_drv.rddir_size = sizeof(struct fs_dir_t);
|
||||||
|
fs_drv.letter = '/';
|
||||||
|
fs_drv.ready = lvgl_fs_ready;
|
||||||
|
|
||||||
|
fs_drv.open = lvgl_fs_open;
|
||||||
|
fs_drv.close = lvgl_fs_close;
|
||||||
|
fs_drv.remove = lvgl_fs_remove;
|
||||||
|
fs_drv.read = lvgl_fs_read;
|
||||||
|
fs_drv.write = lvgl_fs_write;
|
||||||
|
fs_drv.seek = lvgl_fs_seek;
|
||||||
|
fs_drv.tell = lvgl_fs_tell;
|
||||||
|
fs_drv.trunc = lvgl_fs_trunc;
|
||||||
|
fs_drv.size = lvgl_fs_size;
|
||||||
|
fs_drv.rename = lvgl_fs_rename;
|
||||||
|
fs_drv.free = lvgl_fs_free;
|
||||||
|
|
||||||
|
fs_drv.dir_open = lvgl_fs_dir_open;
|
||||||
|
fs_drv.dir_read = lvgl_fs_dir_read;
|
||||||
|
fs_drv.dir_close = lvgl_fs_dir_close;
|
||||||
|
|
||||||
|
lv_fs_add_drv(&fs_drv);
|
||||||
|
}
|
||||||
|
|
20
lib/gui/lvgl/lvgl_fs.h
Normal file
20
lib/gui/lvgl/lvgl_fs.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_LIB_GUI_LVGL_LVGL_FS_H_
|
||||||
|
#define ZEPHYR_LIB_GUI_LVGL_LVGL_FS_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void lvgl_fs_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_LIB_GUI_LVGL_LVGL_FS_H */
|
24
lib/gui/lvgl/lvgl_mem.h
Normal file
24
lib/gui/lvgl/lvgl_mem.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_LIB_GUI_LVGL_MEM_H_
|
||||||
|
#define ZEPHYR_LIB_GUI_LVGL_MEM_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void *lvgl_malloc(size_t size);
|
||||||
|
|
||||||
|
void lvgl_free(void *ptr);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_LIB_GUI_LVGL_MEM_H_i */
|
25
lib/gui/lvgl/lvgl_mem_kernel.c
Normal file
25
lib/gui/lvgl/lvgl_mem_kernel.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lvgl_mem.h"
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <init.h>
|
||||||
|
#include <misc/mempool.h>
|
||||||
|
|
||||||
|
K_MEM_POOL_DEFINE(lvgl_mem_pool,
|
||||||
|
CONFIG_LVGL_MEM_POOL_MIN_SIZE,
|
||||||
|
CONFIG_LVGL_MEM_POOL_MAX_SIZE,
|
||||||
|
CONFIG_LVGL_MEM_POOL_NUMBER_BLOCKS, 4);
|
||||||
|
|
||||||
|
void *lvgl_malloc(size_t size)
|
||||||
|
{
|
||||||
|
return k_mem_pool_malloc(&lvgl_mem_pool, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lvgl_free(void *ptr)
|
||||||
|
{
|
||||||
|
k_free(ptr);
|
||||||
|
}
|
37
lib/gui/lvgl/lvgl_mem_user.c
Normal file
37
lib/gui/lvgl/lvgl_mem_user.c
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lvgl_mem.h"
|
||||||
|
#include <zephyr.h>
|
||||||
|
#include <init.h>
|
||||||
|
#include <misc/mempool.h>
|
||||||
|
|
||||||
|
K_MUTEX_DEFINE(lvgl_mem_pool_mutex);
|
||||||
|
SYS_MEM_POOL_DEFINE(lvgl_mem_pool, &lvgl_mem_pool_mutex,
|
||||||
|
CONFIG_LVGL_MEM_POOL_MIN_SIZE,
|
||||||
|
CONFIG_LVGL_MEM_POOL_MAX_SIZE,
|
||||||
|
CONFIG_LVGL_MEM_POOL_NUMBER_BLOCKS, 4, .data);
|
||||||
|
|
||||||
|
void *lvgl_malloc(size_t size)
|
||||||
|
{
|
||||||
|
return sys_mem_pool_alloc(&lvgl_mem_pool, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lvgl_free(void *ptr)
|
||||||
|
{
|
||||||
|
sys_mem_pool_free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lvgl_mem_pool_init(struct device *unused)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_USERSPACE
|
||||||
|
k_object_access_all_grant(&lvgl_mem_pool_mutex);
|
||||||
|
#endif
|
||||||
|
sys_mem_pool_init(&lvgl_mem_pool);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SYS_INIT(lvgl_mem_pool_init, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
Loading…
Add table
Add a link
Reference in a new issue