-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
414 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Zephyr base project for the LVGL project creator | ||
|
||
This repository is used along with LGVL project creator to | ||
help user to quick setup a Zephyr RTOS application that uses | ||
LVGL on top of the Zephyr Display subsystem. | ||
|
||
## Why this is needed? | ||
|
||
Zephyr RTOS already has the LVGL samples but they are | ||
located inside of the Zephyr kernel source tree, and in general | ||
the applications are intended to be out from it, the project | ||
creator helps users with that. | ||
|
||
## How to use it: | ||
|
||
* Before use the project creator make sure you have zephyr installed on the current folder; | ||
* After that launch the project creator; | ||
* After the creation just build the application as regular Zephyr project using `west build`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
# Copyright (c) 2023 Fabian Blatz <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(lvgl_sample) | ||
|
||
set(LVGL_DIR ${ZEPHYR_LVGL_MODULE_DIR}) | ||
|
||
FILE(GLOB app_sources src/*.c) | ||
target_sources(app PRIVATE ${app_sources}) | ||
|
||
target_include_directories(app PRIVATE | ||
${LVGL_DIR}/demos/ | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_MUSIC app PRIVATE | ||
${LVGL_DIR}/demos/music/lv_demo_music_list.c | ||
${LVGL_DIR}/demos/music/lv_demo_music.c | ||
${LVGL_DIR}/demos/music/lv_demo_music_main.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_next.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_wave_top_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_4_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_4.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_corner_right.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_cover_1.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_slider_knob_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_3.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_pause.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_pause_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_wave_bottom_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_2_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_list_play_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_wave_top.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_play_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_cover_1_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_wave_bottom.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_corner_left_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_play.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_list_border.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_2.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_next_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_list_play.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_list_border_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_rnd.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_cover_3.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_prev_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_loop.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_1.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_slider_knob.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_corner_right_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_corner_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_corner_left.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_cover_2_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_3_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_icon_1_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_cover_2.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_prev.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_rnd_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_list_pause_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_cover_3_large.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_list_pause.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_logo.c | ||
${LVGL_DIR}/demos/music/assets/img_lv_demo_music_btn_loop_large.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_BENCHMARK app PRIVATE | ||
${LVGL_DIR}/demos/benchmark/assets/img_benchmark_avatar.c | ||
${LVGL_DIR}/demos/benchmark/assets/img_benchmark_lvgl_logo_argb.c | ||
${LVGL_DIR}/demos/benchmark/assets/img_benchmark_lvgl_logo_rgb.c | ||
${LVGL_DIR}/demos/benchmark/assets/lv_font_benchmark_montserrat_12_compr_az.c.c | ||
${LVGL_DIR}/demos/benchmark/assets/lv_font_benchmark_montserrat_16_compr_az.c.c | ||
${LVGL_DIR}/demos/benchmark/assets/lv_font_benchmark_montserrat_28_compr_az.c.c | ||
${LVGL_DIR}/demos/benchmark/lv_demo_benchmark.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_STRESS app PRIVATE | ||
${LVGL_DIR}/demos/stress/lv_demo_stress.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_WIDGETS app PRIVATE | ||
${LVGL_DIR}/demos/widgets/assets/img_clothes.c | ||
${LVGL_DIR}/demos/widgets/assets/img_demo_widgets_avatar.c | ||
${LVGL_DIR}/demos/widgets/assets/img_demo_widgets_needle.c | ||
${LVGL_DIR}/demos/widgets/assets/img_lvgl_logo.c | ||
${LVGL_DIR}/demos/widgets/lv_demo_widgets.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_FLEX_LAYOUT app PRIVATE | ||
${LVGL_DIR}/demos/flex_layout/lv_demo_flex_layout_main.c | ||
${LVGL_DIR}/demos/flex_layout/lv_demo_flex_layout_view.c | ||
${LVGL_DIR}/demos/flex_layout/lv_demo_flex_layout_flex_loader.c | ||
${LVGL_DIR}/demos/flex_layout/lv_demo_flex_layout_view_child_node.c | ||
${LVGL_DIR}/demos/flex_layout/lv_demo_flex_layout_view_ctrl_pad.c | ||
${LVGL_DIR}/demos/flex_layout/lv_demo_flex_layout_ctrl_pad.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER app PRIVATE | ||
${LVGL_DIR}/demos/keypad_encoder/lv_demo_keypad_encoder.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_RENDER app PRIVATE | ||
${LVGL_DIR}/demos/render/assets/img_render_arc_bg.c | ||
${LVGL_DIR}/demos/render/assets/img_render_lvgl_logo_argb8888.c | ||
${LVGL_DIR}/demos/render/assets/img_render_lvgl_logo_i1.c | ||
${LVGL_DIR}/demos/render/assets/img_render_lvgl_logo_l8.c | ||
${LVGL_DIR}/demos/render/assets/img_render_lvgl_logo_rgb565.c | ||
${LVGL_DIR}/demos/render/assets/img_render_lvgl_logo_rgb888.c | ||
${LVGL_DIR}/demos/render/assets/img_render_lvgl_logo_xrgb8888.c | ||
${LVGL_DIR}/demos/render/lv_demo_render.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_SCROLL app PRIVATE | ||
${LVGL_DIR}/demos/scroll/lv_demo_scroll.c | ||
) | ||
|
||
target_sources_ifdef(CONFIG_LV_USE_DEMO_MULTILANG app PRIVATE | ||
${LVGL_DIR}/demos/multilang/assets/img_multilang_like.c | ||
${LVGL_DIR}/demos/multilang/assets/fonts/font_multilang_large.c | ||
${LVGL_DIR}/demos/multilang/assets/fonts/font_multilang_small.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_movie_camera.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_flexed_biceps.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_rocket.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_artist_palette.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_deciduous_tree.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_cat_face.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_red_heart.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_camera_with_flash.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_dog_face.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_books.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_earth_globe_europe_africa.c | ||
${LVGL_DIR}/demos/multilang/assets/emojis/img_emoji_soccer_ball.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_19.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_4.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_8.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_5.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_16.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_22.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_9.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_6.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_18.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_17.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_13.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_2.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_3.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_25.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_14.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_1.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_11.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_7.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_15.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_12.c | ||
${LVGL_DIR}/demos/multilang/assets/avatars/img_multilang_avatar_10.c | ||
${LVGL_DIR}/demos/multilang/lv_demo_multilang.c | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Copyright (c) 2023 Fabian Blatz <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
choice LV_Z_DEMO | ||
prompt "LVGL demo to build" | ||
default LV_Z_DEMO_MUSIC | ||
help | ||
Demo application to build. | ||
|
||
config LV_Z_DEMO_MUSIC | ||
bool "LVGL music demo" | ||
select LV_USE_DEMO_MUSIC | ||
help | ||
Build music player demo application. | ||
|
||
config LV_Z_DEMO_BENCHMARK | ||
bool "LVGL benchmark demo" | ||
select LV_USE_DEMO_BENCHMARK | ||
select LV_USE_DEMO_WIDGETS | ||
help | ||
Build benchmarking demo application. | ||
|
||
config LV_Z_DEMO_STRESS | ||
bool "LVGL stress demo" | ||
select LV_USE_DEMO_STRESS | ||
help | ||
Build stress testing demo application. | ||
|
||
config LV_Z_DEMO_WIDGETS | ||
bool "LVGL widgets demo" | ||
select LV_USE_DEMO_WIDGETS | ||
help | ||
Build widgets demo application. | ||
|
||
config LV_Z_DEMO_FLEX_LAYOUT | ||
bool "LVGL flex layout demo" | ||
select LV_USE_DEMO_FLEX_LAYOUT | ||
help | ||
Build flex layout demo application. | ||
|
||
config LV_Z_DEMO_KEYPAD_AND_ENCODER | ||
bool "LVGL keypad and encoder demo" | ||
select LV_USE_DEMO_KEYPAD_AND_ENCODER | ||
help | ||
Build keypad and encoder demo application. | ||
|
||
config LV_Z_DEMO_RENDER | ||
bool "LVGL render demo" | ||
select LV_USE_DEMO_RENDER | ||
help | ||
Build render demo application. | ||
|
||
config LV_Z_DEMO_SCROLL | ||
bool "LVGL scroll demo" | ||
select LV_USE_DEMO_SCROLL | ||
help | ||
Build scroll demo application. | ||
|
||
config LV_Z_DEMO_MULTILANG | ||
bool "LVGL multilang demo" | ||
select LV_USE_DEMO_MULTILANG | ||
select LV_USE_IMGFONT | ||
help | ||
Build multilang demo application. | ||
|
||
endchoice | ||
|
||
config LV_Z_DEMO_RENDER_SCENE_DYNAMIC | ||
bool "Switch scenes dynamically" | ||
help | ||
Switch between scenes to render dynamically. | ||
|
||
config LV_Z_DEMO_RENDER_SCENE_INDEX | ||
int "Index of the rendered scene" | ||
depends on !LV_Z_DEMO_RENDER_SCENE_DYNAMIC | ||
default 0 | ||
range 0 11 | ||
help | ||
Render scene by its index (refer to lv_demo_render.h) | ||
|
||
config LV_Z_DEMO_RENDER_DYNAMIC_SCENE_TIMEOUT | ||
int "Seconds each rendered scene is shown" | ||
depends on LV_Z_DEMO_RENDER_SCENE_DYNAMIC | ||
default 3 | ||
help | ||
Seconds each rendered scenar is shown | ||
|
||
source "Kconfig.zephyr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright 2023 NXP | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Enable PXP DMA engine and set rotation angle to 0 degrees. | ||
# This allows us to verify the DMA driver functions without altering | ||
# the output image | ||
CONFIG_DMA=y | ||
CONFIG_MCUX_ELCDIF_PXP=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
CONFIG_MAIN_STACK_SIZE=4096 | ||
CONFIG_LOG=y | ||
CONFIG_SHELL=y | ||
|
||
CONFIG_LVGL=y | ||
CONFIG_LV_Z_MEM_POOL_SIZE=49152 | ||
CONFIG_LV_Z_SHELL=y | ||
CONFIG_LV_USE_MONKEY=y | ||
|
||
CONFIG_DISPLAY=y | ||
CONFIG_INPUT=y | ||
|
||
CONFIG_LV_FONT_MONTSERRAT_12=y | ||
CONFIG_LV_FONT_MONTSERRAT_14=y | ||
CONFIG_LV_FONT_MONTSERRAT_16=y | ||
CONFIG_LV_FONT_MONTSERRAT_18=y | ||
CONFIG_LV_FONT_MONTSERRAT_24=y | ||
|
||
# Benchmark Demo | ||
CONFIG_LV_USE_FONT_COMPRESSED=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2023 Fabian Blatz <[email protected]> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/drivers/display.h> | ||
#include <lvgl.h> | ||
#include <lvgl_mem.h> | ||
#include <lv_demos.h> | ||
#include <stdio.h> | ||
|
||
#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL | ||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_REGISTER(app); | ||
|
||
int main(void) | ||
{ | ||
const struct device *display_dev; | ||
#ifdef CONFIG_LV_Z_DEMO_RENDER_SCENE_DYNAMIC | ||
k_timepoint_t next_scene_switch; | ||
lv_demo_render_scene_t cur_scene = LV_DEMO_RENDER_SCENE_FILL; | ||
#endif /* CONFIG_LV_Z_DEMO_RENDER_SCENE_DYNAMIC */ | ||
|
||
display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display)); | ||
if (!device_is_ready(display_dev)) { | ||
LOG_ERR("Device not ready, aborting test"); | ||
return 0; | ||
} | ||
|
||
#if defined(CONFIG_LV_Z_DEMO_MUSIC) | ||
lv_demo_music(); | ||
#elif defined(CONFIG_LV_Z_DEMO_BENCHMARK) | ||
lv_demo_benchmark(); | ||
#elif defined(CONFIG_LV_Z_DEMO_STRESS) | ||
lv_demo_stress(); | ||
#elif defined(CONFIG_LV_Z_DEMO_WIDGETS) | ||
lv_demo_widgets(); | ||
#elif defined(CONFIG_LV_Z_DEMO_FLEX_LAYOUT) | ||
lv_demo_flex_layout(); | ||
#elif defined(CONFIG_LV_Z_DEMO_KEYPAD_AND_ENCODER) | ||
lv_demo_keypad_encoder(); | ||
#elif defined(CONFIG_LV_Z_DEMO_RENDER) | ||
|
||
#ifdef CONFIG_LV_Z_DEMO_RENDER_SCENE_DYNAMIC | ||
lv_demo_render(cur_scene, 255); | ||
next_scene_switch = | ||
sys_timepoint_calc(K_SECONDS(CONFIG_LV_Z_DEMO_RENDER_DYNAMIC_SCENE_TIMEOUT)); | ||
#else | ||
lv_demo_render(CONFIG_LV_Z_DEMO_RENDER_SCENE_INDEX, 255); | ||
#endif /* CONFIG_LV_Z_DEMO_RENDER_SCENE_DYNAMIC */ | ||
|
||
#elif defined(CONFIG_LV_Z_DEMO_SCROLL) | ||
lv_demo_scroll(); | ||
#elif defined(CONFIG_LV_Z_DEMO_MULTILANG) | ||
lv_demo_multilang(); | ||
#else | ||
#error Enable one of the demos CONFIG_LV_Z_DEMO_* | ||
#endif | ||
|
||
lv_timer_handler(); | ||
display_blanking_off(display_dev); | ||
#ifdef CONFIG_LV_Z_MEM_POOL_SYS_HEAP | ||
lvgl_print_heap_info(false); | ||
#else | ||
printf("lvgl in malloc mode\n"); | ||
#endif | ||
while (1) { | ||
uint32_t sleep_ms = lv_timer_handler(); | ||
|
||
k_msleep(MIN(sleep_ms, INT32_MAX)); | ||
#ifdef CONFIG_LV_Z_DEMO_RENDER_SCENE_DYNAMIC | ||
if (sys_timepoint_expired(next_scene_switch)) { | ||
cur_scene = (cur_scene + 1) % _LV_DEMO_RENDER_SCENE_NUM; | ||
lv_demo_render(cur_scene, 255); | ||
next_scene_switch = sys_timepoint_calc( | ||
K_SECONDS(CONFIG_LV_Z_DEMO_RENDER_DYNAMIC_SCENE_TIMEOUT)); | ||
} | ||
#endif /* CONFIG_LV_Z_DEMO_RENDER_SCENE_DYNAMIC */ | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.