Skip to content

Commit

Permalink
Added lv_examples
Browse files Browse the repository at this point in the history
  • Loading branch information
JonTheBurger committed Sep 12, 2020
1 parent 13eeddc commit c78ffd0
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 231 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "external/lvgl"]
path = external/lvgl
url = https://github.com/lvgl/lvgl.git
[submodule "external/lv_examples"]
path = external/lv_examples
url = https://github.com/lvgl/lv_examples.git
220 changes: 32 additions & 188 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,197 +1,15 @@
file(GLOB_RECURSE lvgl_sources lvgl/*.c)
file(GLOB_RECURSE lvgl_headers lvgl/*.h)
add_library(lvgl
lv_conf.h
lvgl/lvgl.h

lvgl/src/lv_core/lv_disp.c
lvgl/src/lv_core/lv_disp.h
lvgl/src/lv_core/lv_group.c
lvgl/src/lv_core/lv_group.h
lvgl/src/lv_core/lv_indev.c
lvgl/src/lv_core/lv_indev.h
lvgl/src/lv_core/lv_obj.c
lvgl/src/lv_core/lv_obj.h
lvgl/src/lv_core/lv_obj_style_dec.h
lvgl/src/lv_core/lv_refr.c
lvgl/src/lv_core/lv_refr.h
lvgl/src/lv_core/lv_style.c
lvgl/src/lv_core/lv_style.h

lvgl/src/lv_draw/lv_draw.h
lvgl/src/lv_draw/lv_draw_arc.c
lvgl/src/lv_draw/lv_draw_arc.h
lvgl/src/lv_draw/lv_draw_blend.c
lvgl/src/lv_draw/lv_draw_blend.h
lvgl/src/lv_draw/lv_draw_img.c
lvgl/src/lv_draw/lv_draw_img.h
lvgl/src/lv_draw/lv_draw_label.c
lvgl/src/lv_draw/lv_draw_label.h
lvgl/src/lv_draw/lv_draw_line.c
lvgl/src/lv_draw/lv_draw_line.h
lvgl/src/lv_draw/lv_draw_mask.c
lvgl/src/lv_draw/lv_draw_mask.h
lvgl/src/lv_draw/lv_draw_rect.c
lvgl/src/lv_draw/lv_draw_rect.h
lvgl/src/lv_draw/lv_draw_triangle.c
lvgl/src/lv_draw/lv_draw_triangle.h
lvgl/src/lv_draw/lv_img_buf.c
lvgl/src/lv_draw/lv_img_buf.h
lvgl/src/lv_draw/lv_img_cache.c
lvgl/src/lv_draw/lv_img_cache.h
lvgl/src/lv_draw/lv_img_decoder.c
lvgl/src/lv_draw/lv_img_decoder.h

lvgl/src/lv_font/lv_font.c
lvgl/src/lv_font/lv_font_fmt_txt.c
lvgl/src/lv_font/lv_font_loader.c
lvgl/src/lv_font/lv_font_montserrat_12.c
lvgl/src/lv_font/lv_font_montserrat_14.c
lvgl/src/lv_font/lv_font_montserrat_16.c
lvgl/src/lv_font/lv_font_montserrat_18.c
lvgl/src/lv_font/lv_font_montserrat_20.c
lvgl/src/lv_font/lv_font_montserrat_22.c
lvgl/src/lv_font/lv_font_montserrat_24.c
lvgl/src/lv_font/lv_font_montserrat_26.c
lvgl/src/lv_font/lv_font_montserrat_28.c
lvgl/src/lv_font/lv_font_montserrat_30.c
lvgl/src/lv_font/lv_font_montserrat_32.c
lvgl/src/lv_font/lv_font_montserrat_34.c
lvgl/src/lv_font/lv_font_montserrat_36.c
lvgl/src/lv_font/lv_font_montserrat_38.c
lvgl/src/lv_font/lv_font_montserrat_40.c
lvgl/src/lv_font/lv_font_montserrat_42.c
lvgl/src/lv_font/lv_font_montserrat_44.c
lvgl/src/lv_font/lv_font_montserrat_46.c
lvgl/src/lv_font/lv_font_montserrat_48.c
lvgl/src/lv_font/lv_font_montserrat_12_subpx.c
lvgl/src/lv_font/lv_font_montserrat_28_compressed.c
lvgl/src/lv_font/lv_font_unscii_8.c
lvgl/src/lv_font/lv_font_dejavu_16_persian_hebrew.c

lvgl/src/lv_hal/lv_hal.h
lvgl/src/lv_hal/lv_hal_disp.c
lvgl/src/lv_hal/lv_hal_disp.h
lvgl/src/lv_hal/lv_hal_indev.c
lvgl/src/lv_hal/lv_hal_indev.h
lvgl/src/lv_hal/lv_hal_tick.c
lvgl/src/lv_hal/lv_hal_tick.h

lvgl/src/lv_misc/lv_anim.c
lvgl/src/lv_misc/lv_anim.h
lvgl/src/lv_misc/lv_area.c
lvgl/src/lv_misc/lv_area.h
lvgl/src/lv_misc/lv_async.c
lvgl/src/lv_misc/lv_async.h
lvgl/src/lv_misc/lv_bidi.c
lvgl/src/lv_misc/lv_bidi.h
lvgl/src/lv_misc/lv_color.c
lvgl/src/lv_misc/lv_color.h
lvgl/src/lv_misc/lv_debug.c
lvgl/src/lv_misc/lv_debug.h
lvgl/src/lv_misc/lv_fs.c
lvgl/src/lv_misc/lv_fs.h
lvgl/src/lv_misc/lv_gc.c
lvgl/src/lv_misc/lv_gc.h
lvgl/src/lv_misc/lv_ll.c
lvgl/src/lv_misc/lv_ll.h
lvgl/src/lv_misc/lv_log.c
lvgl/src/lv_misc/lv_log.h
lvgl/src/lv_misc/lv_math.c
lvgl/src/lv_misc/lv_math.h
lvgl/src/lv_misc/lv_mem.c
lvgl/src/lv_misc/lv_mem.h
lvgl/src/lv_misc/lv_printf.c
lvgl/src/lv_misc/lv_printf.h
lvgl/src/lv_misc/lv_task.c
lvgl/src/lv_misc/lv_task.h
lvgl/src/lv_misc/lv_txt.c
lvgl/src/lv_misc/lv_txt.h
lvgl/src/lv_misc/lv_txt_ap.c
lvgl/src/lv_misc/lv_txt_ap.h
lvgl/src/lv_misc/lv_types.h
lvgl/src/lv_misc/lv_utils.c
lvgl/src/lv_misc/lv_utils.h

lvgl/src/lv_themes/lv_theme.c
lvgl/src/lv_themes/lv_theme.h
lvgl/src/lv_themes/lv_theme_material.c
lvgl/src/lv_themes/lv_theme_material.h
lvgl/src/lv_themes/lv_theme_mono.c
lvgl/src/lv_themes/lv_theme_mono.h
lvgl/src/lv_themes/lv_theme_empty.c
lvgl/src/lv_themes/lv_theme_empty.h
lvgl/src/lv_themes/lv_theme_template.c
lvgl/src/lv_themes/lv_theme_template.h

lvgl/src/lv_widgets/lv_arc.c
lvgl/src/lv_widgets/lv_arc.h
lvgl/src/lv_widgets/lv_bar.c
lvgl/src/lv_widgets/lv_bar.h
lvgl/src/lv_widgets/lv_btn.c
lvgl/src/lv_widgets/lv_btn.h
lvgl/src/lv_widgets/lv_btnmatrix.c
lvgl/src/lv_widgets/lv_btnmatrix.h
lvgl/src/lv_widgets/lv_calendar.c
lvgl/src/lv_widgets/lv_calendar.h
lvgl/src/lv_widgets/lv_canvas.c
lvgl/src/lv_widgets/lv_canvas.h
lvgl/src/lv_widgets/lv_chart.c
lvgl/src/lv_widgets/lv_chart.h
lvgl/src/lv_widgets/lv_checkbox.c
lvgl/src/lv_widgets/lv_checkbox.h
lvgl/src/lv_widgets/lv_cont.c
lvgl/src/lv_widgets/lv_cont.h
lvgl/src/lv_widgets/lv_cpicker.c
lvgl/src/lv_widgets/lv_cpicker.h
lvgl/src/lv_widgets/lv_dropdown.c
lvgl/src/lv_widgets/lv_dropdown.h
lvgl/src/lv_widgets/lv_gauge.c
lvgl/src/lv_widgets/lv_gauge.h
lvgl/src/lv_widgets/lv_img.c
lvgl/src/lv_widgets/lv_img.h
lvgl/src/lv_widgets/lv_imgbtn.c
lvgl/src/lv_widgets/lv_imgbtn.h
lvgl/src/lv_widgets/lv_keyboard.c
lvgl/src/lv_widgets/lv_keyboard.h
lvgl/src/lv_widgets/lv_label.c
lvgl/src/lv_widgets/lv_label.h
lvgl/src/lv_widgets/lv_led.c
lvgl/src/lv_widgets/lv_led.h
lvgl/src/lv_widgets/lv_line.c
lvgl/src/lv_widgets/lv_line.h
lvgl/src/lv_widgets/lv_linemeter.c
lvgl/src/lv_widgets/lv_linemeter.h
lvgl/src/lv_widgets/lv_list.c
lvgl/src/lv_widgets/lv_list.h
lvgl/src/lv_widgets/lv_msgbox.c
lvgl/src/lv_widgets/lv_msgbox.h
lvgl/src/lv_widgets/lv_objmask.c
lvgl/src/lv_widgets/lv_objmask.h
lvgl/src/lv_widgets/lv_page.c
lvgl/src/lv_widgets/lv_page.h
lvgl/src/lv_widgets/lv_roller.c
lvgl/src/lv_widgets/lv_roller.h
lvgl/src/lv_widgets/lv_slider.c
lvgl/src/lv_widgets/lv_slider.h
lvgl/src/lv_widgets/lv_spinbox.c
lvgl/src/lv_widgets/lv_spinbox.h
lvgl/src/lv_widgets/lv_spinner.c
lvgl/src/lv_widgets/lv_spinner.h
lvgl/src/lv_widgets/lv_switch.c
lvgl/src/lv_widgets/lv_switch.h
lvgl/src/lv_widgets/lv_table.c
lvgl/src/lv_widgets/lv_table.h
lvgl/src/lv_widgets/lv_tabview.c
lvgl/src/lv_widgets/lv_tabview.h
lvgl/src/lv_widgets/lv_textarea.c
lvgl/src/lv_widgets/lv_textarea.h
lvgl/src/lv_widgets/lv_tileview.c
lvgl/src/lv_widgets/lv_tileview.h
lvgl/src/lv_widgets/lv_win.c
lvgl/src/lv_widgets/lv_win.h
${lvgl_sources}
${lvgl_headers}
)
target_include_directories(lvgl
PUBLIC
.
lvgl
lvgl/src
lvgl/src/lv_core
lvgl/src/lv_draw
lvgl/src/lv_font
Expand All @@ -200,3 +18,29 @@ target_include_directories(lvgl
lvgl/src/lv_themes
lvgl/src/lv_widgets
)

file(GLOB_RECURSE lv_examples_sources lv_examples/*.c)
file(GLOB_RECURSE lv_examples_headers lv_examples/*.h)
add_library(lv_examples
lv_ex_conf.h
${lv_examples_sources}
${lv_examples_headers}
)
target_include_directories(lv_examples
PUBLIC
.
lv_examples
lv_examples/src
lv_examples/src/lv_demo_benchmark
lv_examples/src/lv_demo_keyboard_encoder
lv_examples/src/lv_demo_printer
lv_examples/src/lv_demo_stress
lv_examples/src/lv_demo_widgets
lv_examples/src/lv_ex_get_started
lv_examples/src/lv_ex_style
lv_examples/src/lv_ex_widgets
)
target_link_libraries(lv_examples
PUBLIC
lvgl
)
50 changes: 50 additions & 0 deletions external/lv_ex_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @file lv_ex_conf.h
* Configuration file for v7.4.0
*
*/
/*
* COPY THIS FILE AS lv_ex_conf.h
*/

/** lvgl_sim_qt */
#if 1 /*Set it to "1" to enable the content*/

# ifndef LV_EX_CONF_H
# define LV_EX_CONF_H

/*******************
* GENERAL SETTING
*******************/
/** lvgl_sim_qt */
# define LV_EX_PRINTF 1 /*Enable printf-ing data in demoes and examples*/
# define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/
# define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/

/*********************
* DEMO USAGE
*********************/

/*Show some widget*/
# define LV_USE_DEMO_WIDGETS 0
# if LV_USE_DEMO_WIDGETS
# define LV_DEMO_WIDGETS_SLIDESHOW 0
# endif

/*Printer demo, optimized for 800x480*/
#define LV_USE_DEMO_PRINTER 0

/*Demonstrate the usage of encoder and keyboard*/
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0

/*Benchmark your system*/
/** lvgl_sim_qt */
# define LV_USE_DEMO_BENCHMARK 1

/*Stress test for LVGL*/
# define LV_USE_DEMO_STRESS 0

# endif /*LV_EX_CONF_H*/

#endif /*End of "Content enable"*/

1 change: 1 addition & 0 deletions external/lv_examples
Submodule lv_examples added at 56ce7e
1 change: 1 addition & 0 deletions lvgl_qt_quick/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_include_directories(lvgl_qt_quick
)
target_link_libraries(lvgl_qt_quick
PRIVATE
lv_examples
lvgl_qt
Qt${QT_VERSION_MAJOR}::Quick
)
Expand Down
25 changes: 4 additions & 21 deletions lvgl_qt_quick/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickWindow>
#include <lv_examples/lv_examples.h>

// Local
#include "LvglContext.hpp"
#include "LvglImageProvider.hpp"

static void create_demo();

int main(int argc, char* argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
Expand All @@ -22,7 +21,9 @@ int main(int argc, char* argv[])
auto lvgl_image_provider = std::make_unique<LvglImageProvider>(lvgl);

engine.addImageProvider("LvglImageProvider", lvgl_image_provider.release()); // engine takes ownership
create_demo();

/// lvgl_sim_qt_example
lv_demo_benchmark();

const QUrl url(QStringLiteral("qrc:/main.qml"));
engine.load(url);
Expand All @@ -41,21 +42,3 @@ int main(int argc, char* argv[])

return app.exec();
}

void create_demo()
{
static lv_obj_t* label1 = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(label1, LV_LABEL_LONG_BREAK); /*Break the long lines*/
lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
lv_label_set_align(label1, LV_LABEL_ALIGN_CENTER); /*Center aligned lines*/
lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label "
"and wrap long text automatically.");
lv_obj_set_width(label1, 150);
lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, -30);

static lv_obj_t* label2 = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC); /*Circular scroll*/
lv_obj_set_width(label2, 150);
lv_label_set_text(label2, "It is a circularly scrolling text. ");
lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 30);
}
1 change: 1 addition & 0 deletions lvgl_qt_widgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_include_directories(lvgl_qt_widgets
)
target_link_libraries(lvgl_qt_widgets
PRIVATE
lv_examples
lvgl_qt
Qt${QT_VERSION_MAJOR}::Widgets
)
Loading

0 comments on commit c78ffd0

Please sign in to comment.