From b11b20b0ac5c0adfbd1397cf42c322c873a736a8 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Tue, 23 Feb 2021 21:21:29 +0100 Subject: Remove LVGL folder (it's now a submodule) --- src/libs/lvgl/.editorconfig | 6 + src/libs/lvgl/.github/FUNDING.yml | 1 + src/libs/lvgl/.github/ISSUE_TEMPLATE/bug-report.md | 43 + src/libs/lvgl/.github/ISSUE_TEMPLATE/config.yml | 14 + .../lvgl/.github/ISSUE_TEMPLATE/dev-discussion.md | 29 + src/libs/lvgl/.github/auto-comment.yml | 12 + src/libs/lvgl/.github/pull_request_template.md | 8 + src/libs/lvgl/.github/stale.yml | 17 + .../lvgl/.github/workflows/build_micropython.yml | 41 + src/libs/lvgl/.github/workflows/ccpp.yml | 18 + src/libs/lvgl/.github/workflows/main.yml | 16 + src/libs/lvgl/.github/workflows/merge-to-dev.yml | 17 + src/libs/lvgl/.github/workflows/release.yml | 27 + src/libs/lvgl/.gitignore | 9 + src/libs/lvgl/.gitmodules | 0 src/libs/lvgl/CHANGELOG.md | 406 + src/libs/lvgl/CMakeLists.txt | 64 + src/libs/lvgl/Kconfig | 1222 ++ src/libs/lvgl/LICENCE.txt | 2 +- src/libs/lvgl/README.md | 457 +- src/libs/lvgl/component.mk | 8 + src/libs/lvgl/docs/CODING_STYLE.md | 43 +- src/libs/lvgl/docs/CONTRIBUTING.md | 112 +- src/libs/lvgl/docs/ROADMAP.md | 63 + src/libs/lvgl/examples/LVGL_Arduino.ino | 102 + .../lvgl/examples/porting/lv_port_disp_template.c | 196 + .../lvgl/examples/porting/lv_port_disp_template.h | 43 + .../lvgl/examples/porting/lv_port_fs_template.c | 377 + .../lvgl/examples/porting/lv_port_fs_template.h | 43 + .../lvgl/examples/porting/lv_port_indev_template.c | 423 + .../lvgl/examples/porting/lv_port_indev_template.h | 44 + src/libs/lvgl/library.json | 27 +- src/libs/lvgl/library.properties | 10 + src/libs/lvgl/lv_conf_template.h | 330 +- src/libs/lvgl/lvgl.h | 128 +- src/libs/lvgl/lvgl.mk | 16 +- ...dd-support-for-selecting-render-direction.patch | 122 - ..._bug_in_animation_management_for_lv_label.patch | 51 - src/libs/lvgl/porting/lv_port_disp_template.c | 196 - src/libs/lvgl/porting/lv_port_disp_template.h | 44 - src/libs/lvgl/porting/lv_port_fs_template.c | 379 - src/libs/lvgl/porting/lv_port_fs_template.h | 44 - src/libs/lvgl/porting/lv_port_indev_template.c | 428 - src/libs/lvgl/porting/lv_port_indev_template.h | 45 - src/libs/lvgl/scripts/built_in_font/DejaVuSans.ttf | Bin 0 -> 756072 bytes .../scripts/built_in_font/Montserrat-Medium.ttf | Bin 0 -> 243180 bytes .../lvgl/scripts/built_in_font/Roboto-Regular.woff | Bin 61736 -> 0 bytes src/libs/lvgl/scripts/built_in_font/SimSun.woff | Bin 0 -> 4801180 bytes .../scripts/built_in_font/built_in_font_gen.py | 56 +- .../lvgl/scripts/built_in_font/generate_all.py | 103 + src/libs/lvgl/scripts/clang-formatter.sh | 13 - src/libs/lvgl/scripts/code-format.cfg | 49 + src/libs/lvgl/scripts/code-format.sh | 1 + src/libs/lvgl/scripts/cppcheck_run.sh | 3 +- src/libs/lvgl/scripts/infer_run.sh | 9 + src/libs/lvgl/scripts/lv_conf_checker.py | 111 +- src/libs/lvgl/scripts/release/com.py | 110 + src/libs/lvgl/scripts/release/dev.py | 72 + src/libs/lvgl/scripts/release/main.py | 65 + src/libs/lvgl/scripts/release/proj.py | 62 + src/libs/lvgl/scripts/release/release.py | 173 + src/libs/lvgl/src/lv_api_map.h | 232 + src/libs/lvgl/src/lv_conf_checker.h | 851 -- src/libs/lvgl/src/lv_conf_internal.h | 2028 +++ src/libs/lvgl/src/lv_conf_kconfig.h | 420 + src/libs/lvgl/src/lv_conf_zephyr.h | 49 + src/libs/lvgl/src/lv_core/lv_core.mk | 7 +- src/libs/lvgl/src/lv_core/lv_debug.c | 193 - src/libs/lvgl/src/lv_core/lv_debug.h | 154 - src/libs/lvgl/src/lv_core/lv_disp.c | 280 +- src/libs/lvgl/src/lv_core/lv_disp.h | 86 +- src/libs/lvgl/src/lv_core/lv_group.c | 249 +- src/libs/lvgl/src/lv_core/lv_group.h | 58 +- src/libs/lvgl/src/lv_core/lv_indev.c | 853 +- src/libs/lvgl/src/lv_core/lv_indev.h | 46 +- src/libs/lvgl/src/lv_core/lv_obj.c | 3876 ++++-- src/libs/lvgl/src/lv_core/lv_obj.h | 811 +- src/libs/lvgl/src/lv_core/lv_obj_style_dec.h | 283 + src/libs/lvgl/src/lv_core/lv_refr.c | 553 +- src/libs/lvgl/src/lv_core/lv_refr.h | 24 +- src/libs/lvgl/src/lv_core/lv_style.c | 1386 +- src/libs/lvgl/src/lv_core/lv_style.h | 711 +- src/libs/lvgl/src/lv_draw/lv_draw.c | 191 - src/libs/lvgl/src/lv_draw/lv_draw.h | 70 +- src/libs/lvgl/src/lv_draw/lv_draw.mk | 11 +- src/libs/lvgl/src/lv_draw/lv_draw_arc.c | 532 +- src/libs/lvgl/src/lv_draw/lv_draw_arc.h | 10 +- src/libs/lvgl/src/lv_draw/lv_draw_basic.c | 783 -- src/libs/lvgl/src/lv_draw/lv_draw_basic.h | 82 - src/libs/lvgl/src/lv_draw/lv_draw_blend.c | 1103 ++ src/libs/lvgl/src/lv_draw/lv_draw_blend.h | 58 + src/libs/lvgl/src/lv_draw/lv_draw_img.c | 885 +- src/libs/lvgl/src/lv_draw/lv_draw_img.h | 123 +- src/libs/lvgl/src/lv_draw/lv_draw_label.c | 716 +- src/libs/lvgl/src/lv_draw/lv_draw_label.h | 59 +- src/libs/lvgl/src/lv_draw/lv_draw_line.c | 891 +- src/libs/lvgl/src/lv_draw/lv_draw_line.h | 26 +- src/libs/lvgl/src/lv_draw/lv_draw_mask.c | 1232 ++ src/libs/lvgl/src/lv_draw/lv_draw_mask.h | 302 + src/libs/lvgl/src/lv_draw/lv_draw_rect.c | 2556 ++-- src/libs/lvgl/src/lv_draw/lv_draw_rect.h | 75 +- src/libs/lvgl/src/lv_draw/lv_draw_triangle.c | 402 +- src/libs/lvgl/src/lv_draw/lv_draw_triangle.h | 22 +- src/libs/lvgl/src/lv_draw/lv_img_buf.c | 682 + src/libs/lvgl/src/lv_draw/lv_img_buf.h | 390 + src/libs/lvgl/src/lv_draw/lv_img_cache.c | 119 +- src/libs/lvgl/src/lv_draw/lv_img_cache.h | 9 +- src/libs/lvgl/src/lv_draw/lv_img_decoder.c | 147 +- src/libs/lvgl/src/lv_draw/lv_img_decoder.h | 111 +- src/libs/lvgl/src/lv_font/lv_font.c | 5 +- src/libs/lvgl/src/lv_font/lv_font.h | 160 +- src/libs/lvgl/src/lv_font/lv_font.mk | 38 +- .../src/lv_font/lv_font_dejavu_16_persian_hebrew.c | 6547 +++++++++ src/libs/lvgl/src/lv_font/lv_font_fmt_txt.c | 281 +- src/libs/lvgl/src/lv_font/lv_font_fmt_txt.h | 82 +- src/libs/lvgl/src/lv_font/lv_font_loader.c | 684 + src/libs/lvgl/src/lv_font/lv_font_loader.h | 44 + src/libs/lvgl/src/lv_font/lv_font_montserrat_10.c | 1615 +++ src/libs/lvgl/src/lv_font/lv_font_montserrat_12.c | 1874 +++ .../lvgl/src/lv_font/lv_font_montserrat_12_subpx.c | 1874 +++ src/libs/lvgl/src/lv_font/lv_font_montserrat_14.c | 2143 +++ src/libs/lvgl/src/lv_font/lv_font_montserrat_16.c | 2406 ++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_18.c | 2795 ++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_20.c | 3141 +++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_22.c | 3558 +++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_24.c | 3959 ++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_26.c | 4479 ++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_28.c | 5013 +++++++ .../src/lv_font/lv_font_montserrat_28_compressed.c | 3203 +++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_30.c | 5579 ++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_32.c | 6056 +++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_34.c | 6833 ++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_36.c | 7460 ++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_38.c | 8183 +++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_40.c | 9015 ++++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_42.c | 9833 ++++++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_44.c | 10633 +++++++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_46.c | 11562 ++++++++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_48.c | 12244 +++++++++++++++++ src/libs/lvgl/src/lv_font/lv_font_montserrat_8.c | 1407 ++ src/libs/lvgl/src/lv_font/lv_font_roboto_12.c | 1628 --- .../lvgl/src/lv_font/lv_font_roboto_12_subpx.c | 3419 ----- src/libs/lvgl/src/lv_font/lv_font_roboto_16.c | 2116 --- src/libs/lvgl/src/lv_font/lv_font_roboto_22.c | 3224 ----- src/libs/lvgl/src/lv_font/lv_font_roboto_28.c | 4609 ------- .../src/lv_font/lv_font_roboto_28_compressed.c | 2451 ---- src/libs/lvgl/src/lv_font/lv_font_simsun_16_cjk.c | 13598 +++++++++++++++++++ src/libs/lvgl/src/lv_font/lv_font_unscii_16.c | 627 + src/libs/lvgl/src/lv_font/lv_font_unscii_8.c | 421 +- src/libs/lvgl/src/lv_font/lv_symbol_def.h | 25 +- src/libs/lvgl/src/lv_gpu/lv_gpu.mk | 6 + src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp.c | 476 + src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp.h | 182 + src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp_osa.c | 165 + src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp_osa.h | 47 + src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_vglite.c | 299 + src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_vglite.h | 133 + src/libs/lvgl/src/lv_gpu/lv_gpu_stm32_dma2d.c | 261 + src/libs/lvgl/src/lv_gpu/lv_gpu_stm32_dma2d.h | 109 + src/libs/lvgl/src/lv_hal/lv_hal.mk | 6 +- src/libs/lvgl/src/lv_hal/lv_hal_disp.c | 193 +- src/libs/lvgl/src/lv_hal/lv_hal_disp.h | 127 +- src/libs/lvgl/src/lv_hal/lv_hal_indev.c | 54 +- src/libs/lvgl/src/lv_hal/lv_hal_indev.h | 60 +- src/libs/lvgl/src/lv_hal/lv_hal_tick.c | 24 +- src/libs/lvgl/src/lv_hal/lv_hal_tick.h | 9 +- src/libs/lvgl/src/lv_misc/lv_anim.c | 216 +- src/libs/lvgl/src/lv_misc/lv_anim.h | 215 +- src/libs/lvgl/src/lv_misc/lv_area.c | 253 +- src/libs/lvgl/src/lv_misc/lv_area.h | 71 +- src/libs/lvgl/src/lv_misc/lv_async.c | 31 +- src/libs/lvgl/src/lv_misc/lv_async.h | 11 +- src/libs/lvgl/src/lv_misc/lv_bidi.c | 373 +- src/libs/lvgl/src/lv_misc/lv_bidi.h | 81 +- src/libs/lvgl/src/lv_misc/lv_circ.c | 79 - src/libs/lvgl/src/lv_misc/lv_circ.h | 77 - src/libs/lvgl/src/lv_misc/lv_color.c | 110 +- src/libs/lvgl/src/lv_misc/lv_color.h | 483 +- src/libs/lvgl/src/lv_misc/lv_debug.c | 138 + src/libs/lvgl/src/lv_misc/lv_debug.h | 131 + src/libs/lvgl/src/lv_misc/lv_fs.c | 142 +- src/libs/lvgl/src/lv_misc/lv_fs.h | 32 +- src/libs/lvgl/src/lv_misc/lv_gc.c | 12 +- src/libs/lvgl/src/lv_misc/lv_gc.h | 25 +- src/libs/lvgl/src/lv_misc/lv_ll.c | 153 +- src/libs/lvgl/src/lv_misc/lv_ll.h | 50 +- src/libs/lvgl/src/lv_misc/lv_log.c | 34 +- src/libs/lvgl/src/lv_misc/lv_log.h | 90 +- src/libs/lvgl/src/lv_misc/lv_math.c | 119 +- src/libs/lvgl/src/lv_misc/lv_math.h | 61 +- src/libs/lvgl/src/lv_misc/lv_mem.c | 528 +- src/libs/lvgl/src/lv_misc/lv_mem.h | 171 +- src/libs/lvgl/src/lv_misc/lv_misc.mk | 10 +- src/libs/lvgl/src/lv_misc/lv_printf.c | 1284 +- src/libs/lvgl/src/lv_misc/lv_printf.h | 20 +- src/libs/lvgl/src/lv_misc/lv_task.c | 187 +- src/libs/lvgl/src/lv_misc/lv_task.h | 44 +- src/libs/lvgl/src/lv_misc/lv_templ.c | 2 +- src/libs/lvgl/src/lv_misc/lv_txt.c | 259 +- src/libs/lvgl/src/lv_misc/lv_txt.h | 59 +- src/libs/lvgl/src/lv_misc/lv_txt_ap.c | 273 + src/libs/lvgl/src/lv_misc/lv_txt_ap.h | 60 + src/libs/lvgl/src/lv_misc/lv_types.h | 39 +- src/libs/lvgl/src/lv_misc/lv_utils.c | 14 +- src/libs/lvgl/src/lv_misc/lv_utils.h | 6 +- src/libs/lvgl/src/lv_objx/lv_arc.c | 305 - src/libs/lvgl/src/lv_objx/lv_arc.h | 123 - src/libs/lvgl/src/lv_objx/lv_bar.c | 548 - src/libs/lvgl/src/lv_objx/lv_bar.h | 193 - src/libs/lvgl/src/lv_objx/lv_btn.c | 723 - src/libs/lvgl/src/lv_objx/lv_btn.h | 329 - src/libs/lvgl/src/lv_objx/lv_btnm.c | 1125 -- src/libs/lvgl/src/lv_objx/lv_btnm.h | 276 - src/libs/lvgl/src/lv_objx/lv_calendar.c | 983 -- src/libs/lvgl/src/lv_objx/lv_calendar.h | 229 - src/libs/lvgl/src/lv_objx/lv_canvas.c | 870 -- src/libs/lvgl/src/lv_objx/lv_canvas.h | 265 - src/libs/lvgl/src/lv_objx/lv_cb.c | 338 - src/libs/lvgl/src/lv_objx/lv_cb.h | 173 - src/libs/lvgl/src/lv_objx/lv_chart.c | 1557 --- src/libs/lvgl/src/lv_objx/lv_chart.h | 395 - src/libs/lvgl/src/lv_objx/lv_cont.c | 710 - src/libs/lvgl/src/lv_objx/lv_cont.h | 210 - src/libs/lvgl/src/lv_objx/lv_cpicker.c | 1068 -- src/libs/lvgl/src/lv_objx/lv_cpicker.h | 263 - src/libs/lvgl/src/lv_objx/lv_ddlist.c | 1032 -- src/libs/lvgl/src/lv_objx/lv_ddlist.h | 269 - src/libs/lvgl/src/lv_objx/lv_gauge.c | 473 - src/libs/lvgl/src/lv_objx/lv_gauge.h | 233 - src/libs/lvgl/src/lv_objx/lv_img.c | 435 - src/libs/lvgl/src/lv_objx/lv_img.h | 179 - src/libs/lvgl/src/lv_objx/lv_imgbtn.c | 437 - src/libs/lvgl/src/lv_objx/lv_imgbtn.h | 230 - src/libs/lvgl/src/lv_objx/lv_kb.c | 471 - src/libs/lvgl/src/lv_objx/lv_kb.h | 207 - src/libs/lvgl/src/lv_objx/lv_label.c | 1441 -- src/libs/lvgl/src/lv_objx/lv_label.h | 351 - src/libs/lvgl/src/lv_objx/lv_led.c | 258 - src/libs/lvgl/src/lv_objx/lv_led.h | 126 - src/libs/lvgl/src/lv_objx/lv_line.c | 308 - src/libs/lvgl/src/lv_objx/lv_line.h | 147 - src/libs/lvgl/src/lv_objx/lv_list.c | 1067 -- src/libs/lvgl/src/lv_objx/lv_list.h | 359 - src/libs/lvgl/src/lv_objx/lv_lmeter.c | 422 - src/libs/lvgl/src/lv_objx/lv_lmeter.h | 179 - src/libs/lvgl/src/lv_objx/lv_mbox.c | 573 - src/libs/lvgl/src/lv_objx/lv_mbox.h | 212 - src/libs/lvgl/src/lv_objx/lv_objx.mk | 37 - src/libs/lvgl/src/lv_objx/lv_objx_templ.c | 229 - src/libs/lvgl/src/lv_objx/lv_objx_templ.h | 108 - src/libs/lvgl/src/lv_objx/lv_page.c | 1263 -- src/libs/lvgl/src/lv_objx/lv_page.h | 416 - src/libs/lvgl/src/lv_objx/lv_preload.c | 444 - src/libs/lvgl/src/lv_objx/lv_preload.h | 197 - src/libs/lvgl/src/lv_objx/lv_roller.c | 733 - src/libs/lvgl/src/lv_objx/lv_roller.h | 212 - src/libs/lvgl/src/lv_objx/lv_slider.c | 620 - src/libs/lvgl/src/lv_objx/lv_slider.h | 216 - src/libs/lvgl/src/lv_objx/lv_spinbox.c | 479 - src/libs/lvgl/src/lv_objx/lv_spinbox.h | 188 - src/libs/lvgl/src/lv_objx/lv_sw.c | 403 - src/libs/lvgl/src/lv_objx/lv_sw.h | 159 - src/libs/lvgl/src/lv_objx/lv_ta.c | 1948 --- src/libs/lvgl/src/lv_objx/lv_ta.h | 478 - src/libs/lvgl/src/lv_objx/lv_table.c | 894 -- src/libs/lvgl/src/lv_objx/lv_table.h | 268 - src/libs/lvgl/src/lv_objx/lv_tabview.c | 1175 -- src/libs/lvgl/src/lv_objx/lv_tabview.h | 231 - src/libs/lvgl/src/lv_objx/lv_tileview.c | 584 - src/libs/lvgl/src/lv_objx/lv_tileview.h | 178 - src/libs/lvgl/src/lv_objx/lv_win.c | 618 - src/libs/lvgl/src/lv_objx/lv_win.h | 302 - src/libs/lvgl/src/lv_themes/lv_theme.c | 479 +- src/libs/lvgl/src/lv_themes/lv_theme.h | 483 +- src/libs/lvgl/src/lv_themes/lv_theme_alien.c | 958 -- src/libs/lvgl/src/lv_themes/lv_theme_alien.h | 59 - src/libs/lvgl/src/lv_themes/lv_theme_default.c | 477 - src/libs/lvgl/src/lv_themes/lv_theme_default.h | 60 - src/libs/lvgl/src/lv_themes/lv_theme_empty.c | 103 + src/libs/lvgl/src/lv_themes/lv_theme_empty.h | 56 + src/libs/lvgl/src/lv_themes/lv_theme_material.c | 1826 ++- src/libs/lvgl/src/lv_themes/lv_theme_material.h | 36 +- src/libs/lvgl/src/lv_themes/lv_theme_mono.c | 1110 +- src/libs/lvgl/src/lv_themes/lv_theme_mono.h | 30 +- src/libs/lvgl/src/lv_themes/lv_theme_nemo.c | 929 -- src/libs/lvgl/src/lv_themes/lv_theme_nemo.h | 60 - src/libs/lvgl/src/lv_themes/lv_theme_night.c | 847 -- src/libs/lvgl/src/lv_themes/lv_theme_night.h | 60 - src/libs/lvgl/src/lv_themes/lv_theme_templ.c | 473 - src/libs/lvgl/src/lv_themes/lv_theme_templ.h | 60 - src/libs/lvgl/src/lv_themes/lv_theme_template.c | 838 ++ src/libs/lvgl/src/lv_themes/lv_theme_template.h | 56 + src/libs/lvgl/src/lv_themes/lv_theme_zen.c | 902 -- src/libs/lvgl/src/lv_themes/lv_theme_zen.h | 60 - src/libs/lvgl/src/lv_themes/lv_themes.mk | 15 +- src/libs/lvgl/src/lv_version.h | 66 - src/libs/lvgl/src/lv_widgets/lv_arc.c | 1120 ++ src/libs/lvgl/src/lv_widgets/lv_arc.h | 266 + src/libs/lvgl/src/lv_widgets/lv_bar.c | 764 ++ src/libs/lvgl/src/lv_widgets/lv_bar.h | 199 + src/libs/lvgl/src/lv_widgets/lv_btn.c | 319 + src/libs/lvgl/src/lv_widgets/lv_btn.h | 228 + src/libs/lvgl/src/lv_widgets/lv_btnmatrix.c | 1305 ++ src/libs/lvgl/src/lv_widgets/lv_btnmatrix.h | 265 + src/libs/lvgl/src/lv_widgets/lv_calendar.c | 1084 ++ src/libs/lvgl/src/lv_widgets/lv_calendar.h | 208 + src/libs/lvgl/src/lv_widgets/lv_canvas.c | 1235 ++ src/libs/lvgl/src/lv_widgets/lv_canvas.h | 270 + src/libs/lvgl/src/lv_widgets/lv_chart.c | 1859 +++ src/libs/lvgl/src/lv_widgets/lv_chart.h | 465 + src/libs/lvgl/src/lv_widgets/lv_checkbox.c | 291 + src/libs/lvgl/src/lv_widgets/lv_checkbox.h | 160 + src/libs/lvgl/src/lv_widgets/lv_cont.c | 817 ++ src/libs/lvgl/src/lv_widgets/lv_cont.h | 222 + src/libs/lvgl/src/lv_widgets/lv_cpicker.c | 1037 ++ src/libs/lvgl/src/lv_widgets/lv_cpicker.h | 226 + src/libs/lvgl/src/lv_widgets/lv_dropdown.c | 1347 ++ src/libs/lvgl/src/lv_widgets/lv_dropdown.h | 260 + src/libs/lvgl/src/lv_widgets/lv_gauge.c | 642 + src/libs/lvgl/src/lv_widgets/lv_gauge.h | 275 + src/libs/lvgl/src/lv_widgets/lv_img.c | 887 ++ src/libs/lvgl/src/lv_widgets/lv_img.h | 218 + src/libs/lvgl/src/lv_widgets/lv_imgbtn.c | 571 + src/libs/lvgl/src/lv_widgets/lv_imgbtn.h | 198 + src/libs/lvgl/src/lv_widgets/lv_keyboard.c | 534 + src/libs/lvgl/src/lv_widgets/lv_keyboard.h | 183 + src/libs/lvgl/src/lv_widgets/lv_label.c | 1510 ++ src/libs/lvgl/src/lv_widgets/lv_label.h | 308 + src/libs/lvgl/src/lv_widgets/lv_led.c | 251 + src/libs/lvgl/src/lv_widgets/lv_led.h | 97 + src/libs/lvgl/src/lv_widgets/lv_line.c | 293 + src/libs/lvgl/src/lv_widgets/lv_line.h | 118 + src/libs/lvgl/src/lv_widgets/lv_linemeter.c | 555 + src/libs/lvgl/src/lv_widgets/lv_linemeter.h | 169 + src/libs/lvgl/src/lv_widgets/lv_list.c | 928 ++ src/libs/lvgl/src/lv_widgets/lv_list.h | 311 + src/libs/lvgl/src/lv_widgets/lv_msgbox.c | 637 + src/libs/lvgl/src/lv_widgets/lv_msgbox.h | 195 + src/libs/lvgl/src/lv_widgets/lv_objmask.c | 365 + src/libs/lvgl/src/lv_widgets/lv_objmask.h | 111 + src/libs/lvgl/src/lv_widgets/lv_objx_templ.c | 238 + src/libs/lvgl/src/lv_widgets/lv_objx_templ.h | 103 + src/libs/lvgl/src/lv_widgets/lv_page.c | 1397 ++ src/libs/lvgl/src/lv_widgets/lv_page.h | 426 + src/libs/lvgl/src/lv_widgets/lv_roller.c | 1037 ++ src/libs/lvgl/src/lv_widgets/lv_roller.h | 194 + src/libs/lvgl/src/lv_widgets/lv_slider.c | 533 + src/libs/lvgl/src/lv_widgets/lv_slider.h | 221 + src/libs/lvgl/src/lv_widgets/lv_spinbox.c | 601 + src/libs/lvgl/src/lv_widgets/lv_spinbox.h | 188 + src/libs/lvgl/src/lv_widgets/lv_spinner.c | 326 + src/libs/lvgl/src/lv_widgets/lv_spinner.h | 180 + src/libs/lvgl/src/lv_widgets/lv_switch.c | 355 + src/libs/lvgl/src/lv_widgets/lv_switch.h | 137 + src/libs/lvgl/src/lv_widgets/lv_table.c | 1191 ++ src/libs/lvgl/src/lv_widgets/lv_table.h | 276 + src/libs/lvgl/src/lv_widgets/lv_tabview.c | 1031 ++ src/libs/lvgl/src/lv_widgets/lv_tabview.h | 192 + src/libs/lvgl/src/lv_widgets/lv_textarea.c | 1924 +++ src/libs/lvgl/src/lv_widgets/lv_textarea.h | 450 + src/libs/lvgl/src/lv_widgets/lv_tileview.c | 474 + src/libs/lvgl/src/lv_widgets/lv_tileview.h | 164 + src/libs/lvgl/src/lv_widgets/lv_widgets.mk | 38 + src/libs/lvgl/src/lv_widgets/lv_win.c | 855 ++ src/libs/lvgl/src/lv_widgets/lv_win.h | 313 + src/libs/lvgl/src/lvgl.h | 39 + src/libs/lvgl/tests/Makefile | 59 + src/libs/lvgl/tests/build.py | 375 + src/libs/lvgl/tests/font_1.fnt | Bin 0 -> 6876 bytes src/libs/lvgl/tests/font_2.fnt | Bin 0 -> 7252 bytes src/libs/lvgl/tests/font_3.fnt | Bin 0 -> 4892 bytes src/libs/lvgl/tests/icon.png | Bin 0 -> 2739 bytes src/libs/lvgl/tests/icon2.png | Bin 0 -> 1853 bytes src/libs/lvgl/tests/lv_test_assert.c | 376 + src/libs/lvgl/tests/lv_test_assert.h | 53 + src/libs/lvgl/tests/lv_test_conf.h | 50 + src/libs/lvgl/tests/lv_test_core/lv_test_core.c | 56 + src/libs/lvgl/tests/lv_test_core/lv_test_core.h | 38 + .../lvgl/tests/lv_test_core/lv_test_font_loader.c | 223 + .../lvgl/tests/lv_test_core/lv_test_font_loader.h | 38 + src/libs/lvgl/tests/lv_test_core/lv_test_obj.c | 88 + src/libs/lvgl/tests/lv_test_core/lv_test_obj.h | 38 + src/libs/lvgl/tests/lv_test_core/lv_test_style.c | 624 + src/libs/lvgl/tests/lv_test_core/lv_test_style.h | 38 + src/libs/lvgl/tests/lv_test_fonts/font_1.c | 1378 ++ src/libs/lvgl/tests/lv_test_fonts/font_2.c | 1408 ++ src/libs/lvgl/tests/lv_test_fonts/font_3.c | 946 ++ src/libs/lvgl/tests/lv_test_main.c | 145 + .../lv_test_ref_imgs/lv_test_img32_label_1.png | Bin 0 -> 2533 bytes .../lvgl/tests/lv_test_widgets/lv_test_label.c | 69 + .../lvgl/tests/lv_test_widgets/lv_test_label.h | 38 + src/libs/lvgl/zephyr/module.yml | 2 + 392 files changed, 220533 insertions(+), 68375 deletions(-) create mode 100644 src/libs/lvgl/.editorconfig create mode 100644 src/libs/lvgl/.github/FUNDING.yml create mode 100644 src/libs/lvgl/.github/ISSUE_TEMPLATE/bug-report.md create mode 100644 src/libs/lvgl/.github/ISSUE_TEMPLATE/config.yml create mode 100644 src/libs/lvgl/.github/ISSUE_TEMPLATE/dev-discussion.md create mode 100644 src/libs/lvgl/.github/auto-comment.yml create mode 100644 src/libs/lvgl/.github/pull_request_template.md create mode 100644 src/libs/lvgl/.github/stale.yml create mode 100644 src/libs/lvgl/.github/workflows/build_micropython.yml create mode 100644 src/libs/lvgl/.github/workflows/ccpp.yml create mode 100644 src/libs/lvgl/.github/workflows/main.yml create mode 100644 src/libs/lvgl/.github/workflows/merge-to-dev.yml create mode 100644 src/libs/lvgl/.github/workflows/release.yml create mode 100644 src/libs/lvgl/.gitignore create mode 100644 src/libs/lvgl/.gitmodules create mode 100644 src/libs/lvgl/CHANGELOG.md create mode 100644 src/libs/lvgl/CMakeLists.txt create mode 100644 src/libs/lvgl/Kconfig create mode 100644 src/libs/lvgl/component.mk create mode 100644 src/libs/lvgl/docs/ROADMAP.md create mode 100644 src/libs/lvgl/examples/LVGL_Arduino.ino create mode 100644 src/libs/lvgl/examples/porting/lv_port_disp_template.c create mode 100644 src/libs/lvgl/examples/porting/lv_port_disp_template.h create mode 100644 src/libs/lvgl/examples/porting/lv_port_fs_template.c create mode 100644 src/libs/lvgl/examples/porting/lv_port_fs_template.h create mode 100644 src/libs/lvgl/examples/porting/lv_port_indev_template.c create mode 100644 src/libs/lvgl/examples/porting/lv_port_indev_template.h create mode 100644 src/libs/lvgl/library.properties delete mode 100644 src/libs/lvgl/patches/0001-lv_refr-add-support-for-selecting-render-direction.patch delete mode 100644 src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch delete mode 100644 src/libs/lvgl/porting/lv_port_disp_template.c delete mode 100644 src/libs/lvgl/porting/lv_port_disp_template.h delete mode 100644 src/libs/lvgl/porting/lv_port_fs_template.c delete mode 100644 src/libs/lvgl/porting/lv_port_fs_template.h delete mode 100644 src/libs/lvgl/porting/lv_port_indev_template.c delete mode 100644 src/libs/lvgl/porting/lv_port_indev_template.h create mode 100644 src/libs/lvgl/scripts/built_in_font/DejaVuSans.ttf create mode 100644 src/libs/lvgl/scripts/built_in_font/Montserrat-Medium.ttf delete mode 100644 src/libs/lvgl/scripts/built_in_font/Roboto-Regular.woff create mode 100644 src/libs/lvgl/scripts/built_in_font/SimSun.woff mode change 100644 => 100755 src/libs/lvgl/scripts/built_in_font/built_in_font_gen.py create mode 100755 src/libs/lvgl/scripts/built_in_font/generate_all.py delete mode 100755 src/libs/lvgl/scripts/clang-formatter.sh create mode 100644 src/libs/lvgl/scripts/code-format.cfg create mode 100755 src/libs/lvgl/scripts/code-format.sh create mode 100755 src/libs/lvgl/scripts/infer_run.sh create mode 100755 src/libs/lvgl/scripts/release/com.py create mode 100755 src/libs/lvgl/scripts/release/dev.py create mode 100755 src/libs/lvgl/scripts/release/main.py create mode 100755 src/libs/lvgl/scripts/release/proj.py create mode 100755 src/libs/lvgl/scripts/release/release.py create mode 100644 src/libs/lvgl/src/lv_api_map.h delete mode 100644 src/libs/lvgl/src/lv_conf_checker.h create mode 100644 src/libs/lvgl/src/lv_conf_internal.h create mode 100644 src/libs/lvgl/src/lv_conf_kconfig.h create mode 100644 src/libs/lvgl/src/lv_conf_zephyr.h delete mode 100644 src/libs/lvgl/src/lv_core/lv_debug.c delete mode 100644 src/libs/lvgl/src/lv_core/lv_debug.h create mode 100644 src/libs/lvgl/src/lv_core/lv_obj_style_dec.h delete mode 100644 src/libs/lvgl/src/lv_draw/lv_draw.c delete mode 100644 src/libs/lvgl/src/lv_draw/lv_draw_basic.c delete mode 100644 src/libs/lvgl/src/lv_draw/lv_draw_basic.h create mode 100644 src/libs/lvgl/src/lv_draw/lv_draw_blend.c create mode 100644 src/libs/lvgl/src/lv_draw/lv_draw_blend.h create mode 100644 src/libs/lvgl/src/lv_draw/lv_draw_mask.c create mode 100644 src/libs/lvgl/src/lv_draw/lv_draw_mask.h create mode 100644 src/libs/lvgl/src/lv_draw/lv_img_buf.c create mode 100644 src/libs/lvgl/src/lv_draw/lv_img_buf.h create mode 100644 src/libs/lvgl/src/lv_font/lv_font_dejavu_16_persian_hebrew.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_loader.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_loader.h create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_10.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_12.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_12_subpx.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_14.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_16.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_18.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_20.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_22.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_24.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_26.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_28.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_28_compressed.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_30.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_32.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_34.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_36.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_38.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_40.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_42.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_44.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_46.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_48.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_montserrat_8.c delete mode 100644 src/libs/lvgl/src/lv_font/lv_font_roboto_12.c delete mode 100644 src/libs/lvgl/src/lv_font/lv_font_roboto_12_subpx.c delete mode 100644 src/libs/lvgl/src/lv_font/lv_font_roboto_16.c delete mode 100644 src/libs/lvgl/src/lv_font/lv_font_roboto_22.c delete mode 100644 src/libs/lvgl/src/lv_font/lv_font_roboto_28.c delete mode 100644 src/libs/lvgl/src/lv_font/lv_font_roboto_28_compressed.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_simsun_16_cjk.c create mode 100644 src/libs/lvgl/src/lv_font/lv_font_unscii_16.c create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu.mk create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp.c create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp.h create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp_osa.c create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_pxp_osa.h create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_vglite.c create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_nxp_vglite.h create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_stm32_dma2d.c create mode 100644 src/libs/lvgl/src/lv_gpu/lv_gpu_stm32_dma2d.h delete mode 100644 src/libs/lvgl/src/lv_misc/lv_circ.c delete mode 100644 src/libs/lvgl/src/lv_misc/lv_circ.h create mode 100644 src/libs/lvgl/src/lv_misc/lv_debug.c create mode 100644 src/libs/lvgl/src/lv_misc/lv_debug.h create mode 100644 src/libs/lvgl/src/lv_misc/lv_txt_ap.c create mode 100644 src/libs/lvgl/src/lv_misc/lv_txt_ap.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_arc.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_arc.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_bar.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_bar.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_btn.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_btn.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_btnm.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_btnm.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_calendar.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_calendar.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_canvas.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_canvas.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_cb.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_cb.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_chart.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_chart.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_cont.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_cont.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_cpicker.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_cpicker.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_ddlist.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_ddlist.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_gauge.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_gauge.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_img.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_img.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_imgbtn.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_imgbtn.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_kb.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_kb.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_label.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_label.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_led.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_led.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_line.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_line.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_list.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_list.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_lmeter.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_lmeter.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_mbox.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_mbox.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_objx.mk delete mode 100644 src/libs/lvgl/src/lv_objx/lv_objx_templ.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_objx_templ.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_page.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_page.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_preload.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_preload.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_roller.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_roller.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_slider.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_slider.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_spinbox.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_spinbox.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_sw.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_sw.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_ta.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_ta.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_table.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_table.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_tabview.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_tabview.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_tileview.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_tileview.h delete mode 100644 src/libs/lvgl/src/lv_objx/lv_win.c delete mode 100644 src/libs/lvgl/src/lv_objx/lv_win.h delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_alien.c delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_alien.h delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_default.c delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_default.h create mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_empty.c create mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_empty.h delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_nemo.c delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_nemo.h delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_night.c delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_night.h delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_templ.c delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_templ.h create mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_template.c create mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_template.h delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_zen.c delete mode 100644 src/libs/lvgl/src/lv_themes/lv_theme_zen.h delete mode 100644 src/libs/lvgl/src/lv_version.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_arc.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_arc.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_bar.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_bar.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_btn.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_btn.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_btnmatrix.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_btnmatrix.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_calendar.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_calendar.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_canvas.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_canvas.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_chart.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_chart.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_checkbox.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_checkbox.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_cont.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_cont.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_cpicker.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_cpicker.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_dropdown.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_dropdown.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_gauge.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_gauge.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_img.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_img.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_imgbtn.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_imgbtn.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_keyboard.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_keyboard.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_label.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_label.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_led.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_led.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_line.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_line.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_linemeter.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_linemeter.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_list.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_list.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_msgbox.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_msgbox.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_objmask.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_objmask.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_objx_templ.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_objx_templ.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_page.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_page.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_roller.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_roller.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_slider.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_slider.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_spinbox.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_spinbox.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_spinner.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_spinner.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_switch.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_switch.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_table.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_table.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_tabview.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_tabview.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_textarea.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_textarea.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_tileview.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_tileview.h create mode 100644 src/libs/lvgl/src/lv_widgets/lv_widgets.mk create mode 100644 src/libs/lvgl/src/lv_widgets/lv_win.c create mode 100644 src/libs/lvgl/src/lv_widgets/lv_win.h create mode 100644 src/libs/lvgl/src/lvgl.h create mode 100644 src/libs/lvgl/tests/Makefile create mode 100755 src/libs/lvgl/tests/build.py create mode 100644 src/libs/lvgl/tests/font_1.fnt create mode 100644 src/libs/lvgl/tests/font_2.fnt create mode 100644 src/libs/lvgl/tests/font_3.fnt create mode 100644 src/libs/lvgl/tests/icon.png create mode 100644 src/libs/lvgl/tests/icon2.png create mode 100644 src/libs/lvgl/tests/lv_test_assert.c create mode 100644 src/libs/lvgl/tests/lv_test_assert.h create mode 100644 src/libs/lvgl/tests/lv_test_conf.h create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_core.c create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_core.h create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_font_loader.c create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_font_loader.h create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_obj.c create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_obj.h create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_style.c create mode 100644 src/libs/lvgl/tests/lv_test_core/lv_test_style.h create mode 100644 src/libs/lvgl/tests/lv_test_fonts/font_1.c create mode 100644 src/libs/lvgl/tests/lv_test_fonts/font_2.c create mode 100644 src/libs/lvgl/tests/lv_test_fonts/font_3.c create mode 100644 src/libs/lvgl/tests/lv_test_main.c create mode 100644 src/libs/lvgl/tests/lv_test_ref_imgs/lv_test_img32_label_1.png create mode 100644 src/libs/lvgl/tests/lv_test_widgets/lv_test_label.c create mode 100644 src/libs/lvgl/tests/lv_test_widgets/lv_test_label.h create mode 100644 src/libs/lvgl/zephyr/module.yml diff --git a/src/libs/lvgl/.editorconfig b/src/libs/lvgl/.editorconfig new file mode 100644 index 00000000..f22bee25 --- /dev/null +++ b/src/libs/lvgl/.editorconfig @@ -0,0 +1,6 @@ +[*.{c,h}] +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/src/libs/lvgl/.github/FUNDING.yml b/src/libs/lvgl/.github/FUNDING.yml new file mode 100644 index 00000000..13530078 --- /dev/null +++ b/src/libs/lvgl/.github/FUNDING.yml @@ -0,0 +1 @@ +open_collective: lvgl diff --git a/src/libs/lvgl/.github/ISSUE_TEMPLATE/bug-report.md b/src/libs/lvgl/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 00000000..9d9f05d8 --- /dev/null +++ b/src/libs/lvgl/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,43 @@ +--- +name: Bug report +about: Create a bug report to help us improve +title: '' +labels: '' +assignees: '' + +--- + + + +### Perform all steps below and tick them with [x] +- [ ] Check the related part of the [Documentation](https://docs.lvgl.io/) +- [ ] Update lvgl to the latest version +- [ ] Reproduce the issue in a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) + +### Describe the bug + + +### To Reproduce + + +### Expected behavior + + +### Screenshots or video + diff --git a/src/libs/lvgl/.github/ISSUE_TEMPLATE/config.yml b/src/libs/lvgl/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..2228ff12 --- /dev/null +++ b/src/libs/lvgl/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: Documentation + url: https://docs.lvgl.io + about: Be sure to read to documentation first + - name: Forum + url: https://forum.lvgl.io + about: For topics like How-to, Getting started, Feature request + - name: CONTIBUTING.md + url: https://github.com/lvgl/lvgl/blob/master/docs/CONTRIBUTING.md#faq-about-contributing + about: The basic rules of contributing + - name: CODING_STYLE.md + url: https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md + about: Quick summary of LVGL's code style diff --git a/src/libs/lvgl/.github/ISSUE_TEMPLATE/dev-discussion.md b/src/libs/lvgl/.github/ISSUE_TEMPLATE/dev-discussion.md new file mode 100644 index 00000000..7c9f6c08 --- /dev/null +++ b/src/libs/lvgl/.github/ISSUE_TEMPLATE/dev-discussion.md @@ -0,0 +1,29 @@ +--- +name: Development discussion +about: Discussion strictly related to the development of the LVGL. +title: '' +labels: '' +assignees: '' + +--- + + +### Introduce the problem + + +### Examples and cases + + +### Suggested solution + diff --git a/src/libs/lvgl/.github/auto-comment.yml b/src/libs/lvgl/.github/auto-comment.yml new file mode 100644 index 00000000..a141fb54 --- /dev/null +++ b/src/libs/lvgl/.github/auto-comment.yml @@ -0,0 +1,12 @@ +# Comment to a new issue. +pullRequestOpened: | + Thank you for raising your pull request. + + To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin). + + The text of DCO can be read here: https://developercertificate.org/ + For a more detailed description see the [Documentation](https://docs.lvgl.io/latest/en/html/contributing/index.html#developer-certification-of-origin-dco) site. + + By contributing to any repositories of the LVGL project you state that your contribution corresponds with the DCO. + + No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment. diff --git a/src/libs/lvgl/.github/pull_request_template.md b/src/libs/lvgl/.github/pull_request_template.md new file mode 100644 index 00000000..e4e0cf8f --- /dev/null +++ b/src/libs/lvgl/.github/pull_request_template.md @@ -0,0 +1,8 @@ +### Description of the feature or fix + +A clear and concise description of what the bug or new feature is. + +### Checkpoints +- [ ] Follow the [styling guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md) +- [ ] Update CHANGELOG.md +- [ ] Update the documentation diff --git a/src/libs/lvgl/.github/stale.yml b/src/libs/lvgl/.github/stale.yml new file mode 100644 index 00000000..c3d60ea6 --- /dev/null +++ b/src/libs/lvgl/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 21 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - architecture + - pinned +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue or pull request has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/src/libs/lvgl/.github/workflows/build_micropython.yml b/src/libs/lvgl/.github/workflows/build_micropython.yml new file mode 100644 index 00000000..bbc33f7b --- /dev/null +++ b/src/libs/lvgl/.github/workflows/build_micropython.yml @@ -0,0 +1,41 @@ +name: Build Micropython with LVGL submodule + +on: + push: + branches: [ master, dev ] + pull_request: + branches: [ master, dev ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Install SDL + run: | + sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" + sudo apt-get update -y -qq + sudo apt-get install libsdl2-dev + - name: Clone lv_micropython + run: git clone https://github.com/lvgl/lv_micropython.git . + - name: Update submodules + run: git submodule update --init --recursive + - name: Checkout LVGL submodule + working-directory: ./lib/lv_bindings/lvgl + run: | + git fetch --force ${{ github.event.repository.git_url }} "+refs/heads/*:refs/remotes/origin/*" + git fetch --force ${{ github.event.repository.git_url }} "+refs/pull/*:refs/remotes/origin/pr/*" + git checkout ${{ github.sha }} || git checkout ${{ github.event.pull_request.head.sha }} + git submodule update --init --recursive + - name: Build mpy-cross + run: make -j $(nproc) -C mpy-cross + - name: Build the unix port + run: make -j $(nproc) -C ports/unix + - name: Run advanced_demo + run: > + echo "import gc,utime; + utime.sleep(5); + gc.collect(); + utime.sleep(5)" | + ports/unix/micropython -i lib/lv_bindings/examples/advanced_demo.py diff --git a/src/libs/lvgl/.github/workflows/ccpp.yml b/src/libs/lvgl/.github/workflows/ccpp.yml new file mode 100644 index 00000000..f933952b --- /dev/null +++ b/src/libs/lvgl/.github/workflows/ccpp.yml @@ -0,0 +1,18 @@ +name: C/C++ CI + +on: + push: + branches: [ master, dev ] + pull_request: + branches: [master, dev ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ammaraskar/gcc-problem-matcher@master + - name: Run tests + run: sudo apt-get install libpng-dev; cd tests; python ./build.py diff --git a/src/libs/lvgl/.github/workflows/main.yml b/src/libs/lvgl/.github/workflows/main.yml new file mode 100644 index 00000000..9c4fc306 --- /dev/null +++ b/src/libs/lvgl/.github/workflows/main.yml @@ -0,0 +1,16 @@ +on: + issues: + types: [opened, edited] + +jobs: + auto_close_issues: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Automatically close issues that don't follow the issue template + uses: lucasbento/auto-close-issues@v1.0.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template." # optional property + closed-issues-label: "not-template" diff --git a/src/libs/lvgl/.github/workflows/merge-to-dev.yml b/src/libs/lvgl/.github/workflows/merge-to-dev.yml new file mode 100644 index 00000000..997bb5d2 --- /dev/null +++ b/src/libs/lvgl/.github/workflows/merge-to-dev.yml @@ -0,0 +1,17 @@ +name: Merge master branch to dev +on: + push: + branches: + - 'master' +jobs: + merge-branch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Merge to dev branch + uses: devmasx/merge-branch@v1.1.0 + with: + type: now + target_branch: 'dev' + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/src/libs/lvgl/.github/workflows/release.yml b/src/libs/lvgl/.github/workflows/release.yml new file mode 100644 index 00000000..b0fab0f5 --- /dev/null +++ b/src/libs/lvgl/.github/workflows/release.yml @@ -0,0 +1,27 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Create Release + +jobs: + build: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + See the [CHANGELOG](https://github.com/lvgl/lvgl/blob/master/CHANGELOG.md) + draft: false + prerelease: false diff --git a/src/libs/lvgl/.gitignore b/src/libs/lvgl/.gitignore new file mode 100644 index 00000000..07070a94 --- /dev/null +++ b/src/libs/lvgl/.gitignore @@ -0,0 +1,9 @@ +scripts/release/__pycache__ +**/*.o +**/*bin +**/*.swp +**/*.swo +tags +docs/api_doc +scripts/cppcheck_res.txt +scripts/built_in_font/lv_font_* diff --git a/src/libs/lvgl/.gitmodules b/src/libs/lvgl/.gitmodules new file mode 100644 index 00000000..e69de29b diff --git a/src/libs/lvgl/CHANGELOG.md b/src/libs/lvgl/CHANGELOG.md new file mode 100644 index 00000000..fe12c57b --- /dev/null +++ b/src/libs/lvgl/CHANGELOG.md @@ -0,0 +1,406 @@ +# Changelog + +## v7.10.1 + +### Bugfixes +- fix(draw) overlap outline with background to prevent aliasing artifacts +- fix(indev) clear the indev's `act_obj` in `lv_indev_reset` +- fix(text) fix out of bounds read in `_lv_txt_get_width` +- fix(text) improve Arabic contextual analysis by adding hyphen processing and proper handling of lam-alef sequence +- fix(delete) delete animation after the children are deleted +- fix(gauge) consider paddigns for needle images + +## v7.10.0 + +### New features +- feat(indev) allow input events to be passed to disabled objects +- feat(spinbox) add inline get_step function for MicroPython support + +### Bugfixes +- fix(btnmatrix) fix lv_btnmatrix_get_active_btn_text() when used in a group + +## v7.9.1 + +### Bugfixes +- fix(cpicker) fix division by zero +- fix(dropdown) fix selecting options after the last one +- fix(msgbox) use the animation time provided +- fix(gpu_nxp_pxp) fix incorrect define name +- fix(indev) don't leave edit mode if there is only one object in the group +- fix(draw_rect) fix draw pattern stack-use-after-scope error + + +## v7.9.0 + +### New features +- feat(chart) add lv_chart_remove_series and lv_chart_hide_series +- feat(img_cahce) allow disabling image caching +- calendar: make get_day_of_week() public +- Added support for Zephyr integration + +### Bugfixes +- fix(draw_rect) free buffer used for arabic processing +- fix(win) arabic process the title of the window +- fix(dropdown) arabic process the option in lv_dropdown_add_option +- fix(textarea) buffer overflow in password mode with UTF-8 characters +- fix(textarea) cursor position after hiding character in password mode +- fix(linemeter) draw critical lines with correct color +- fix(kconfig) handle disable sprintf float correctly. +- fix(layout) stop layout after recursion threshold is reached +- fix(gauge) fix redraw with image needle + +## v7.8.1 + +### Bugfixes +- fix(lv_scr_load_anim) fix when multiple screen are loaded at tsame time with delay +- fix(page) fix LV_SCOLLBAR_MODE_DRAG + +## v7.8.0 (01.12.2020) + +### New features +- make DMA2D non blocking +- add unscii-16 built-in font +- add KConfig +- add lv_refr_get_fps_avg() + +### Bugfixes +- fix(btnmatrix) handle arabic texts in button matrices +- fix(indev) disabled object shouldn't absorb clicks but let the parent to be clicked +- fix(arabic) support processing again already processed texts with _lv_txt_ap_proc +- fix(textarea) support Arabic letter connections +- fix(dropdown) support Arabic letter connections +- fix(value_str) support Arabic letter connections in value string property +- fix(indev) in LV_INDEV_TYPE_BUTTON recognize 1 cycle long presses too +- fix(arc) make arc work with encoder +- fix(slider) adjusting the left knob too with encoder +- fix reference to LV_DRAW_BUF_MAX_NUM in lv_mem.c +- fix(polygon draw) join adjacent points if they are on the same coordinate +- fix(linemeter) fix invalidation when setting new value +- fix(table) add missing invalidation when changing cell type +- refactor(roller) rename LV_ROLLER_MODE_INIFINITE -> LV_ROLLER_MODE_INFINITE + +## v7.7.2 (17.11.2020) +### Bugfixes +- fix(draw_triangle): fix polygon/triangle drawing when the order of points is counter-clockwise +- fix(btnmatrix): fix setting the same map with modified pointers +- fix(arc) fix and improve arc dragging +- label: Repair calculate back `dot` character logical error which cause infinite loop. +- fix(theme_material): remove the bottom border from tabview header +- fix(imgbtn) guess a the closest available state with valid src +- fix(spinbox) update cursor position in lv_spinbox_set_step + +## v7.7.1 (03.11.2020) +### Bugfixes +- Respect btnmatrix's `one_check` in `lv_btnmatrix_set_btn_ctrl` +- Gauge: make the needle images to use the styles from `LV_GAUGE_PART_PART` +- Group: fix in `lv_group_remove_obj` to handle deleting hidden obejcts correctly + +## v7.7.0 (20.10.2020) + +### New features +- Add PXP GPU support (for NXP MCUs) +- Add VG-Lite GPU support (for NXP MCUs) +- Allow max. 16 cell types for table +- Add `lv_table_set_text_fmt()` +- Use margin on calendar header to set distances and padding to the size of the header +- Add `text_sel_bg` style property + +### Bugfixes +- Theme update to support text selection background +- Fix imgbtn state change +- Support RTL in table (draw columns right to left) +- Support RTL in pretty layout (draw columns right to left) +- Skip objects in groups if they are in disabled state +- Fix dropdown selection with RTL basedirection +- Fix rectangle border drawing with large width +- Fix `lv_win_clean()` + +## v7.6.1 (06.10.2020) + +### Bugfixes +- Fix BIDI support in dropdown list +- Fix copying base dir in `lv_obj_create` +- Handle sub pixel rendering in font loader +- Fix transitions with style caching +- Fix click focus +- Fix imgbtn image switching with empty style +- Material theme: do not set the text font to allow easy global font change + +## v7.6.0 (22.09.2020) + +### New features +- Check whether any style property has changed on a state change to decide if any redraw is required + +### Bugfixes +- Fix selection of options with non-ASCII letters in dropdown list +- Fix font loader to support LV_FONT_FMT_TXT_LARGE + +## v7.5.0 (15.09.2020) + +### New features +- Add `clean_dcache_cb` and `lv_disp_clean_dcache` to enable users to use their own cache management function +- Add `gpu_wait_cb` to wait until the GPU is working. It allows to run CPU a wait only when the rendered data is needed. +- Add 10px and 8ox built in fonts + +### Bugfixes +- Fix unexpected DEFOCUS on lv_page when clicking to bg after the scrollable +- Fix `lv_obj_del` and `lv_obj_clean` if the children list changed during deletion. +- Adjust button matrix button width to include padding when spanning multiple units. +- Add rounding to btnmatrix line height calculation +- Add `decmopr_buf` to GC roots +- Fix divisioin by zero in draw_pattern (lv_draw_rect.c) if the image or letter is not found +- Fix drawing images with 1 px height or width + +## v7.4.0 (01.09.2020) + +The main new features of v7.4 are run-time font loading, style caching and arc knob with value setting by click. + +### New features +- Add `lv_font_load()` function - Loads a `lv_font_t` object from a binary font file +- Add `lv_font_free()` function - Frees the memory allocated by the `lv_font_load()` function +- Add style caching to reduce access time of properties with default value +- arc: add set value by click feature +- arc: add `LV_ARC_PART_KNOB` similarly to slider +- send gestures event if the object was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function. + +### Bugfixes +- Fix color bleeding on border drawing +- Fix using 'LV_SCROLLBAR_UNHIDE' after 'LV_SCROLLBAR_ON' +- Fix croping of last column/row if an image is zoomed +- Fix zooming and rotateing mosaic images +- Fix deleting tabview with LEFT/RIGHT tab position +- Fix btnmatrix to not send event when CLICK_TRIG = true and the cursor slid from a pressed button +- Fix roller width if selected text is larger than the normal + +## v7.3.1 (18.08.2020) + +### Bugfixes +- Fix drawing value string twice +- Rename `lv_chart_clear_serie` to `lv_chart_clear_series` and `lv_obj_align_origo` to `lv_obj_align_mid` +- Add linemeter's mirror feature again +- Fix text decor (udnerline strikethrough) with older versions of font converter +- Fix setting local style property multiple times +- Add missing background drawing and radius handling to image button +- Allow adding extra label to list buttons +- Fix crash if `lv_table_set_col_cnt` is called before `lv_table_set_row_cnt` for the first time +- Fix overflow in large image transformations +- Limit extra button click area of button matrix's buttons. With large paddings it was counter intuitive. (Gaps are mapped to button when clicked). +- Fix `lv_btnmatrix_set_one_check` not forcing exactly one button to be checked +- Fix color picker invalidation in rectangle mode +- Init disabled days to gray color in calendar + +## v7.3.0 (04.08.2020) + +### New features +- Add `lv_task_get_next` +- Add `lv_event_send_refresh`, `lv_event_send_refresh_recursive` to easily send `LV_EVENT_REFRESH` to object +- Add `lv_tabview_set_tab_name()` function - used to change a tab's name +- Add `LV_THEME_MATERIAL_FLAG_NO_TRANSITION` and `LV_THEME_MATERIAL_FLAG_NO_FOCUS` flags +- Reduce code size by adding: `LV_USE_FONT_COMPRESSED` and `LV_FONT_USE_SUBPX` and applying some optimization +- Add `LV_MEMCPY_MEMSET_STD` to use standard `memcpy` and `memset` + +### Bugfixes +- Do not print warning for missing glyph if its height OR width is zero. +- Prevent duplicated sending of `LV_EVENT_INSERT` from text area +- Tidy outer edges of cpicker widget. +- Remove duplicated lines from `lv_tabview_add_tab` +- btnmatrix: hadle combined states of buttons (e.g. chacked + disabled) +- textarea: fix typo in lv_textarea_set_sscrollbar_mode +- gauge: fix image needle drawing +- fix using freed memory in _lv_style_list_remove_style + +## v7.2.0 (21.07.2020) + +### New features +- Add screen transitions with `lv_scr_load_anim()` +- Add display background color, wallpaper and opacity. Shown when the screen is transparent. Can be used with `lv_disp_set_bg_opa/color/image()`. +- Add `LV_CALENDAR_WEEK_STARTS_MONDAY` +- Add `lv_chart_set_x_start_point()` function - Set the index of the x-axis start point in the data array +- Add `lv_chart_set_ext_array()` function - Set an external array of data points to use for the chart +- Add `lv_chart_set_point_id()` function - Set an individual point value in the chart series directly based on index +- Add `lv_chart_get_x_start_point()` function - Get the current index of the x-axis start point in the data array +- Add `lv_chart_get_point_id()` function - Get an individual point value in the chart series directly based on index +- Add `ext_buf_assigned` bit field to `lv_chart_series_t` structure - it's true if external buffer is assigned to series +- Add `lv_chart_set_series_axis()` to assign series to primary or secondary axis +- Add `lv_chart_set_y_range()` to allow setting range of secondary y axis (based on `lv_chart_set_range` but extended with an axis parameter) +- Allow setting different font for the selected text in `lv_roller` +- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the MicroPython binding +- Add `lv_theme_set_base()` to allow easy extension of built-in (or any) themes +- Add `lv_obj_align_x()` and `lv_obj_align_y()` functions +- Add `lv_obj_align_origo_x()` and `lv_obj_align_origo_y()` functions + +### Bugfixes +- `tileview` fix navigation when not screen sized +- Use 14px font by default to for better compatibility with smaller displays +- `linemeter` fix conversation of current value to "level" +- Fix drawing on right border +- Set the cursor image non clickable by default +- Improve mono theme when used with keyboard or encoder + +## v7.1.0 (07.07.2020) + +### New features +- Add `focus_parent` attribute to `lv_obj` +- Allow using buttons in encoder input device +- Add lv_btnmatrix_set/get_align capability +- DMA2D: Remove dependency on ST CubeMX HAL +- Added `max_used` propriety to `lv_mem_monitor_t` struct +- In `lv_init` test if the strings are UTF-8 encoded. +- Add `user_data` to themes +- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems. +- Add inline function lv_checkbox_get_state(const lv_obj_t * cb) to extend the checkbox functionality. +- Add inline function lv_checkbox_set_state(const lv_obj_t * cb, lv_btn_state_t state ) to extend the checkbox functionality. + +### Bugfixes +- `lv_img` fix invalidation area when angle or zoom changes +- Update the style handling to support Big endian MCUs +- Change some methods to support big endian hardware. +- remove use of c++ keyword 'new' in parameter of function lv_theme_set_base(). +- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems. +- Fix inserting chars in text area in big endian hardware. + +## v7.0.2 (16.06.2020) + +### Bugfixes +- `lv_textarea` fix wrong cursor position when clicked after the last character +- Change all text related indices from 16-bit to 32-bit integers throughout whole library. #1545 +- Fix gestures +- Do not call `set_px_cb` for transparent pixel +- Fix list button focus in material theme +- Fix crash when the a text area is cleared with the backspace of a keyboard +- Add version number to `lv_conf_template.h` +- Add log in true double buffering mode with `set_px_cb` +- `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder +- `lv_tileview`: fix if not the {0;0} tile is created first +- `lv_debug`: restructure to allow asserting in from `lv_misc` too +- add assert if `_lv_mem_buf_get()` fails +- `lv_textarea`: fix character delete in password mode +- Update `LV_OPA_MIN` and `LV_OPA_MAX` to widen the opacity processed range +- `lv_btnm` fix sending events for hidden buttons +- `lv_gaguge` make `lv_gauge_set_angle_offset` offset the labels and needles too +- Fix typo in the API `scrllable` -> `scrollable` +- `tabview` by default allow auto expanding the page only to right and bottom (#1573) +- fix crash when drawing gradient to the same color +- chart: fix memory leak +- `img`: improve hit test for transformed images + +## v7.0.1 (01.06.2020) + +### Bugfixes +- Make the Microptyhon working by adding the required variables as GC_ROOT +- Prefix some internal API functions with `_` to reduce the API of LVGL +- Fix built-in SimSun CJK font +- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled +- Fix DMA2D usage when 32 bit images directly blended +- Fix lv_roller in infinite mode when used with encoder +- Add `lv_theme_get_color_secondary()` +- Add `LV_COLOR_MIX_ROUND_OFS` to adjust color mixing to make it compatible with the GPU +- Improve DMA2D blending +- Remove memcpy from `lv_ll` (caused issues with some optimization settings) +- `lv_chart` fix X tick drawing +- Fix vertical dashed line drawing +- Some additional minor fixes and formattings + +## v7.0.0 (18.05.2020) + +### Documentation +The docs for v7 is available at https://docs.littlevgl.com/v7/en/html/index.html + +### Legal changes + +The name of the project is changed to LVGL and the new website is on https://lvgl.io + +LVGL remains free under the same conditions (MIT license) and a company is created to manage LVGL and offer services. + +### New drawing system +Complete rework of LVGL's draw engine to use "masks" for more advanced and higher quality graphical effects. +A possible use-case of this system is to remove the overflowing content from the rounded edges. +It also allows drawing perfectly anti-aliased circles, lines, and arcs. +Internally, the drawings happen by defining masks (such as rounded rectangle, line, angle). +When something is drawn the currently active masks can make some pixels transparent. +For example, rectangle borders are drawn by using 2 rectangle masks: one mask removes the inner part and another the outer part. + +The API in this regard remained the same but some new functions were added: +- `lv_img_set_zoom`: set image object's zoom factor +- `lv_img_set_angle`: set image object's angle without using canvas +- `lv_img_set_pivot`: set the pivot point of rotation + +The new drawing engine brought new drawing features too. They are highlighted in the "style" section. + +### New style system +The old style system is replaced with a new more flexible and lightweighted one. +It uses an approach similar to CSS: support cascading styles, inheriting properties and local style properties per object. +As part of these updates, a lot of objects were reworked and the APIs have been changed. + +- more shadows options: *offset* and *spread* +- gradient stop position to shift the gradient area and horizontal gradient +- `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE` blending modes +- *clip corner*: crop the content on the rounded corners +- *text underline* and *strikethrough* +- dashed vertical and horizontal lines (*dash gap*, *dash_width*) +- *outline*: a border-like part drawn out of the background. Can have spacing to the background. +- *pattern*: display and image in the middle of the background or repeat it +- *value* display a text which is stored in the style. It can be used e.g. as a lighweighted text on buttons too. +- *margin*: similar to *padding* but used to keep space outside of the object + +Read the [Style](https://docs.littlevgl.com/v7/en/html/overview/style.html) section of the documentation to learn how the new styles system works. + +### GPU integration +To better utilize GPUs, from this version GPU usage can be integrated into LVGL. In `lv_conf.h` any supported GPUs can be enabled with a single configuration option. + +Right now, only ST's DMA2D (Chrom-ART) is integrated. More will in the upcoming releases. + +### Renames +The following object types are renamed: +- sw -> switch +- ta -> textarea +- cb -> checkbox +- lmeter -> linemeter +- mbox -> msgbox +- ddlist -> dropdown +- btnm -> btnmatrix +- kb -> keyboard +- preload -> spinner +- lv_objx folder -> lv_widgets +- LV_FIT_FILL -> LV_FIT_PARENT +- LV_FIT_FLOOD -> LV_FLOOD_MAX +- LV_LAYOUT_COL_L/M/R -> LV_LAYOUT_COLUMN_LEFT/MID/RIGHT +- LV_LAYOUT_ROW_T/M/B -> LV_LAYOUT_ROW_TOP/MID/BOTTOM + +### Reworked and improved object +- `dropdown`: Completely reworked. Now creates a separate list when opened and can be dropped to down/up/left/right. +- `label`: `body_draw` is removed, instead, if its style has a visible background/border/shadow etc it will be drawn. Padding really makes the object larger (not just virtually as before) +- `arc`: can draw bacground too. +- `btn`: doesn't store styles for each state because it's done naturally in the new style system. +- `calendar`: highlight the pressed datum. The used styles are changed: use `LV_CALENDAR_PART_DATE` normal for normal dates, checked for highlighted, focused for today, pressed for the being pressed. (checked+pressed, focused+pressed also work) +- `chart`: only has `LINE` and `COLUMN` types because with new styles all the others can be described. LV_CHART_PART_SERIES sets the style of the series. bg_opa > 0 draws an area in LINE mode. `LV_CHART_PART_SERIES_BG` also added to set a different style for the series area. Padding in `LV_CHART_PART_BG` makes the series area smaller, and it ensures space for axis labels/numbers. +- `linemeter`, `gauge`: can have background if the related style properties are set. Padding makes the scale/lines smaller. scale_border_width and scale_end_border_width allow to draw an arc on the outer part of the scale lines. +- `gauge`: `lv_gauge_set_needle_img` allows use image as needle +- `canvas`: allow drawing to true color alpha and alpha only canvas, add `lv_canvas_blur_hor/ver` and rename `lv_canvas_rotate` to `lv_canvas_transform` +- `textarea`: If available in the font use bullet (`U+2022`) character in text area password + +### New object types +- `lv_objmask`: masks can be added to it. The children will be masked accordingly. + +### Others +- Change the built-in fonts to [Montserrat](https://fonts.google.com/specimen/Montserrat) and add built-in fonts from 12 px to 48 px for every 2nd size. +- Add example CJK and Arabic/Persian/Hebrew built-in font +- Add ° and "bullet" to the built-in fonts +- Add Arabic/Persian script support: change the character according to its position in the text. +- Add `playback_time` to animations. +- Add `repeat_count` to animations instead of the current "repeat forever". +- Replace `LV_LAYOUT_PRETTY` with `LV_LAYOUT_PRETTY_TOP/MID/BOTTOM` + +### Demos +- [lv_examples](https://github.com/littlevgl/lv_examples) was reworked and new examples and demos were added + +### New release policy +- Maintain this Changelog for every release +- Save old major version in new branches. E.g. `release/v6` +- Merge new features and fixes directly into `master` and release a patch or minor releases every 2 weeks. + +### Migrating from v6 to v7 +- First and foremost, create a new `lv_conf.h` based on `lv_conf_template.h`. +- To try the new version it suggested using a simulator project and see the examples. +- If you have a running project, the most difficult part of the migration is updating to the new style system. Unfortunately, there is no better way than manually updating to the new format. +- The other parts are mainly minor renames and refactoring as described above. diff --git a/src/libs/lvgl/CMakeLists.txt b/src/libs/lvgl/CMakeLists.txt new file mode 100644 index 00000000..4f9d8257 --- /dev/null +++ b/src/libs/lvgl/CMakeLists.txt @@ -0,0 +1,64 @@ +if(ESP_PLATFORM) + +file(GLOB_RECURSE SOURCES src/*.c) + +idf_component_register(SRCS ${SOURCES} + INCLUDE_DIRS . src + REQUIRES main) + +target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE") + +if (CONFIG_LV_MEM_CUSTOM) + if (CONFIG_LV_MEM_CUSTOM_ALLOC) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_MEM_CUSTOM_ALLOC=${CONFIG_LV_MEM_CUSTOM_ALLOC}") + endif() + + if (CONFIG_LV_MEM_CUSTOM_FREE) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_MEM_CUSTOM_FREE=${CONFIG_LV_MEM_CUSTOM_FREE}") + endif() +endif() + +if (CONFIG_LV_TICK_CUSTOM) + if (CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_TICK_CUSTOM_SYS_TIME_EXPR=${CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR}") + endif() +endif() + +if (CONFIG_LV_USER_DATA_FREE) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_USER_DATA_FREE=${CONFIG_LV_USER_DATA_FREE}") +endif() + +if (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM) + target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR") +endif() + +elseif(ZEPHYR_BASE) + +if(CONFIG_LVGL) + +zephyr_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl) + +target_include_directories(lvgl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +zephyr_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE=) + +zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM + LV_MEM_CUSTOM_ALLOC=${CONFIG_LV_MEM_CUSTOM_ALLOC} + ) +zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM + LV_MEM_CUSTOM_FREE=${CONFIG_LV_MEM_CUSTOM_FREE} + ) +zephyr_compile_definitions_ifdef(CONFIG_LV_TICK_CUSTOM + LV_TICK_CUSTOM_SYS_TIME_EXPR=${CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR} + ) + +zephyr_library() + +file(GLOB_RECURSE SOURCES src/*.c) +zephyr_library_sources(${SOURCES}) + +endif() # CONFIG_LVGL + +else() +message(FATAL_ERROR "Unknown platform.") +endif() diff --git a/src/libs/lvgl/Kconfig b/src/libs/lvgl/Kconfig new file mode 100644 index 00000000..1d97cada --- /dev/null +++ b/src/libs/lvgl/Kconfig @@ -0,0 +1,1222 @@ +# Kconfig file for LVGL v7.10.1 + +menu "LVGL configuration" + + config LV_ATTRIBUTE_FAST_MEM_USE_IRAM + bool "Set IRAM as LV_ATTRIBUTE_FAST_MEM" + help + Set this option to configure IRAM as LV_ATTRIBUTE_FAST_MEM + + config LV_CONF_MINIMAL + bool "LVGL minimal configuration." + + # Define CONFIG_LV_CONF_SKIP so we can use LVGL + # without lv_conf.h file, the lv_conf_internal.h and + # lv_conf_kconfig.h files are used instead. + config LV_CONF_SKIP + bool + default y + + config LV_HOR_RES_MAX + int "Maximal horizontal resolution to support by the library." + default 480 + + config LV_VER_RES_MAX + int "Maximal vertical resolution to support by the library." + default 320 + + choice + prompt "Color depth." + default LV_COLOR_DEPTH_16 + help + Color depth to be used. + + config LV_COLOR_DEPTH_32 + bool "32: ARGB8888" + config LV_COLOR_DEPTH_16 + bool "16: RGB565" + config LV_COLOR_DEPTH_8 + bool "8: RGB232" + config LV_COLOR_DEPTH_1 + bool "1: 1 byte per pixel" + endchoice + + config LV_COLOR_DEPTH + int + default 1 if LV_COLOR_DEPTH_1 + default 8 if LV_COLOR_DEPTH_8 + default 16 if LV_COLOR_DEPTH_16 + default 32 if LV_COLOR_DEPTH_32 + + config LV_COLOR_16_SWAP + bool "Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)." + depends on LV_COLOR_DEPTH_16 + + config LV_COLOR_SCREEN_TRANSP + bool "Enable screen transparency." + depends on LV_COLOR_DEPTH_32 + help + Useful for OSD or other overlapping GUIs. + Requires `LV_COLOR_DEPTH = 32` colors and the screen's style + should be modified: `style.body.opa = ...`. + + config LV_COLOR_TRANSP_HEX + hex "Images pixels with this color will not be drawn (with chroma keying)." + depends on LV_COLOR_SCREEN_TRANSP + range 0x000000 0xFFFFFF + default 0x00FF00 + help + See lv_misc/lv_color.h for some color values examples. + + config LV_ANTIALIAS + bool "Enable anti-aliasing (lines, and radiuses will be smoothed)." + default y if !LV_CONF_MINIMAL + + config LV_DISP_DEF_REFR_PERIOD + int "Default display refresh period (ms)." + default 30 + help + Can be changed in the display driver (`lv_disp_drv_t`). + + config LV_DPI + int "DPI (Dots per inch in px)." + default 130 + + config LV_DISP_SMALL_LIMIT + int "Small display limit" + default 30 + help + According to the width of the display (hor. res. / dpi) the + displays fall in 4 categories. This is the upper limit for small + displays. + + config LV_DISP_MEDIUM_LIMIT + int "Medium display limit" + default 50 + help + According to the width of the display (hor. res. / dpi) the + displays fall in 4 categories. This is the upper limit for medium + displays. + + config LV_DISP_LARGE_LIMIT + int "Large display limit" + default 70 + help + According to the width of the display (hor. res. / dpi) the + displays fall in 4 categories. This is the upper limit for large + displays. + + menu "Memory manager settings" + config LV_MEM_CUSTOM + bool + prompt "If true use custom malloc/free, otherwise use the built-in `lv_mem_alloc` and `lv_mem_free`" + + config LV_MEM_CUSTOM_INCLUDE + string + prompt "Header to include for the custom memory function" + default "stdlib.h" + depends on LV_MEM_CUSTOM + + config LV_MEM_CUSTOM_ALLOC + string + prompt "Wrapper to malloc" + default "malloc" + depends on LV_MEM_CUSTOM + + config LV_MEM_CUSTOM_FREE + string + prompt "Wrapper to free" + default "free" + depends on LV_MEM_CUSTOM + + config LV_MEM_SIZE_KILOBYTES + int + prompt "Size of the memory used by `lv_mem_alloc` in kilobytes (>= 2kB)" + range 2 128 + default 32 + depends on !LV_MEM_CUSTOM + + config LV_MEMCPY_MEMSET_STD + bool + prompt "Use the standard memcpy and memset instead of LVGL's own functions" + endmenu + + menu "Indev device settings" + config LV_INDEV_DEF_READ_PERIOD + int "Input device read period [ms]." + default 30 + config LV_INDEV_DEF_DRAG_LIMIT + int "Drag threshold in pixels." + default 10 + config LV_INDEV_DEF_DRAG_THROW + int "Drag throw slow-down in [%]. Greater value -> faster slow down." + default 10 + config LV_INDEV_DEF_LONG_PRESS_TIME + int "Long press time [ms]. Time to send 'LV_EVENT_LONG_PRESSED'." + default 400 + config LV_INDEV_DEF_LONG_PRESS_REP_TIME + int "Repeated trigger period in long press [ms]. Time between 'LV_EVENT_LONG_PRESSED_REPEAT'." + default 100 + config LV_INDEV_DEF_GESTURE_LIMIT + int "Gesture threshold in pixels." + default 50 + config LV_INDEV_DEF_GESTURE_MIN_VELOCITY + int "Gesture min velocity at release before swipe (pixels)." + default 3 + + endmenu + + menu "Feature usage" + config LV_USE_ANIMATION + bool "Enable the Animations." + default y if !LV_CONF_MINIMAL + config LV_USE_SHADOW + bool "Enable shadow drawing." + default y if !LV_CONF_MINIMAL + config LV_SHADOW_CACHE_SIZE + int "Shadow cache size" + depends on LV_USE_SHADOW + default 0 + help + Allow buffering some shadow calculation + LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, + where shadow size is `shadow_width + radius` + Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost. + config LV_USE_OUTLINE + bool "Enable outline drawing on rectangles." + default y if !LV_CONF_MINIMAL + config LV_USE_PATTERN + bool "Enable pattern drawing on rectangles." + default y if !LV_CONF_MINIMAL + config LV_USE_VALUE_STR + bool "Enable value string drawing on rectangles." + default y if !LV_CONF_MINIMAL + config LV_USE_BLEND_MODES + bool "Use other blend modes then normal (LV_BLEND_MODE_...)." + default y if !LV_CONF_MINIMAL + config LV_USE_OPA_SCALE + bool "Use the 'opa_scale' style property to set the opacity of an object and it's children at once." + default y if !LV_CONF_MINIMAL + config LV_USE_IMG_TRANSFORM + bool "Use image zoom and rotation." + default y if !LV_CONF_MINIMAL + config LV_USE_GROUP + bool "Enable object groups (for keyboard/encoder navigation)." + default y if !LV_CONF_MINIMAL + config LV_USE_GPU + bool "Enable GPU interface (only enabled 'gpu_fill_cb' and 'gpu_blend_cb' in the disp. drv." + default y if !LV_CONF_MINIMAL + config LV_USE_GPU_STM32_DMA2D + bool "Enable STM32 DMA2D." + config LV_GPU_DMA2D_CMSIS_INCLUDE + string "include path of CMSIS header of target processor" + depends on LV_USE_GPU_STM32_DMA2D + default "" + help + e.g. "stm32f769xx.h" or "stm32f429xx.h" + config LV_USE_GPU_NXP_PXP + bool "Use PXP for CPU off-load on NXP RTxxx platforms." + config LV_USE_GPU_NXP_PXP_AUTO_INIT + bool "Call lv_gpu_nxp_pxp_init() automatically or manually." + depends on LV_USE_GPU_NXP_PXP + help + 1: Add default bare metal and FreeRTOS interrupt handling + routines for PXP (lv_gpu_nxp_pxp_osa.c) and call + lv_gpu_nxp_pxp_init() automatically during lv_init(). + Note that symbol FSL_RTOS_FREE_RTOS has to be defined in order + to use FreeRTOS OSA, otherwise bare-metal implementation is + selected. + 0: lv_gpu_nxp_pxp_init() has to be called manually before + lv_init(). + config LV_USE_GPU_NXP_VG_LITE + bool "Use VG-Lite for CPU off-load on NXP RTxxx platforms." + config LV_USE_FILESYSTEM + bool "Enable file system (might be required for images." + default y if !LV_CONF_MINIMAL + config LV_USE_USER_DATA + bool "Add a 'user_data' to drivers and objects." + config LV_USE_USER_DATA_FREE + bool "Free the user data field upon object deletion" + depends on LV_USE_USER_DATA + config LV_USER_DATA_FREE_INCLUDE + string "Header for user data free function" + default "something.h" + depends on LV_USE_USER_DATA_FREE + config LV_USER_DATA_FREE + string "Invoking for user data free function. It has the lv_obj_t pointer as single parameter." + default "(user_data_free)" + depends on LV_USE_USER_DATA_FREE + config LV_USE_PERF_MONITOR + bool "Show CPU usage and FPS count in the right bottom corner." + config LV_USE_API_EXTENSION_V6 + bool "Use the functions and types from the older (v6) API if possible." + default y if !LV_CONF_MINIMAL + config LV_USE_API_EXTENSION_V7 + bool "Use the functions and types from the older (v7) API if possible." + default y if !LV_CONF_MINIMAL + endmenu + + menu "Image decoder and cache" + config LV_IMG_CF_INDEXED + bool "Enable indexed (palette) images." + default y if !LV_CONF_MINIMAL + config LV_IMG_CF_ALPHA + bool "Enable alpha indexed images." + default y if !LV_CONF_MINIMAL + config LV_IMG_CACHE_DEF_SIZE + int "Default image cache size." + default 1 + help + Image caching keeps the images opened. If only the built-in + image formats are used there is no real advantage of caching. + (I.e. no new image decoder is added) + + With complex image decoders (e.g. PNG or JPG) caching can + save the continuous open/decode of images. + However the opened images might consume additional RAM. + LV_IMG_CACHE_DEF_SIZE must be >= 1 + endmenu + + menu "Compiler Settings" + config LV_BIG_ENDIAN_SYSTEM + bool "For big endian systems set to 1" + endmenu + + menu "HAL Settings" + config LV_TICK_CUSTOM + bool + prompt "Use a custom tick source" + + config LV_TICK_CUSTOM_INCLUDE + string + prompt "Header for the system time function" + default "Arduino.h" + depends on LV_TICK_CUSTOM + + config LV_TICK_CUSTOM_SYS_TIME_EXPR + string + prompt "Expression evaluating to current system time in ms" + default "millis()" + depends on LV_TICK_CUSTOM + endmenu + + menu "Log Settings" + config LV_USE_LOG + bool "Enable the log module" + + choice + bool "Default log verbosity" if LV_USE_LOG + default LV_LOG_LEVEL_INFO + help + Specify how important log should be added. + + config LV_LOG_LEVEL_TRACE + bool "Trace - Detailed information" + config LV_LOG_LEVEL_INFO + bool "Info - Log important events" + config LV_LOG_LEVEL_WARN + bool "Warn - Log if something unwanted happened" + config LV_LOG_LEVEL_ERROR + bool "Error - Only critical issues" + config LV_LOG_LEVEL_NONE + bool "None - Do not log anything" + endchoice + + config LV_LOG_LEVEL + int + default 0 if LV_LOG_LEVEL_TRACE + default 1 if LV_LOG_LEVEL_INFO + default 2 if LV_LOG_LEVEL_WARN + default 3 if LV_LOG_LEVEL_ERROR + default 4 if LV_LOG_LEVEL_USER + default 5 if LV_LOG_LEVEL_NONE + + config LV_LOG_PRINTF + bool "Print the log with 'printf'" if LV_USE_LOG + help + Use printf for log output. + If not set the user needs to register a callback with `lv_log_register_print_cb`. + + endmenu + + menu "Debug Settings" + config LV_USE_DEBUG + bool "Enable Debug" + + config LV_USE_ASSERT_NULL + bool "Check if the parameter is NULL. (Quite fast)" + default y if !LV_CONF_MINIMAL + + config LV_USE_ASSERT_MEM + bool "Checks is the memory is successfully allocated or no. (Quite fast)" + default y if !LV_CONF_MINIMAL + + config LV_USE_ASSERT_MEM_INTEGRITY + bool "Check the integrity of `lv_mem` after critical operations. (Slow)" + + config LV_USE_ASSERT_STR + bool "Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)" + help + If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled). + + config LV_USE_ASSERT_OBJ + bool "Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)." + help + If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) + + config LV_USE_ASSERT_STYLE + bool "Check if the styles are properly initialized. (Fast)" + endmenu + + menu "Font usage" + config LV_FONT_FMT_TXT_LARGE + bool "Enable it if you have fonts with a lot of characters." + help + The limit depends on the font size, font face and bpp + but with > 10,000 characters if you see issues probably you + need to enable it. + + config LV_USE_FONT_SUBPX + bool "Enable subpixel rendering." + + config LV_FONT_SUBPX_BGR + bool "Use BGR instead RGB for sub-pixel rendering." + depends on LV_USE_FONT_SUBPX + help + Set the pixel order of the display. + Important only if "subpx fonts" are used. + With "normal" font it doesn't matter. + + menu "Enable built-in fonts" + config LV_FONT_MONTSERRAT_8 + bool "Enable Montserrat 8" + config LV_FONT_MONTSERRAT_10 + bool "Enable Montserrat 10" + config LV_FONT_MONTSERRAT_12 + bool "Enable Montserrat 12" + config LV_FONT_MONTSERRAT_14 + bool "Enable Montserrat 14" + default y if !LV_CONF_MINIMAL + config LV_FONT_MONTSERRAT_16 + bool "Enable Montserrat 16" + config LV_FONT_MONTSERRAT_18 + bool "Enable Montserrat 18" + config LV_FONT_MONTSERRAT_20 + bool "Enable Montserrat 20" + config LV_FONT_MONTSERRAT_22 + bool "Enable Montserrat 22" + config LV_FONT_MONTSERRAT_24 + bool "Enable Montserrat 24" + config LV_FONT_MONTSERRAT_26 + bool "Enable Montserrat 26" + config LV_FONT_MONTSERRAT_28 + bool "Enable Montserrat 28" + config LV_FONT_MONTSERRAT_30 + bool "Enable Montserrat 30" + config LV_FONT_MONTSERRAT_32 + bool "Enable Montserrat 32" + config LV_FONT_MONTSERRAT_34 + bool "Enable Montserrat 34" + config LV_FONT_MONTSERRAT_36 + bool "Enable Montserrat 36" + config LV_FONT_MONTSERRAT_38 + bool "Enable Montserrat 38" + config LV_FONT_MONTSERRAT_40 + bool "Enable Montserrat 40" + config LV_FONT_MONTSERRAT_42 + bool "Enable Montserrat 42" + config LV_FONT_MONTSERRAT_44 + bool "Enable Montserrat 44" + config LV_FONT_MONTSERRAT_46 + bool "Enable Montserrat 46" + config LV_FONT_MONTSERRAT_48 + bool "Enable Montserrat 48" + config LV_FONT_UNSCII_8 + bool "Enable UNSCII 8 (Perfect monospace font)" + default y if LV_CONF_MINIMAL + config LV_FONT_UNSCII_16 + bool "Enable UNSCII 16 (Perfect monospace font)" + config LV_FONT_MONTSERRAT12SUBPX + bool "Enable Montserrat 12 sub-pixel" + config LV_FONT_MONTSERRAT28COMPRESSED + bool "Enable Montserrat 28 compressed" + config LV_FONT_DEJAVU_16_PERSIAN_HEBREW + bool "Enable Dejavu 16 Persian, Hebrew, Arabic letters" + config LV_FONT_SIMSUN_16_CJK + bool "Enable Simsun 16 CJK" + endmenu + + choice LV_FONT_DEFAULT_SMALL + prompt "Select theme default small font" + default LV_FONT_DEFAULT_SMALL_MONTSERRAT_16 if !LV_CONF_MINIMAL + default LV_FONT_DEFAULT_SMALL_UNSCII_8 if LV_CONF_MINIMAL + help + Select theme default small font + + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_8 + bool "Montserrat 8" + select LV_FONT_MONTSERRAT_8 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_10 + bool "Montserrat 10" + select LV_FONT_MONTSERRAT_10 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_12 + bool "Montserrat 12" + select LV_FONT_MONTSERRAT_12 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_14 + bool "Montserrat 14" + select LV_FONT_MONTSERRAT_14 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_16 + bool "Montserrat 16" + select LV_FONT_MONTSERRAT_16 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_18 + bool "Montserrat 18" + select LV_FONT_MONTSERRAT_18 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_20 + bool "Montserrat 20" + select LV_FONT_MONTSERRAT_20 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_22 + bool "Montserrat 22" + select LV_FONT_MONTSERRAT_22 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_24 + bool "Montserrat 24" + select LV_FONT_MONTSERRAT_24 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_26 + bool "Montserrat 26" + select LV_FONT_MONTSERRAT_26 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_28 + bool "Montserrat 28" + select LV_FONT_MONTSERRAT_28 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_30 + bool "Montserrat 30" + select LV_FONT_MONTSERRAT_30 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_32 + bool "Montserrat 32" + select LV_FONT_MONTSERRAT_32 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_34 + bool "Montserrat 34" + select LV_FONT_MONTSERRAT_34 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_36 + bool "Montserrat 36" + select LV_FONT_MONTSERRAT_36 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_38 + bool "Montserrat 38" + select LV_FONT_MONTSERRAT_38 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_40 + bool "Montserrat 40" + select LV_FONT_MONTSERRAT_40 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_42 + bool "Montserrat 42" + select LV_FONT_MONTSERRAT_42 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_44 + bool "Montserrat 44" + select LV_FONT_MONTSERRAT_44 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_46 + bool "Montserrat 46" + select LV_FONT_MONTSERRAT_46 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT_48 + bool "Montserrat 48" + select LV_FONT_MONTSERRAT_48 + config LV_FONT_DEFAULT_SMALL_UNSCII_8 + bool "UNSCII 8 (Perfect monospace font)" + select LV_FONT_UNSCII_8 + config LV_FONT_DEFAULT_SMALL_UNSCII_16 + bool "UNSCII 16 (Perfect monospace font)" + select LV_FONT_UNSCII_16 + config LV_FONT_DEFAULT_SMALL_MONTSERRAT12SUBPX + bool "Montserrat 12 sub-pixel" + select LV_FONT_MONTSERRAT12SUBPX + config LV_FONT_DEFAULT_SMALL_MONTSERRAT28COMPRESSED + bool "Montserrat 28 compressed" + select LV_FONT_MONTSERRAT28COMPRESSED + config LV_FONT_DEFAULT_SMALL_DEJAVU_16_PERSIAN_HEBREW + bool "Dejavu 16 Persian, Hebrew, Arabic letters" + select LV_FONT_DEJAVU_16_PERSIAN_HEBREW + config LV_FONT_DEFAULT_SMALL_SIMSUN_16_CJK + bool "Simsun 16 CJK" + select LV_FONT_SIMSUN_16_CJK + endchoice + + choice LV_FONT_DEFAULT_NORMAL + prompt "Select theme default normal font" + default LV_FONT_DEFAULT_NORMAL_MONTSERRAT_16 if !LV_CONF_MINIMAL + default LV_FONT_DEFAULT_NORMAL_UNSCII_8 if LV_CONF_MINIMAL + help + Select theme default normal font + + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_8 + bool "Montserrat 8" + select LV_FONT_MONTSERRAT_8 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_10 + bool "Montserrat 10" + select LV_FONT_MONTSERRAT_10 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_12 + bool "Montserrat 12" + select LV_FONT_MONTSERRAT_12 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_14 + bool "Montserrat 14" + select LV_FONT_MONTSERRAT_14 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_16 + bool "Montserrat 16" + select LV_FONT_MONTSERRAT_16 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_18 + bool "Montserrat 18" + select LV_FONT_MONTSERRAT_18 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_20 + bool "Montserrat 20" + select LV_FONT_MONTSERRAT_20 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_22 + bool "Montserrat 22" + select LV_FONT_MONTSERRAT_22 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_24 + bool "Montserrat 24" + select LV_FONT_MONTSERRAT_24 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_26 + bool "Montserrat 26" + select LV_FONT_MONTSERRAT_26 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_28 + bool "Montserrat 28" + select LV_FONT_MONTSERRAT_28 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_30 + bool "Montserrat 30" + select LV_FONT_MONTSERRAT_30 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_32 + bool "Montserrat 32" + select LV_FONT_MONTSERRAT_32 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_34 + bool "Montserrat 34" + select LV_FONT_MONTSERRAT_34 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_36 + bool "Montserrat 36" + select LV_FONT_MONTSERRAT_36 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_38 + bool "Montserrat 38" + select LV_FONT_MONTSERRAT_38 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_40 + bool "Montserrat 40" + select LV_FONT_MONTSERRAT_40 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_42 + bool "Montserrat 42" + select LV_FONT_MONTSERRAT_42 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_44 + bool "Montserrat 44" + select LV_FONT_MONTSERRAT_44 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_46 + bool "Montserrat 46" + select LV_FONT_MONTSERRAT_46 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT_48 + bool "Montserrat 48" + select LV_FONT_MONTSERRAT_48 + config LV_FONT_DEFAULT_NORMAL_UNSCII_8 + bool "UNSCII 8 (Perfect monospace font)" + select LV_FONT_UNSCII_8 + config LV_FONT_DEFAULT_NORMAL_UNSCII_16 + bool "UNSCII 16 (Perfect monospace font)" + select LV_FONT_UNSCII_16 + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT12SUBPX + bool "Montserrat 12 sub-pixel" + select LV_FONT_MONTSERRAT12SUBPX + config LV_FONT_DEFAULT_NORMAL_MONTSERRAT28COMPRESSED + bool "Montserrat 28 compressed" + select LV_FONT_MONTSERRAT28COMPRESSED + config LV_FONT_DEFAULT_NORMAL_DEJAVU_16_PERSIAN_HEBREW + bool "Dejavu 16 Persian, Hebrew, Arabic letters" + select LV_FONT_DEJAVU_16_PERSIAN_HEBREW + config LV_FONT_DEFAULT_NORMAL_SIMSUN_16_CJK + bool "Simsun 16 CJK" + select LV_FONT_SIMSUN_16_CJK + endchoice + + choice LV_FONT_DEFAULT_SUBTITLE + prompt "Select theme default subtitle font" + default LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_16 if !LV_CONF_MINIMAL + default LV_FONT_DEFAULT_SUBTITLE_UNSCII_8 if LV_CONF_MINIMAL + help + Select theme default subtitle font + + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_8 + bool "Montserrat 8" + select LV_FONT_MONTSERRAT_8 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_10 + bool "Montserrat 10" + select LV_FONT_MONTSERRAT_10 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_12 + bool "Montserrat 12" + select LV_FONT_MONTSERRAT_12 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_14 + bool "Montserrat 14" + select LV_FONT_MONTSERRAT_14 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_16 + bool "Montserrat 16" + select LV_FONT_MONTSERRAT_16 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_18 + bool "Montserrat 18" + select LV_FONT_MONTSERRAT_18 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_20 + bool "Montserrat 20" + select LV_FONT_MONTSERRAT_20 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_22 + bool "Montserrat 22" + select LV_FONT_MONTSERRAT_22 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_24 + bool "Montserrat 24" + select LV_FONT_MONTSERRAT_24 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_26 + bool "Montserrat 26" + select LV_FONT_MONTSERRAT_26 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_28 + bool "Montserrat 28" + select LV_FONT_MONTSERRAT_28 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_30 + bool "Montserrat 30" + select LV_FONT_MONTSERRAT_30 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_32 + bool "Montserrat 32" + select LV_FONT_MONTSERRAT_32 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_34 + bool "Montserrat 34" + select LV_FONT_MONTSERRAT_34 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_36 + bool "Montserrat 36" + select LV_FONT_MONTSERRAT_36 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_38 + bool "Montserrat 38" + select LV_FONT_MONTSERRAT_38 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_40 + bool "Montserrat 40" + select LV_FONT_MONTSERRAT_40 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_42 + bool "Montserrat 42" + select LV_FONT_MONTSERRAT_42 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_44 + bool "Montserrat 44" + select LV_FONT_MONTSERRAT_44 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_46 + bool "Montserrat 46" + select LV_FONT_MONTSERRAT_46 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_48 + bool "Montserrat 48" + select LV_FONT_MONTSERRAT_48 + config LV_FONT_DEFAULT_SUBTITLE_UNSCII_8 + bool "UNSCII 8 (Perfect monospace font)" + select LV_FONT_UNSCII_8 + config LV_FONT_DEFAULT_SUBTITLE_UNSCII_16 + bool "UNSCII 16 (Perfect monospace font)" + select LV_FONT_UNSCII_16 + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT12SUBPX + bool "Montserrat 12 sub-pixel" + select LV_FONT_MONTSERRAT12SUBPX + config LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT28COMPRESSED + bool "Montserrat 28 compressed" + select LV_FONT_MONTSERRAT28COMPRESSED + config LV_FONT_DEFAULT_SUBTITLE_DEJAVU_16_PERSIAN_HEBREW + bool "Dejavu 16 Persian, Hebrew, Arabic letters" + select LV_FONT_DEJAVU_16_PERSIAN_HEBREW + config LV_FONT_DEFAULT_SUBTITLE_SIMSUN_16_CJK + bool "Simsun 16 CJK" + select LV_FONT_SIMSUN_16_CJK + endchoice + + choice LV_FONT_DEFAULT_TITLE + prompt "Select theme default title font" + default LV_FONT_DEFAULT_TITLE_MONTSERRAT_16 if !LV_CONF_MINIMAL + default LV_FONT_DEFAULT_TITLE_UNSCII_8 if LV_CONF_MINIMAL + help + Select theme default title font + + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_8 + bool "Montserrat 8" + select LV_FONT_MONTSERRAT_8 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_12 + bool "Montserrat 12" + select LV_FONT_MONTSERRAT_12 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_14 + bool "Montserrat 14" + select LV_FONT_MONTSERRAT_14 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_16 + bool "Montserrat 16" + select LV_FONT_MONTSERRAT_16 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_18 + bool "Montserrat 18" + select LV_FONT_MONTSERRAT_18 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_20 + bool "Montserrat 20" + select LV_FONT_MONTSERRAT_20 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_22 + bool "Montserrat 22" + select LV_FONT_MONTSERRAT_22 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_24 + bool "Montserrat 24" + select LV_FONT_MONTSERRAT_24 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_26 + bool "Montserrat 26" + select LV_FONT_MONTSERRAT_26 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_28 + bool "Montserrat 28" + select LV_FONT_MONTSERRAT_28 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_30 + bool "Montserrat 30" + select LV_FONT_MONTSERRAT_30 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_32 + bool "Montserrat 32" + select LV_FONT_MONTSERRAT_32 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_34 + bool "Montserrat 34" + select LV_FONT_MONTSERRAT_34 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_36 + bool "Montserrat 36" + select LV_FONT_MONTSERRAT_36 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_38 + bool "Montserrat 38" + select LV_FONT_MONTSERRAT_38 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_40 + bool "Montserrat 40" + select LV_FONT_MONTSERRAT_40 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_42 + bool "Montserrat 42" + select LV_FONT_MONTSERRAT_42 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_44 + bool "Montserrat 44" + select LV_FONT_MONTSERRAT_44 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_46 + bool "Montserrat 46" + select LV_FONT_MONTSERRAT_46 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT_48 + bool "Montserrat 48" + select LV_FONT_MONTSERRAT_48 + config LV_FONT_DEFAULT_TITLE_UNSCII_8 + bool "UNSCII 8 (Perfect monospace font)" + select LV_FONT_UNSCII_8 + config LV_FONT_DEFAULT_TITLE_UNSCII_16 + bool "UNSCII 16 (Perfect monospace font)" + select LV_FONT_UNSCII_16 + config LV_FONT_DEFAULT_TITLE_MONTSERRAT12SUBPX + bool "Montserrat 12 sub-pixel" + select LV_FONT_MONTSERRAT12SUBPX + config LV_FONT_DEFAULT_TITLE_MONTSERRAT28COMPRESSED + bool "Montserrat 28 compressed" + select LV_FONT_MONTSERRAT28COMPRESSED + config LV_FONT_DEFAULT_TITLE_DEJAVU_16_PERSIAN_HEBREW + bool "Dejavu 16 Persian, Hebrew, Arabic letters" + select LV_FONT_DEJAVU_16_PERSIAN_HEBREW + config LV_FONT_DEFAULT_TITLE_SIMSUN_16_CJK + bool "Simsun 16 CJK" + select LV_FONT_SIMSUN_16_CJK + endchoice + endmenu + + menu "Theme usage" + menu "Enable theme usage, always enable at least one theme" + config LV_THEME_EMPTY + bool "Empty: No theme, you can apply your styles as you need." + default y if LV_CONF_MINIMAL + config LV_THEME_TEMPLATE + bool "Template: Simple to create your theme based on it." + config LV_THEME_MATERIAL + bool "Material: A fast and impressive theme." + default y if !LV_CONF_MINIMAL + config LV_THEME_MONO + bool "Mono: Mono-color theme for monochrome displays" + endmenu + + choice LV_THEME_DEFAULT_INIT + prompt "Select theme default init" + default LV_THEME_DEFAULT_INIT_MATERIAL if !LV_CONF_MINIMAL + default LV_THEME_DEFAULT_INIT_EMPTY if LV_CONF_MINIMAL + help + Select theme default init + + config LV_THEME_DEFAULT_INIT_EMPTY + bool "Default init for empty theme" + select LV_THEME_EMPTY + config LV_THEME_DEFAULT_INIT_TEMPLATE + bool "Default init for template theme" + select LV_THEME_TEMPLATE + config LV_THEME_DEFAULT_INIT_MATERIAL + bool "Default init for material theme" + select LV_THEME_MATERIAL + config LV_THEME_DEFAULT_INIT_MONO + bool "Default init for mono theme" + select LV_THEME_MONO + endchoice + + config LV_THEME_DEFAULT_COLOR_PRIMARY + hex "Select theme default primary color" + range 0x000000 0xFFFFFF + default 0xFF0000 if !LV_THEME_DEFAULT_INIT_MONO + default 0x000000 if LV_THEME_DEFAULT_INIT_MONO + help + See lv_misc/lv_color.h for some color values examples. + When using LV_THEME_MONO the suggested values to use are + 0x000000 (LV_COLOR_BLACK) or 0xFFFFFF (LV_COLOR_WHITE). + If LV_THEME_DEFAULT_COLOR_PRIMARY is 0x000000 (LV_COLOR_BLACK) + the texts and borders will be black and the background will be + white, otherwise the colors are inverted. + + config LV_THEME_DEFAULT_COLOR_SECONDARY + hex "Select theme default secondary color" + range 0x000000 0xFFFFFF + default 0x0000FF if !LV_THEME_DEFAULT_INIT_MONO + default 0xFFFFFF if LV_THEME_DEFAULT_INIT_MONO + help + See lv_misc/lv_color.h for some color values examples. + When using LV_THEME_MONO the suggested values to use are + 0x000000 (LV_COLOR_BLACK) or 0xFFFFFF (LV_COLOR_WHITE). + If LV_THEME_DEFAULT_COLOR_PRIMARY is 0x000000 (LV_COLOR_BLACK) + the texts and borders will be black and the background will be + white, otherwise the colors are inverted. + + choice LV_THEME_DEFAULT_FLAG + depends on LV_THEME_MATERIAL + + prompt "Select theme default flag" + default LV_THEME_DEFAULT_FLAG_LIGHT + help + Select theme default flag + + config LV_THEME_DEFAULT_FLAG_LIGHT + bool "Light theme" + config LV_THEME_DEFAULT_FLAG_DARK + bool "Dark theme" + endchoice + + endmenu + + menu "Text Settings" + choice LV_TXT_ENC + prompt "Select a character encoding for strings" + help + Select a character encoding for strings. Your IDE or editor should have the same character encoding. + default LV_TXT_ENC_UTF8 if !LV_CONF_MINIMAL + default LV_TXT_ENC_ASCII if LV_CONF_MINIMAL + + config LV_TXT_ENC_UTF8 + bool "UTF8" + config LV_TXT_ENC_ASCII + bool "ASCII" + endchoice + + config LV_TXT_BREAK_CHARS + string "Can break (wrap) texts on these chars" + default " ,.;:-_" + + config LV_TXT_LINE_BREAK_LONG_LEN + int "Line break long length" + default 0 + help + If a word is at least this long, will break wherever 'prettiest'. + To disable, set to a value <= 0. + + config LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN + int "Min num chars before break" + default 3 + depends on LV_TXT_LINE_BREAK_LONG_LEN > 0 + help + Minimum number of characters in a long word to put on a line before a break. + + config LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN + int "Min num chars after break" + default 3 + depends on LV_TXT_LINE_BREAK_LONG_LEN > 0 + help + Minimum number of characters in a long word to put on a line after a break. + + config LV_TXT_COLOR_CMD + string "The control character to use for signalling text recoloring" + default "#" + + config LV_USE_BIDI + bool "Support bidirectional texts" + help + Allows mixing Left-to-Right and Right-to-Left texts. + The direction will be processed according to the Unicode Bidirectional Algorithm: + https://www.w3.org/International/articles/inline-bidi-markup/uba-basics + + choice + prompt "Set the default BIDI direction" + default LV_BIDI_DIR_AUTO + depends on LV_USE_BIDI + + config LV_BIDI_DIR_LTR + bool "Left-to-Right" + config LV_BIDI_DIR_RTL + bool "Right-to-Left" + config LV_BIDI_DIR_AUTO + bool "Detect texts base direction" + endchoice + + config LV_USE_ARABIC_PERSIAN_CHARS + bool "Enable Arabic/Persian processing" + help + In these languages characters should be replaced with + an other form based on their position in the text. + + config LV_SPRINTF_CUSTOM + bool "Change the built-in (v)snprintf functions" + + config LV_SPRINTF_DISABLE_FLOAT + bool "Disable float in built-in (v)snprintf functions" if !LV_SPRINTF_CUSTOM + endmenu + + menu "Widgets" + config LV_USE_OBJ_REALIGN + bool "Enable `lv_obj_realign()` based on `lv_obj_align()` parameters." + default y if !LV_CONF_MINIMAL + + choice + prompt "Enable to make the object clickable on a larger area." + default LV_USE_EXT_CLICK_AREA_TINY + + config LV_USE_EXT_CLICK_AREA_OFF + bool "Disable this feature." + config LV_USE_EXT_CLICK_AREA_TINY + bool "The extra area can be adjusted horizontally and vertically (0..255px)." + config LV_USE_EXT_CLICK_AREA_FULL + bool "The extra area can be adjusted in all 4 directions (-32k..+32k px)." + endchoice + + config LV_USE_ARC + bool "Arc." + default y if !LV_CONF_MINIMAL + config LV_USE_BAR + bool "Bar." + default y if !LV_CONF_MINIMAL + config LV_USE_BTN + bool "Button. Dependencies: lv_cont." + select LV_USE_CONT + default y if !LV_CONF_MINIMAL + config LV_USE_BTNMATRIX + bool "Button matrix." + default y if !LV_CONF_MINIMAL + config LV_USE_CALENDAR + bool "Calendar." + default y if !LV_CONF_MINIMAL + config LV_CALENDAR_WEEK_STARTS_MONDAY + bool "Calendar week starts monday." + depends on LV_USE_CALENDAR + config LV_USE_CANVAS + bool "Canvas. Dependencies: lv_img." + select LV_USE_IMG + default y if !LV_CONF_MINIMAL + config LV_USE_CHECKBOX + bool "Check Box. Dependencies: lv_btn, lv_label." + select LV_USE_BTN + select LV_USE_LABEL + default y if !LV_CONF_MINIMAL + config LV_USE_CHART + bool "Chart." + default y if !LV_CONF_MINIMAL + config LV_CHART_AXIS_TICK_MAX_LEN + int "Chart axis tick label max len." + depends on LV_USE_CHART + default 256 + config LV_USE_CONT + bool "Container." + default y if !LV_CONF_MINIMAL + config LV_USE_CPICKER + bool "Color picker." + default y if !LV_CONF_MINIMAL + config LV_USE_DROPDOWN + bool "Drop down list. Dependencies: lv_page, lv_label, lv_symbol_def.h." + select LV_USE_PAGE + select LV_USE_LABEL + default y if !LV_CONF_MINIMAL + config LV_DROPDOWN_DEF_ANIM_TIME + int "Drop down animation time. 0: no animation." + depends on LV_USE_DROPDOWN + default 200 + config LV_USE_GAUGE + bool "Gauge. Dependencies: lv_bar, lv_linemeter." + select LV_USE_BAR + select LV_USE_LINEMETER + default y if !LV_CONF_MINIMAL + config LV_USE_IMG + bool "Image. Dependencies: lv_label." + select LV_USE_LABEL + default y if !LV_CONF_MINIMAL + config LV_USE_IMGBTN + bool "Image button. Dependencies: lv_btn." + select LV_USE_BTN + default y if !LV_CONF_MINIMAL + config LV_IMGBTN_TILED + bool "Use imgbtn tiled." + depends on LV_USE_IMGBTN + config LV_USE_KEYBOARD + bool "Keyboard. Dependencies: lv_btnm." + select LV_USE_BTNM + default y if !LV_CONF_MINIMAL + config LV_USE_LABEL + bool "Label." + default y if !LV_CONF_MINIMAL + config LV_LABEL_DEF_SCROLL_SPEED + int "Hor. or ver. scroll speed [px/sec] in LV_LABEL_LONG_ROLL/ROLL_CIRC mode." + default 25 + depends on LV_USE_LABEL + config LV_LABEL_WAIT_CHAR_COUNT + int "Waiting period at beginning/end of animation cycle." + default 3 + depends on LV_USE_LABEL + config LV_LABEL_TEXT_SEL + bool "Enable selecting text of the label." + depends on LV_USE_LABEL + config LV_LABEL_LONG_TXT_HINT + bool "Store extra some info in labels (12 bytes) to speed up drawing of very long texts." + depends on LV_USE_LABEL + config LV_USE_LED + bool "LED." + default y if !LV_CONF_MINIMAL + config LV_LED_BRIGHT_MIN + int "LED minimal brightness." + range 0 255 + default 120 + depends on LV_USE_LED + config LV_LED_BRIGHT_MAX + int "LED maximal brightness." + range 0 255 + default 255 + depends on LV_USE_LED + config LV_USE_LINE + bool "Line." + default y if !LV_CONF_MINIMAL + config LV_USE_LIST + bool "List. Dependencies: lv_page, lv_btn, lv_label, lv_img." + select LV_USE_PAGE + select LV_USE_BTN + select LV_USE_LABEL + select LV_USE_IMG + default y if !LV_CONF_MINIMAL + config LV_LIST_DEF_ANIM_TIME + int "List default animation time of focusing to a list element [ms]. 0: no animation." + default 100 + depends on LV_USE_LIST + config LV_USE_LINEMETER + bool "Line meter." + default y if !LV_CONF_MINIMAL + choice + prompt "Draw line more precisely at cost of performance." + default LV_LINEMETER_PRECISE_NO_EXTRA_PRECISION + depends on LV_USE_LINEMETER + config LV_LINEMETER_PRECISE_NO_EXTRA_PRECISION + bool "0: No extra precision." + config LV_LINEMETER_PRECISE_SOME_EXTRA_PRECISION + bool "1: Some extra precision." + config LV_LINEMETER_PRECISE_BEST_PRECISION + bool "2: Best precision." + endchoice + config LV_USE_OBJMASK + bool "Mask." + default y if !LV_CONF_MINIMAL + config LV_USE_MSGBOX + bool "Message box. Dependencies: lv_rect, lv_btnm, lv_label." + select LV_USE_RECT + select LV_USE_BTNM + select LV_USE_LABEL + default y if !LV_CONF_MINIMAL + config LV_USE_PAGE + bool "Page. Dependencies: lv_cont." + select LV_USE_CONT + default y if !LV_CONF_MINIMAL + config LV_PAGE_DEF_ANIM_TIME + int "Focus default animation time [ms]. 0: No animation." + default 100 + depends on LV_USE_PAGE + config LV_USE_SPINNER + bool "Spinner. Dependencies: lv_arc, lv_anim." + select LV_USE_ARC + select LV_USE_ANIM + default y if !LV_CONF_MINIMAL + config LV_SPINNER_DEF_ARC_LENGTH + int "Spinner def. arc length [deg]." + default 60 + depends on LV_USE_SPINNER + config LV_SPINNER_DEF_SPIN_TIME + int "Spinner def. spin time [ms]." + default 1000 + depends on LV_USE_SPINNER + choice + prompt "Type of spinner (animation type)." + default LV_SPINNER_TYPE_SPINNING_ARC + depends on LV_USE_SPINNER + config LV_SPINNER_TYPE_SPINNING_ARC + bool "0: Spinner type spinning arc." + config LV_SPINNER_TYPE_FILLSPIN_ARC + bool "0: Spinner type fillspin arc." + config LV_SPINNER_TYPE_CONSTANT_ARC + bool "0: Spinner type constant arc." + endchoice + config LV_USE_ROLLER + bool "Roller. Dependencies: lv_page." + select LV_USE_PAGE + default y if !LV_CONF_MINIMAL + config LV_ROLLER_DEF_ANIM_TIME + int "Focus animation time [ms]. 0: no animation." + default 200 + depends on LV_USE_ROLLER + config LV_ROLLER_INF_PAGES + int "Number of extra 'pages' when the controller is infinite." + default 7 + depends on LV_USE_ROLLER + config LV_USE_SLIDER + bool "Slider. Dependencies: lv_bar." + select LV_USE_BAR + default y if !LV_CONF_MINIMAL + config LV_USE_SPINBOX + bool "Spinbox. Dependencies: lv_ta." + select LV_USE_TEXTAREA + default y if !LV_CONF_MINIMAL + config LV_USE_SWITCH + bool "Switch. Dependencies: lv_slider." + select LV_USE_SLIDER + default y if !LV_CONF_MINIMAL + config LV_USE_TEXTAREA + bool "Text area. Dependencies: lv_label, lv_page." + select LV_USE_LABEL + select LV_USE_PAGE + default y if !LV_CONF_MINIMAL + config LV_TEXTAREA_DEF_CURSOR_BLINK_TIME + int "Text area def. cursor blink time [ms]." + default 400 + depends on LV_USE_TEXTAREA + config LV_TEXTAREA_DEF_PWN_SHOW_TIME + int "Text area def. pwn show time [ms]." + default 1500 + depends on LV_USE_TEXTAREA + config LV_USE_TABLE + bool "Table. Dependencies: lv_label." + select LV_USE_LABEL + default y if !LV_CONF_MINIMAL + config LV_TABLE_COL_MAX + int "Table col max." + default 12 + depends on LV_USE_TABLE + config LV_TABLE_CELL_STYLE_CNT + int "Table cell style count." + default 4 + depends on LV_USE_TABLE + config LV_USE_TABVIEW + bool "Tab. Dependencies: lv_page, lv_btnm." + select LV_USE_PAGE + select LV_USE_BTNM + default y if !LV_CONF_MINIMAL + config LV_TABVIEW_DEF_ANIM_TIME + int "Time of slide animation [ms]. 0: No animation." + default 300 + depends on LV_USE_TABVIEW + config LV_USE_TILEVIEW + bool "Tileview. Dependencies: lv_page." + select LV_USE_PAGE + default y if !LV_CONF_MINIMAL + config LV_TILEVIEW_DEF_ANIM_TIME + int "Time of slide animation [ms]. 0: No animation." + default 300 + depends on LV_USE_TILEVIEW + config LV_USE_WIN + bool "Window. Dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page." + select LV_USE_CONT + select LV_USE_BTN + select LV_USE_LABEL + select LV_USE_IMG + select LV_USE_PAGE + default y if !LV_CONF_MINIMAL + endmenu + +endmenu diff --git a/src/libs/lvgl/LICENCE.txt b/src/libs/lvgl/LICENCE.txt index beaef1d2..a6f7f803 100644 --- a/src/libs/lvgl/LICENCE.txt +++ b/src/libs/lvgl/LICENCE.txt @@ -1,5 +1,5 @@ MIT licence -Copyright (c) 2016 Gábor Kiss-Vámosi +Copyright (c) 2020 LVGL LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/src/libs/lvgl/README.md b/src/libs/lvgl/README.md index 9d170887..7324fa9f 100644 --- a/src/libs/lvgl/README.md +++ b/src/libs/lvgl/README.md @@ -1,238 +1,128 @@ -

LittlevGL - Open-source Embedded GUI Library

-

- - -

+

LVGL - Light and Versatile Graphics Library

- +

-LittlevGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint. +LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.

-Website · -Live demo · -Simulator · -Forum · -Docs · -Blog +Website · +Online demo · +Nightly demos · +Docs · +Forum

--- -- [Features](#features) -- [Supported devices](#supported-devices) -- [Quick start in a simulator](#quick-start-in-a-simulator) -- [Add LittlevGL to your project](#add-littlevgl-to-your-project) -- [Learn the basics](#learn-the-basics) -- [Examples](#examples) -- [Contributing](#contributing) -- [Donate](#donate) - - ## Features -* **Powerful building blocks** buttons, charts, lists, sliders, images, etc. -* **Advanced graphics** with animations, anti-aliasing, opacity, smooth scrolling -* **Simultaneously use various input devices** touchscreen, mouse, keyboard, encoder, buttons, etc. -* **Simultaneously use multiple displays** i.e. monochrome and color display -* **Multi-language support** with UTF-8 encoding -* **Fully customizable** graphical elements -* **Hardware independent** to use with any microcontroller or display -* **Scalable** to operate with little memory (64 kB Flash, 10 kB RAM) -* **OS, External memory and GPU** supported but not required -* **Single frame buffer** operation even with advances graphical effects -* **Written in C** for maximal compatibility -* **Micropython Binding** exposes [LittlevGL API in Micropython](https://blog.littlevgl.com/2019-02-20/micropython-bindings) -* **Simulator** to develop on PC without embedded hardware -* **Tutorials, examples, themes** for rapid development -* **Documentation** and API references - -## Supported devices -Basically, every modern controller - which is able to drive a display - is suitable to run LittlevGL. The minimal requirements: -- 16, 32 or 64 bit microcontroller or processor -- > 16 MHz clock speed is recommended -- Flash/ROM: > 64 kB for the very essential components (> 180 kB is recommended) -- RAM: - - Static RAM usage: ~8..16 kB depending on the used features and objects types - - Stack: > 2kB (> 4 kB is recommended) - - Dynamic data (heap): > 4 KB (> 16 kB is recommended if using several objects). - Set by `LV_MEM_SIZE` in *lv_conf.h*. - - Display buffer: > *"Horizontal resolution"* pixels (> 10 × *"Horizontal resolution"* is recommended) -- C99 or newer compiler +* Powerful [building blocks](https://docs.lvgl.io/latest/en/html/widgets/index.html): buttons, charts, lists, sliders, images, etc. +* Advanced graphics: animations, anti-aliasing, opacity, smooth scrolling +* Use [various input devices](https://docs.lvgl.io/latest/en/html/overview/indev.html): touchscreen, mouse, keyboard, encoder, buttons, etc. +* Use [multiple displays](https://docs.lvgl.io/latest/en/html/overview/display.html): e.g. monochrome and color display +* Hardware independent to use with any microcontroller or display +* Scalable to operate with little memory (64 kB Flash, 10 kB RAM) +* Multi-language support with UTF-8 handling, Bidirectional and Arabic script support +* Fully customizable graphical elements via [CSS-like styles](https://docs.lvgl.io/latest/en/html/overview/style.html) +* OS, External memory and GPU are supported but not required +* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/latest/en/html/porting/display.html) +* Written in C for maximal compatibility (C++ compatible) +* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings) +* [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) to develop on PC without embedded hardware +* [Examples](lv_examples) and tutorials for rapid development +* [Documentation](http://docs.lvgl.io/) and API references + +## Requirements +Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name MinimalRecommended
Architecture16, 32 or 64 bit microcontroller or processor
Clock > 16 MHz > 48 MHz
Flash/ROM > 64 kB > 180 kB
Static RAM > 2 kB > 4 kB
Stack > 2 kB > 8 kB
Heap > 2 kB > 8 kB
Display buffer > 1 × hor. res. pixels > 10 × hor. res. pixels
Compiler C99 or newer
*Note that the memory usage might vary depending on the architecture, compiler and build options.* -Just to mention some **platforms**: -- STM32F1, STM32F3, [STM32F4](https://blog.littlevgl.com/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/littlevgl/stm32f746_disco_no_os_sw4stm32) +Just to mention some platforms: +- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7 - Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ -- NXP Kinetis, LPC, iMX -- [Linux frame buffer](https://blog.littlevgl.com/2018-01-03/linux_fb) (/dev/fb) -- [Raspberry PI](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl) -- [Espressif ESP32](https://github.com/littlevgl/esp32_ili9431) -- Nordic nrf52 -- Quectell M66 - -## Quick start in a simulator -The easiest way to get started with LittlevGL is to run it in a simulator on your PC without any embedded hardware. - -Choose a project with your favourite IDE: - -| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator | -|-------------|-------------|---------------|-----------|------------| -| [![Eclipse](https://littlevgl.com/logo/ide/eclipse.jpg)](https://github.com/littlevgl/pc_simulator_sdl_eclipse) | [![CodeBlocks](https://littlevgl.com/logo/ide/codeblocks.jpg)](https://github.com/littlevgl/pc_simulator_win_codeblocks) | [![VisualStudio](https://littlevgl.com/logo/ide/visualstudio.jpg)](https://github.com/littlevgl/visual_studio_2017_sdl_x64) | [![PlatformIO](https://littlevgl.com/logo/ide/platformio.jpg)](https://github.com/littlevgl/pc_simulator_sdl_platformio) | [![QtCreator](https://littlevgl.com/logo/ide/qtcreator.jpg)](https://blog.littlevgl.com/2019-01-03/qt-creator) | -| Cross-platform
with SDL
(Recommended on
Linux and Mac) | Native Windows | Windows
with SDL | Cross-platform
with SDL | Cross-platform
with SDL | - - -## Add LittlevGL to your project - -The steps below show how to setup LittlevGL on an embedded system with a display and a touchpad. -You can use the [Simulators](https://docs.littlevgl.com/en/html/get-started/pc-simulator) to get ready to use projects which can be run on your PC. - -1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library -2. Copy the `lvgl` folder into your project -3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. -4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions. -5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL. -6. Call `lv_init()` -7. Create a display buffer for LittlevGL -```c -static lv_disp_buf_t disp_buf; -static lv_color_t buf[LV_HOR_RES_MAX * 10]; /*Declare a buffer for 10 lines*/ -lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/ -``` -8. Implement and register a function which can **copy a pixel array** to an area of your display: -```c -lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/ -lv_disp_drv_init(&disp_drv); /*Basic initialization*/ -disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/ -disp_drv.buffer = &disp_buf; /*Assign the buffer to the display*/ -lv_disp_drv_register(&disp_drv); /*Finally register the driver*/ - -void my_disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p) -{ - int32_t x, y; - for(y = area->y1; y <= area->y2; y++) { - for(x = area->x1; x <= area->x2; x++) { - set_pixel(x, y, *color_p); /* Put a pixel to the display.*/ - color_p++; - } - } - - lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/ -} - -``` -9. Implement and register a function which can **read an input device**. E.g. for a touch pad: -```c -lv_indev_drv_init(&indev_drv); /*Descriptor of a input device driver*/ -indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/ -indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/ -lv_indev_drv_register(&indev_drv); /*Finally register the driver*/ - -bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) -{ - static lv_coord_t last_x = 0; - static lv_coord_t last_y = 0; - - /*Save the state and save the pressed coordinate*/ - data->state = touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL; - if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y); - - /*Set the coordinates (if released use the last pressed coordinates)*/ - data->point.x = last_x; - data->point.y = last_y; - - return false; /*Return `false` because we are not buffering and no more data to read*/ -} -``` -10. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. -It will redraw the screen if required, handle input devices etc. - - -## Learn the basics - -### Objects (Widgets) - -The graphical elements like Buttons, Labels, Sliders, Charts etc are called objects in LittelvGL. Go to [Object types](https://docs.littlevgl.com/en/html/object-types/index) to see the full list of available types. - -Every object has a parent object. The child object moves with the parent and if you delete the parent the children will be deleted too. Children can be visible only on their parent. - -The *screen* are the "root" parents. To get the current screen call `lv_scr_act()`. - -You can create a new object with `lv__create(parent, obj_to_copy)`. It will return an `lv_obj_t *` variable which should be used as a reference to the object to set its parameters. -The first parameter is the desired *parent*, te second parameters can be an object to copy (`NULL` is unused). -For example: -```c -lv_obj_t * slider1 = lv_slider_create(lv_scr_act(), NULL); -``` - -To set some basic attribute `lv_obj_set_(obj, )` function can be used. For example: -```c -lv_obj_set_x(btn1, 30); -lv_obj_set_y(btn1, 10); -lv_obj_set_size(btn1, 200, 50); -``` - -The objects has type specific parameters too which can be set by `lv__set_(obj, )` functions. For example: -```c -lv_slider_set_value(slider1, 70, LV_ANIM_ON); -``` - -To see the full API visit the documentation of the object types or the related header file (e.g. `lvgl/src/lv_objx/lv_slider.h`). - -### Styles -Styles can be assigned to the objects to changed their appearance. A style describes the appearance of rectangle-like objects (like a button or slider), texts, images and lines at once. - -You can create a new style like this: -```c -static lv_style_t style1; /*Declare a new style. Should be `static`*/ -lv_style_copy(&style1, &lv_style_plain); /*Copy a built-in style*/ -style1.body.main_color = LV_COLOR_RED; /*Main color*/ -style1.body.grad_color = lv_color_hex(0xffd83c) /*Gradient color (orange)*/ -style1.body.radius = 3; -style1.text.color = lv_color_hex3(0x0F0) /*Label color (green)*/ -style1.text.font = &lv_font_dejavu_22; /*Change font*/ -... -``` - -To set a new style for an object use the `lv_set_style(obj, LV__STYLE_, &my_style)` functions. For example: -```c -lv_slider_set_style(slider1, LV_SLIDER_STYLE_BG, &slider_bg_style); -lv_slider_set_style(slider1, LV_SLIDER_STYLE_INDIC, &slider_indic_style); -lv_slider_set_style(slider1, LV_SLIDER_STYLE_KNOB, &slider_knob_style); -``` - -If an object's style is `NULL` then it will inherit its parent's style. For example, the labels' style are `NULL` by default. If you place them on a button then they will use the `style.text` properties from the button's style. - -Learn more in [Style overview](https://docs.littlevgl.com/en/html/overview/style) section. - -### Events -Events are used to inform the user if something has happened with an object. You can assign a callback to an object which will be called if the object is clicked, released, dragged, being deleted etc. It should look like this: - -```c -lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/ - -... - -void btn_event_cb(lv_obj_t * btn, lv_event_t event) -{ - if(event == LV_EVENT_CLICKED) { - printf("Clicked\n"); - } -} -``` - -Learn more about the events in the [Event overview](https://docs.littlevgl.com/en/html/overview/event) section. - - -## Examples +- NXP: Kinetis, LPC, iMX, iMX RT +- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb) +- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl) +- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32) +- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix) +- Nordic NRF52 Bluetooth modules +- Quectel modems + +## Get started +This list shows the recommended way of learning the library: +1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes) +2. Read the [Introduction](https://docs.lvgl.io/latest/en/html/intro/index.html) page of the documentation (5 minutes) +3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html) page (15 minutes) +4. Set up a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) (10 minutes) +5. Try out some [Examples](https://github.com/lvgl/lv_examples/) +6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/latest/en/html/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=) +7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library (2-3 hours) +8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage +9. If you have questions go to the [Forum](http://forum.lvgl.io/) +10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes) + +## Examples + +For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository. ### Button with label ```c -lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/ +lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button to the current screen*/ lv_obj_set_pos(btn, 10, 10); /*Set its position*/ lv_obj_set_size(btn, 100, 50); /*Set its size*/ lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/ @@ -249,121 +139,10 @@ void btn_event_cb(lv_obj_t * btn, lv_event_t event) } } ``` -![LittlevGL button with label example](https://docs.littlevgl.com/en/misc/simple_button_example.gif) - -### Button with styles -Add styles to the previously button from the previous example -```c -static lv_style_t style_btn_rel; /*A variable to store the released style*/ -lv_style_copy(&style_btn_rel, &lv_style_plain); /*Initialize from a built-in style*/ -style_btn_rel.body.border.color = lv_color_hex3(0x269); -style_btn_rel.body.border.width = 1; -style_btn_rel.body.main_color = lv_color_hex3(0xADF); -style_btn_rel.body.grad_color = lv_color_hex3(0x46B); -style_btn_rel.body.shadow.width = 4; -style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM; -style_btn_rel.body.radius = LV_RADIUS_CIRCLE; -style_btn_rel.text.color = lv_color_hex3(0xDEF); - -static lv_style_t style_btn_pr; /*A variable to store the pressed style*/ -lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from the released style*/ -style_btn_pr.body.border.color = lv_color_hex3(0x46B); -style_btn_pr.body.main_color = lv_color_hex3(0x8BD); -style_btn_pr.body.grad_color = lv_color_hex3(0x24A); -style_btn_pr.body.shadow.width = 2; -style_btn_pr.text.color = lv_color_hex3(0xBCD); - -lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the button's released style*/ -lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the button's pressed style*/ -``` - -![Stylsd button is LittelvGL](https://docs.littlevgl.com/en/misc/button_style_example.gif) - -### Slider and object alignment -```c -lv_obj_t * label; - -... - -/* Create a slider in the center of the display */ -lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL); -lv_obj_set_width(slider, 200); /*Set the width*/ -lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/ -lv_obj_set_event_cb(slider, slider_event_cb); /*Assign an event function*/ - -/* Create a label below the slider */ -label = lv_label_create(lv_scr_act(), NULL); -lv_label_set_text(label, "0"); -lv_obj_set_auto_realign(slider, true); -lv_obj_align(label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); - -... +![LVGL button with label example](https://raw.githubusercontent.com/lvgl/docs/latest/misc/simple_button_example.gif) -void slider_event_cb(lv_obj_t * slider, lv_event_t event) -{ - if(event == LV_EVENT_VALUE_CHANGED) { - static char buf[4]; /* max 3 bytes for number plus 1 null terminating byte */ - snprintf(buf, 4, "%u", lv_slider_get_value(slider)); - lv_label_set_text(slider_label, buf); /*Refresh the text*/ - } -} -``` - -![Slider example with LittlevGL](https://docs.littlevgl.com/en/misc/slider_example.gif) - -### List and themes -```c -/*Texts of the list elements*/ -const char * txts[] = {"First", "Second", "Third", "Forth", "Fifth", "Sixth", NULL}; - -/* Initialize and set a theme. `LV_THEME_NIGHT` needs to enabled in lv_conf.h. */ -lv_theme_t * th = lv_theme_night_init(20, NULL); -lv_theme_set_current(th); - -/*Create a list*/ -lv_obj_t* list = lv_list_create(lv_scr_act(), NULL); -lv_obj_set_size(list, 120, 180); -lv_obj_set_pos(list, 10, 10); - -/*Add buttons*/ -uint8_t i; -for(i = 0; txts[i]; i++) { - lv_obj_t * btn = lv_list_add_btn(list, LV_SYMBOL_FILE, txts[i]); - lv_obj_set_event_cb(btn, list_event); /*Assign event function*/ - lv_btn_set_toggle(btn, true); /*Enable on/off states*/ -} - -/* Initialize and set an other theme. `LV_THEME_MATERIAL` needs to enabled in lv_conf.h. - * If `LV_TEHE_LIVE_UPDATE 1` then the previous list's style will be updated too.*/ -th = lv_theme_material_init(210, NULL); -lv_theme_set_current(th); - -/*Create an other list*/ -list = lv_list_create(lv_scr_act(), NULL); -lv_obj_set_size(list, 120, 180); -lv_obj_set_pos(list, 150, 10); - -/*Add buttons with the same texts*/ -for(i = 0; txts[i]; i++) { - lv_obj_t * btn = lv_list_add_btn(list, LV_SYMBOL_FILE, txts[i]); - lv_obj_set_event_cb(btn, list_event); - lv_btn_set_toggle(btn, true); -} - -... - -static void list_event(lv_obj_t * btn, lv_event_t e) -{ - if(e == LV_EVENT_CLICKED) { - printf("%s\n", lv_list_get_btn_text(btn)); - } - -} -``` -![List and theme example with LittlevGL](https://docs.littlevgl.com/en/misc/list_theme_example.gif) - -### Use LittlevGL from Micropython -Learn more about [Micropython](https://docs.littlevgl.com/en/html/get-started/micropython). +### LVGL from Micropython +Learn more about [Micropython](https://docs.lvgl.io/latest/en/html/get-started/micropython.html). ```python # Create a Button and a Label scr = lv.obj() @@ -377,22 +156,6 @@ lv.scr_load(scr) ``` ## Contributing -To ask questions please use the [Forum](https://forum.littlevgl.com). -For development-related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues). - -If you are interested in contributing to LittlevGL you can -- **Help others** in the [Forum](https://forum.littlevgl.com). -- **Inspire people** by speaking about your project in [My project](https://forum.littlevgl.com/c/my-projects) category in the Forum or add it to the [References](https://blog.littlevgl.com/2018-12-26/references) post -- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/littlevgl/docs) repository to learn more -- **Write a blog post** about your experiences. See how to do it in the [Blog](https://github.com/littlevgl/blog) repository -- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) -- **Help in the developement**. Check the [Open issues](https://github.com/littlevgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/littlevgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature. - -It should be useful to read the -- [Contributing guide](https://blog.littlevgl.com/2018-12-06/contributing) -- [Coding style guide](https://github.com/littlevgl/lvgl/blob/master/docs/CODING_STYLE.md) - -## Donate -If you are pleased with the library, found it useful, or you are happy with the support you got, please help its further development: +LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs to hosing your own project under in LVGL. -[![Donate](https://littlevgl.com/donate_dir/donate_btn.png)](https://littlevgl.com/donate) +For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation. diff --git a/src/libs/lvgl/component.mk b/src/libs/lvgl/component.mk new file mode 100644 index 00000000..0c8dbc53 --- /dev/null +++ b/src/libs/lvgl/component.mk @@ -0,0 +1,8 @@ +# ESP-IDF component file for make based commands + +ifdef $(IDF_VER) + +COMPONENT_SRCDIRS := . +COMPONENT_ADD_INCLUDEDIRS := . + +endif diff --git a/src/libs/lvgl/docs/CODING_STYLE.md b/src/libs/lvgl/docs/CODING_STYLE.md index 31071e94..46bc6375 100644 --- a/src/libs/lvgl/docs/CODING_STYLE.md +++ b/src/libs/lvgl/docs/CODING_STYLE.md @@ -1,6 +1,7 @@ +# Coding style ## File format -Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/littlevgl/lvgl/blob/master/src/lv_misc/lv_templ.h) +Use [lv_misc/lv_templ.c](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.h) ## Naming conventions * Words are separated by '_' @@ -10,22 +11,23 @@ Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/src/lv_mi * starts with *lv* * followed by module name: *btn*, *label*, *style* etc. * followed by the action (for functions): *set*, *get*, *refr* etc. - * closed with the subject: *name*, *size*, *state* etc. + * closed with the subject: *name*, *size*, *state* etc. * Typedefs * prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name` * always end `typedef struct` and `typedef enum` type names with `_t` * Abbreviations: - * Use abbreviations on public names only if they become longer than 32 characters - * Use only very straightforward (e.g. pos: position) or well-established (e.g. pr: press) abbreviations + * Only words longer or equal than 6 characters can be abbreviated. + * Abbreviate only if it makes the word at least half as long + * Use only very straightforward and well-known abbreviations (e.g. pos: position, def: default, btn: button) ## Coding guide * Functions: - * Try to write function shorter than is 50 lines - * Always shorter than 100 lines (except very straightforwards) + * Try to write function shorter than is 50 lines + * Always shorter than 200 lines (except very straightforwards) * Variables: * One line, one declaration (BAD: char x, y;) * Use `` (*uint8_t*, *int32_t* etc) - * Declare variables when needed (not all at function start) + * Declare variables where needed (not all at function start) * Use the smallest required scope * Variables in a file (outside functions) are always *static* * Do not use global variables (use functions to set/get static variables) @@ -39,16 +41,16 @@ Before every function have a comment like this: * @param obj pointer to an object * @return pointer to a screen */ -lv_obj_t * lv_obj_get_scr(lv_obj_t * obj); +lv_obj_t * lv_obj_get_scr(lv_obj_t * obj); ``` Always use `/* Something */` format and NOT `//Something` -Write readable code to avoid descriptive comments like: -`x++; /* Add 1 to x */`. +Write readable code to avoid descriptive comments like: +`x++; /* Add 1 to x */`. The code should show clearly what you are doing. -You should write **why** have you done this: +You should write **why** have you done this: `x++; /*Because of closing '\0' of the string */` Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/` @@ -65,30 +67,23 @@ Here is example to show bracket placing and using of white spaces: */ void lv_label_set_text(lv_obj_t * label, const char * text) { /* Main brackets of functions in new line*/ - + if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/ - + lv_obj_inv(label); - + lv_label_ext_t * ext = lv_obj_get_ext(label); /*Comment before a section */ if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/ lv_label_refr_text(label); - return; + return; } - + ... } ``` Use 4 spaces indentation instead of tab. -You can use **astyle** to format the code. The required config flies are: `docs/astyle_c` and `docs/astyle_h`. -To format the source files: - `$ find . -type f -name "*.c" | xargs astyle --options=docs/astyle_c` - -To format the header files: - `$ find . -type f -name "*.h" | xargs astyle --options=docs/astyle_h` - -Append `-n` to the end to skip creation of backup file OR use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups) +You can use **astyle** to format the code. Run `code-formatter.sh` from the `scrips` folder. diff --git a/src/libs/lvgl/docs/CONTRIBUTING.md b/src/libs/lvgl/docs/CONTRIBUTING.md index aa31870e..553cfa51 100644 --- a/src/libs/lvgl/docs/CONTRIBUTING.md +++ b/src/libs/lvgl/docs/CONTRIBUTING.md @@ -1,111 +1,5 @@ -# Contributing to Littlev Graphics Library +# Contributing to LVGL -**Do you have some free time to spend with programming? -Are you working on an Embedded GUI project with LittlevGL? -See how can you help to improve the graphics library!** +Thank you for considering contributing to LVGL. -There are many ways to join the community. If you have some time to work with us I'm sure you will find something that fits you! You can: -- help others in the [Forum](https://forum.littlevgl.com/) -- improve and/or translate the documentation -- write a blog post about your experiences -- report and/or fix bugs -- suggest and/or implement new features - -But first, start with the most Frequently Asked Questions. - -# FAQ about contributing - -## Where can I write my question and remarks? - -We use the [Forum](https://forum.littlevgl.com/) to ask and answer questions and [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) for development-related discussion. - -But there are some simple rules: -- Be kind and friendly. -- Speak about one thing in one issue/topic. -- Give feedback and close the issue or mark the topic as solved if your question is answered. -- Tell what you experience or expect. _"The button is not working"_ is not enough info to get help. -- If possible send an absolute minimal code example in order to reproduce the issue -- Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format your post. - -## How can I send fixes and improvements? - -Merging new code happens via Pull Requests. If you are still not familiar with the Pull Requests (PR for short) here is a quick guide: -1. **Fork** the [lvgl repository](https://github.com/littlevgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`) -2. **Clone** the forked repository and add your changes -3. **Create a PR** on GitHub from the page of your `lvgl` repository (`https://github.com/your_name/lvgl`) by hitting the "New pull request" button -4. **Set the base branch**. It means where you want to merge your update. Fixes go to `master`, new features to the actual `dev-x.y` branch. -5. **Describe** what is in the update. An example code is welcome if applicable. - -Some advice: -- If you are not sure about your fix or feature it's better to open an issue first and discuss the details there. -- Maybe your fix or update won't be perfect at first. Don't be afraid, just improve it and push the new commits. The PR will be updated accordingly. -- If your update needs some extra work it's okay to say: _"I'm busy now and I will improve it soon"_ or _"Sorry, I don't have time to improve it, I hope it helps in this form too"_. -So it's better to say don't have time to continue than saying nothing. -- Please read and follow this [guide about the coding style](https://github.com/littlevgl/lvgl/blob/master/docs/CODING_STYLE.md) - - -## Where is the documentation? - -You can read the documentation here: -You can edit the documentation here: - -## Where is the blog? - -You can read the blog here: -You can edit the blog here: - -# So how and where can you contribute? - -## Help others in the Forum - -It's a great way to contribute to the library if you already use it. -Just go to [https://forum.littlevgl.com/](https://forum.littlevgl.com/) a register (Google and GitHub login also works). -Log in, read the titles and if you are already familiar with a topic, don't be shy, and write your suggestion. - -## Improving and/or translating the documentation - -If you would like to contribute to LittlevGL the documentation is the best place to start. - -### Fix typos, add missing parts - -If you find a typo, an obscure sentence or something which is not explained well enough in the [English documentation](https://docs.littlevgl.com/en/html/index.html) -click the *"Edit on GitHub"* button in the top right corner and fix the issue by sending a Pull Request. - -### Translate the documentation - -If you have time and interest you can translate the documentation to your native language or any language you speak. -You can join others to work on an already existing language or you can start a new one. - -To translate the documentation we use [Zanata](https://zanata.org) which is an online translation platform. -You will find the LittlevGL project here: [LittlevGL on Zanata](https://translate.zanata.org/iteration/view/littlevgl-docs/v6.0-doc1?dswid=3430) - -To get started you need to: -- register at [Zanata](https://zanata.org) which is an online translation platform. -- comment to [this post](https://forum.littlevgl.com/t/translate-the-documentation/238?u=kisvegabor) -- tell your username at *Zanata* and your selected language(s) to get permission the edit the translations - -Note that a translation will be added to the documentation only if at least the [Porting section](https://docs.littlevgl.com/en/html/porting/index.html) is translated. - - -## Writing a blog post about your experiences - -Have you ported LittlevGL to a new platform? Have you created a fancy GUI? Do you know a great trick? -You can share your knowledge on LittlevGL's blog! It's super easy to add your own post: -- Fork and clone the [blog repository](https://github.com/littlevgl/blog) -- Add your post in Markdown to the `_posts` folder. -- Store the images and other resources in a dedicated folder in `assets` -- Create a Pull Request - -The blog uses [Jekyll](https://jekyllrb.com/) to convert the `.md` files to a webpage. You can easily [run Jekyll offline](https://jekyllrb.com/docs/) to check your post before creating the Pull request - -## Reporting and/or fixing bugs -For simple bugfixes (typos, missing error handling, fixing a warning) is fine to send a Pull request directly. However, for more complex bugs it's better to open an issue first. In the issue, you should describe how to reproduce the bug and even add the minimal code snippet. - -## Suggesting and/or implementing new features -If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LittlevGL well enough. We will help you to get started. - -During the implementation don't forget the [Code style guide](https://github.com/littlevgl/lvgl/blob/master/docs/CODING_STYLE.md). - -# Summary - -I hope you have taken a liking to contribute to LittlevGL. A helpful and friendly community is waiting for you! :) +For a detailed description of contribution opportunities, please visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation. diff --git a/src/libs/lvgl/docs/ROADMAP.md b/src/libs/lvgl/docs/ROADMAP.md new file mode 100644 index 00000000..a606894f --- /dev/null +++ b/src/libs/lvgl/docs/ROADMAP.md @@ -0,0 +1,63 @@ +# Roadmap + +This is a summary for thenew fatures of the major releases and a collection of ideas. + +This list indicates only the current intention and can be changed. + +## v8 +Planned to November/December 2020 +- Create an `lv_components` repository for compley widgets + - It makes the core LVGL leaner + - In `lv_components` we can have a lot and specific widgets + - Good place for contribution +- New scrolling: + - See [feat/new-scroll](https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue. + - Remove `lv_page` and support scrolling on `lv_obj` + - Support "elastic" scrolling when scrolled in + - Support scroll chaining among any objects types (not only `lv_pages`s) + - Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING` + - Add snapping + - Add snap stop to scroll max 1 snap point + - Already working +- New layouts: + - See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue + - [CSS Grid](https://css-tricks.com/snippets/css/a-guide-to-grid/)-like layout support + - [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support + - Remove `lv_cont` and support layouts on `lv_obj` +- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier + - Work in progress +- Remove the align parameter from `lv_canvas_draw_text` +- Make the copy parameter obsolate in create functions +- Optimize and simplifie styles [#1832](https://github.com/lvgl/lvgl/issues/1832) +- Use a more generic inheritenace [#1919](https://github.com/lvgl/lvgl/issues/1919) + +## v8.x +- Add radio button widget +- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658) +- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660) +- chart: pre-delete `X` pint after the lastly set +- chart: autoscroll to the right + +## v9 +- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3). +- Consider direct binary font format support +- Optimize line and circle drawing and masking +- Reconsider color format management for run time color format setting, and custom color format usage. (Also [RGB888](https://github.com/lvgl/lvgl/issues/1722)) +- 9-patch support for `lv_imgbtn`. +- Handle stride. See [#1858](https://github.com/lvgl/lvgl/issues/1858) +- Make gradients more versatile +- Make image transformations more versatile +- Allow snapshoting object to tranfrom them to images + +## Ideas +- Use [generate-changelog](https://github.com/lob/generate-changelog) to automatically generate changelog +- lv_mem_alloc_aligned(size, align) +- Text node. See [#1701](https://github.com/lvgl/lvgl/issues/1701#issuecomment-699479408) +- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736) +- Optimize font decompression +- Switch to RGBA colors in styles +- Need coverage report for tests +- Need static analyze (via coverity.io or somehing else) +- Support dot_begin and dot_middle long modes for labels +- Add new label alignment modes. [#1656](https://github.com/lvgl/lvgl/issues/1656) +- Support larger images: [#1892](https://github.com/lvgl/lvgl/issues/1892) diff --git a/src/libs/lvgl/examples/LVGL_Arduino.ino b/src/libs/lvgl/examples/LVGL_Arduino.ino new file mode 100644 index 00000000..6e76e15d --- /dev/null +++ b/src/libs/lvgl/examples/LVGL_Arduino.ino @@ -0,0 +1,102 @@ +#include +#include + +TFT_eSPI tft = TFT_eSPI(); /* TFT instance */ +static lv_disp_buf_t disp_buf; +static lv_color_t buf[LV_HOR_RES_MAX * 10]; + +#if USE_LV_LOG != 0 +/* Serial debugging */ +void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc) +{ + + Serial.printf("%s@%d->%s\r\n", file, line, dsc); + Serial.flush(); +} +#endif + +/* Display flushing */ +void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) +{ + uint32_t w = (area->x2 - area->x1 + 1); + uint32_t h = (area->y2 - area->y1 + 1); + + tft.startWrite(); + tft.setAddrWindow(area->x1, area->y1, w, h); + tft.pushColors(&color_p->full, w * h, true); + tft.endWrite(); + + lv_disp_flush_ready(disp); +} + +/*Read the touchpad*/ +bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) +{ + uint16_t touchX, touchY; + + bool touched = tft.getTouch(&touchX, &touchY, 600); + + if(!touched) { + data->state = LV_INDEV_STATE_REL; + } else { + data->state = LV_INDEV_STATE_PR; + + /*Set the coordinates*/ + data->point.x = touchX; + data->point.y = touchY; + + Serial.print("Data x"); + Serial.println(touchX); + + Serial.print("Data y"); + Serial.println(touchY); + } + + return false; /*Return `false` because we are not buffering and no more data to read*/ +} + +void setup() +{ + Serial.begin(115200); /* prepare for possible serial debug */ + + lv_init(); + +#if USE_LV_LOG != 0 + lv_log_register_print_cb(my_print); /* register print function for debugging */ +#endif + + tft.begin(); /* TFT init */ + tft.setRotation(1); /* Landscape orientation */ + + uint16_t calData[5] = { 275, 3620, 264, 3532, 1 }; + tft.setTouch(calData); + + lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); + + /*Initialize the display*/ + lv_disp_drv_t disp_drv; + lv_disp_drv_init(&disp_drv); + disp_drv.hor_res = 320; + disp_drv.ver_res = 240; + disp_drv.flush_cb = my_disp_flush; + disp_drv.buffer = &disp_buf; + lv_disp_drv_register(&disp_drv); + + /*Initialize the (dummy) input device driver*/ + lv_indev_drv_t indev_drv; + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_POINTER; + indev_drv.read_cb = my_touchpad_read; + lv_indev_drv_register(&indev_drv); + + /* Try an example from the lv_examples repository + * https://github.com/lvgl/lv_examples*/ + lv_ex_btn_1(); +} + +void loop() +{ + + lv_task_handler(); /* let the GUI do its work */ + delay(5); +} diff --git a/src/libs/lvgl/examples/porting/lv_port_disp_template.c b/src/libs/lvgl/examples/porting/lv_port_disp_template.c new file mode 100644 index 00000000..a4f95fab --- /dev/null +++ b/src/libs/lvgl/examples/porting/lv_port_disp_template.c @@ -0,0 +1,196 @@ +/** + * @file lv_port_disp_templ.c + * + */ + + /*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/ +#if 0 + +/********************* + * INCLUDES + *********************/ +#include "lv_port_disp_template.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void disp_init(void); + +static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p); +#if LV_USE_GPU +static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); +static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, + const lv_area_t * fill_area, lv_color_t color); +#endif + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void lv_port_disp_init(void) +{ + /*------------------------- + * Initialize your display + * -----------------------*/ + disp_init(); + + /*----------------------------- + * Create a buffer for drawing + *----------------------------*/ + + /* LVGL requires a buffer where it internally draws the widgets. + * Later this buffer will passed your display drivers `flush_cb` to copy its content to your display. + * The buffer has to be greater than 1 display row + * + * There are three buffering configurations: + * 1. Create ONE buffer with some rows: + * LVGL will draw the display's content here and writes it to your display + * + * 2. Create TWO buffer with some rows: + * LVGL will draw the display's content to a buffer and writes it your display. + * You should use DMA to write the buffer's content to the display. + * It will enable LVGL to draw the next part of the screen to the other buffer while + * the data is being sent form the first buffer. It makes rendering and flushing parallel. + * + * 3. Create TWO screen-sized buffer: + * Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the + * whole frame to display. This way you only need to change the frame buffer's address instead of + * copying the pixels. + * */ + + /* Example for 1) */ + static lv_disp_buf_t draw_buf_dsc_1; + static lv_color_t draw_buf_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/ + lv_disp_buf_init(&draw_buf_dsc_1, draw_buf_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/ + + /* Example for 2) */ + static lv_disp_buf_t draw_buf_dsc_2; + static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/ + static lv_color_t draw_buf_2_1[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/ + lv_disp_buf_init(&draw_buf_dsc_2, draw_buf_2_1, draw_buf_2_1, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/ + + /* Example for 3) */ + static lv_disp_buf_t draw_buf_dsc_3; + static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/ + static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/ + lv_disp_buf_init(&draw_buf_dsc_3, draw_buf_3_1, draw_buf_3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/ + + /*----------------------------------- + * Register the display in LVGL + *----------------------------------*/ + + lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/ + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + + /*Set up the functions to access to your display*/ + + /*Set the resolution of the display*/ + disp_drv.hor_res = 480; + disp_drv.ver_res = 320; + + /*Used to copy the buffer's content to the display*/ + disp_drv.flush_cb = disp_flush; + + /*Set a display buffer*/ + disp_drv.buffer = &draw_buf_dsc_1; + +#if LV_USE_GPU + /*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/ + + /*Blend two color array using opacity*/ + disp_drv.gpu_blend_cb = gpu_blend; + + /*Fill a memory array with a color*/ + disp_drv.gpu_fill_cb = gpu_fill; +#endif + + /*Finally register the driver*/ + lv_disp_drv_register(&disp_drv); +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/* Initialize your display and the required peripherals. */ +static void disp_init(void) +{ + /*You code here*/ +} + +/* Flush the content of the internal buffer the specific area on the display + * You can use DMA or any hardware acceleration to do this operation in the background but + * 'lv_disp_flush_ready()' has to be called when finished. */ +static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) +{ + /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/ + + int32_t x; + int32_t y; + for(y = area->y1; y <= area->y2; y++) { + for(x = area->x1; x <= area->x2; x++) { + /* Put a pixel to the display. For example: */ + /* put_px(x, y, *color_p)*/ + color_p++; + } + } + + /* IMPORTANT!!! + * Inform the graphics library that you are ready with the flushing*/ + lv_disp_flush_ready(disp_drv); +} + +/*OPTIONAL: GPU INTERFACE*/ +#if LV_USE_GPU + +/* If your MCU has hardware accelerator (GPU) then you can use it to blend to memories using opacity + * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/ +static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa) +{ + /*It's an example code which should be done by your GPU*/ + uint32_t i; + for(i = 0; i < length; i++) { + dest[i] = lv_color_mix(dest[i], src[i], opa); + } +} + +/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color + * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/ +static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, + const lv_area_t * fill_area, lv_color_t color) +{ + /*It's an example code which should be done by your GPU*/ + int32_t x, y; + dest_buf += dest_width * fill_area->y1; /*Go to the first line*/ + + for(y = fill_area->y1; y <= fill_area->y2; y++) { + for(x = fill_area->x1; x <= fill_area->x2; x++) { + dest_buf[x] = color; + } + dest_buf+=dest_width; /*Go to the next line*/ + } +} + +#endif /*LV_USE_GPU*/ + +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; +#endif diff --git a/src/libs/lvgl/examples/porting/lv_port_disp_template.h b/src/libs/lvgl/examples/porting/lv_port_disp_template.h new file mode 100644 index 00000000..93e51cc2 --- /dev/null +++ b/src/libs/lvgl/examples/porting/lv_port_disp_template.h @@ -0,0 +1,43 @@ +/** + * @file lv_port_disp_templ.h + * + */ + + /*Copy this file as "lv_port_disp.h" and set this value to "1" to enable content*/ +#if 0 + +#ifndef LV_PORT_DISP_TEMPL_H +#define LV_PORT_DISP_TEMPL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lvgl.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_PORT_DISP_TEMPL_H*/ + +#endif /*Disable/Enable content*/ diff --git a/src/libs/lvgl/examples/porting/lv_port_fs_template.c b/src/libs/lvgl/examples/porting/lv_port_fs_template.c new file mode 100644 index 00000000..c8f5fe21 --- /dev/null +++ b/src/libs/lvgl/examples/porting/lv_port_fs_template.c @@ -0,0 +1,377 @@ +/** + * @file lv_port_fs_templ.c + * + */ + + /*Copy this file as "lv_port_fs.c" and set this value to "1" to enable content*/ +#if 0 + +/********************* + * INCLUDES + *********************/ +#include "lv_port_fs_template.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/* Create a type to store the required data about your file. + * If you are using a File System library + * it already should have a File type. + * For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/ +typedef struct { + /*Add the data you need to store about a file*/ + uint32_t dummy1; + uint32_t dummy2; +}file_t; + +/*Similarly to `file_t` create a type for directory reading too */ +typedef struct { + /*Add the data you need to store about directory reading*/ + uint32_t dummy1; + uint32_t dummy2; +}dir_t; + +/********************** + * STATIC PROTOTYPES + **********************/ +static void fs_init(void); + +static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode); +static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p); +static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); +static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw); +static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos); +static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p); +static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); +static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path); +static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p); +static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname); +static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p); +static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path); +static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn); +static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p); + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void lv_port_fs_init(void) +{ + /*---------------------------------------------------- + * Initialize your storage device and File System + * -------------------------------------------------*/ + fs_init(); + + /*--------------------------------------------------- + * Register the file system interface in LVGL + *--------------------------------------------------*/ + + /* Add a simple drive to open images */ + lv_fs_drv_t fs_drv; + lv_fs_drv_init(&fs_drv); + + /*Set up fields...*/ + fs_drv.file_size = sizeof(file_t); + fs_drv.letter = 'P'; + fs_drv.open_cb = fs_open; + fs_drv.close_cb = fs_close; + fs_drv.read_cb = fs_read; + fs_drv.write_cb = fs_write; + fs_drv.seek_cb = fs_seek; + fs_drv.tell_cb = fs_tell; + fs_drv.free_space_cb = fs_free; + fs_drv.size_cb = fs_size; + fs_drv.remove_cb = fs_remove; + fs_drv.rename_cb = fs_rename; + fs_drv.trunc_cb = fs_trunc; + + fs_drv.rddir_size = sizeof(dir_t); + fs_drv.dir_close_cb = fs_dir_close; + fs_drv.dir_open_cb = fs_dir_open; + fs_drv.dir_read_cb = fs_dir_read; + + lv_fs_drv_register(&fs_drv); +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/* Initialize your Storage device and File system. */ +static void fs_init(void) +{ + /*E.g. for FatFS initialize the SD card and FatFS itself*/ + + /*You code here*/ +} + +/** + * Open a file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable + * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) + * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + if(mode == LV_FS_MODE_WR) + { + /*Open a file for write*/ + + /* Add your code here*/ + } + else if(mode == LV_FS_MODE_RD) + { + /*Open a file for read*/ + + /* Add your code here*/ + } + else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) + { + /*Open a file for read and write*/ + + /* Add your code here*/ + } + + return res; +} + +/** + * Close an opened file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. (opened with lv_ufs_open) + * @return LV_FS_RES_OK: no error, the file is read + * any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Read data from an opened file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. + * @param buf pointer to a memory block where to store the read data + * @param btr number of Bytes To Read + * @param br the real number of read bytes (Byte Read) + * @return LV_FS_RES_OK: no error, the file is read + * any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Write into a file + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable + * @param buf pointer to a buffer with the bytes to write + * @param btr Bytes To Write + * @param br the number of real written bytes (Bytes Written). NULL if unused. + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Set the read write pointer. Also expand the file size if necessary. + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. (opened with lv_ufs_open ) + * @param pos the new position of read write pointer + * @return LV_FS_RES_OK: no error, the file is read + * any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Give the size of a file bytes + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable + * @param size pointer to a variable to store the size + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} +/** + * Give the position of the read write pointer + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to a file_t variable. + * @param pos_p pointer to to store the result + * @return LV_FS_RES_OK: no error, the file is read + * any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Delete a file + * @param drv pointer to a driver where this function belongs + * @param path path of the file to delete + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Truncate the file size to the current position of the read write pointer + * @param drv pointer to a driver where this function belongs + * @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open ) + * @return LV_FS_RES_OK: no error, the file is read + * any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Rename a file + * @param drv pointer to a driver where this function belongs + * @param oldname path to the file + * @param newname path with the new name + * @return LV_FS_RES_OK or any error from 'fs_res_t' + */ +static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Get the free and total size of a driver in kB + * @param drv pointer to a driver where this function belongs + * @param letter the driver letter + * @param total_p pointer to store the total size [kB] + * @param free_p pointer to store the free size [kB] + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Initialize a 'lv_fs_dir_t' variable for directory reading + * @param drv pointer to a driver where this function belongs + * @param rddir_p pointer to a 'lv_fs_dir_t' variable + * @param path path to a directory + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Read the next filename form a directory. + * The name of the directories will begin with '/' + * @param drv pointer to a driver where this function belongs + * @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable + * @param fn pointer to a buffer to store the filename + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +/** + * Close the directory reading + * @param drv pointer to a driver where this function belongs + * @param rddir_p pointer to an initialized 'lv_fs_dir_t' variable + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + */ +static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p) +{ + lv_fs_res_t res = LV_FS_RES_NOT_IMP; + + /* Add your code here*/ + + return res; +} + +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; +#endif diff --git a/src/libs/lvgl/examples/porting/lv_port_fs_template.h b/src/libs/lvgl/examples/porting/lv_port_fs_template.h new file mode 100644 index 00000000..d18f736f --- /dev/null +++ b/src/libs/lvgl/examples/porting/lv_port_fs_template.h @@ -0,0 +1,43 @@ +/** + * @file lv_port_fs_templ.h + * + */ + + /*Copy this file as "lv_port_fs.h" and set this value to "1" to enable content*/ +#if 0 + +#ifndef LV_PORT_FS_TEMPL_H +#define LV_PORT_FS_TEMPL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lvgl.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_PORT_FS_TEMPL_H*/ + +#endif /*Disable/Enable content*/ diff --git a/src/libs/lvgl/examples/porting/lv_port_indev_template.c b/src/libs/lvgl/examples/porting/lv_port_indev_template.c new file mode 100644 index 00000000..98788da4 --- /dev/null +++ b/src/libs/lvgl/examples/porting/lv_port_indev_template.c @@ -0,0 +1,423 @@ +/** + * @file lv_port_indev_templ.c + * + */ + + /*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/ +#if 0 + +/********************* + * INCLUDES + *********************/ +#include "lv_port_indev_template.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ + +static void touchpad_init(void); +static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); +static bool touchpad_is_pressed(void); +static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y); + +static void mouse_init(void); +static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); +static bool mouse_is_pressed(void); +static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y); + +static void keypad_init(void); +static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); +static uint32_t keypad_get_key(void); + +static void encoder_init(void); +static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); +static void encoder_handler(void); + +static void button_init(void); +static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); +static int8_t button_get_pressed_id(void); +static bool button_is_pressed(uint8_t id); + +/********************** + * STATIC VARIABLES + **********************/ +lv_indev_t * indev_touchpad; +lv_indev_t * indev_mouse; +lv_indev_t * indev_keypad; +lv_indev_t * indev_encoder; +lv_indev_t * indev_button; + +static int32_t encoder_diff; +static lv_indev_state_t encoder_state; + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void lv_port_indev_init(void) +{ + /* Here you will find example implementation of input devices supported by LittelvGL: + * - Touchpad + * - Mouse (with cursor support) + * - Keypad (supports GUI usage only with key) + * - Encoder (supports GUI usage only with: left, right, push) + * - Button (external buttons to press points on the screen) + * + * The `..._read()` function are only examples. + * You should shape them according to your hardware + */ + + lv_indev_drv_t indev_drv; + + /*------------------ + * Touchpad + * -----------------*/ + + /*Initialize your touchpad if you have*/ + touchpad_init(); + + /*Register a touchpad input device*/ + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_POINTER; + indev_drv.read_cb = touchpad_read; + indev_touchpad = lv_indev_drv_register(&indev_drv); + + /*------------------ + * Mouse + * -----------------*/ + + /*Initialize your touchpad if you have*/ + mouse_init(); + + /*Register a mouse input device*/ + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_POINTER; + indev_drv.read_cb = mouse_read; + indev_mouse = lv_indev_drv_register(&indev_drv); + + /*Set cursor. For simplicity set a HOME symbol now.*/ + lv_obj_t * mouse_cursor = lv_img_create(lv_disp_get_scr_act(NULL), NULL); + lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME); + lv_indev_set_cursor(indev_mouse, mouse_cursor); + + /*------------------ + * Keypad + * -----------------*/ + + /*Initialize your keypad or keyboard if you have*/ + keypad_init(); + + /*Register a keypad input device*/ + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_KEYPAD; + indev_drv.read_cb = keypad_read; + indev_keypad = lv_indev_drv_register(&indev_drv); + + /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`, + * add objects to the group with `lv_group_add_obj(group, obj)` + * and assign this input device to group to navigate in it: + * `lv_indev_set_group(indev_keypad, group);` */ + + /*------------------ + * Encoder + * -----------------*/ + + /*Initialize your encoder if you have*/ + encoder_init(); + + /*Register a encoder input device*/ + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_ENCODER; + indev_drv.read_cb = encoder_read; + indev_encoder = lv_indev_drv_register(&indev_drv); + + /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`, + * add objects to the group with `lv_group_add_obj(group, obj)` + * and assign this input device to group to navigate in it: + * `lv_indev_set_group(indev_encoder, group);` */ + + /*------------------ + * Button + * -----------------*/ + + /*Initialize your button if you have*/ + button_init(); + + /*Register a button input device*/ + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_BUTTON; + indev_drv.read_cb = button_read; + indev_button = lv_indev_drv_register(&indev_drv); + + /*Assign buttons to points on the screen*/ + static const lv_point_t btn_points[2] = { + {10, 10}, /*Button 0 -> x:10; y:10*/ + {40, 100}, /*Button 1 -> x:40; y:100*/ + }; + lv_indev_set_button_points(indev_button, btn_points); +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/*------------------ + * Touchpad + * -----------------*/ + +/*Initialize your touchpad*/ +static void touchpad_init(void) +{ + /*Your code comes here*/ +} + +/* Will be called by the library to read the touchpad */ +static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) +{ + static lv_coord_t last_x = 0; + static lv_coord_t last_y = 0; + + /*Save the pressed coordinates and the state*/ + if(touchpad_is_pressed()) { + touchpad_get_xy(&last_x, &last_y); + data->state = LV_INDEV_STATE_PR; + } else { + data->state = LV_INDEV_STATE_REL; + } + + /*Set the last pressed coordinates*/ + data->point.x = last_x; + data->point.y = last_y; + + /*Return `false` because we are not buffering and no more data to read*/ + return false; +} + +/*Return true is the touchpad is pressed*/ +static bool touchpad_is_pressed(void) +{ + /*Your code comes here*/ + + return false; +} + +/*Get the x and y coordinates if the touchpad is pressed*/ +static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y) +{ + /*Your code comes here*/ + + (*x) = 0; + (*y) = 0; +} + +/*------------------ + * Mouse + * -----------------*/ + +/* Initialize your mouse */ +static void mouse_init(void) +{ + /*Your code comes here*/ +} + +/* Will be called by the library to read the mouse */ +static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) +{ + /*Get the current x and y coordinates*/ + mouse_get_xy(&data->point.x, &data->point.y); + + /*Get whether the mouse button is pressed or released*/ + if(mouse_is_pressed()) { + data->state = LV_INDEV_STATE_PR; + } else { + data->state = LV_INDEV_STATE_REL; + } + + /*Return `false` because we are not buffering and no more data to read*/ + return false; +} + +/*Return true is the mouse button is pressed*/ +static bool mouse_is_pressed(void) +{ + /*Your code comes here*/ + + return false; +} + +/*Get the x and y coordinates if the mouse is pressed*/ +static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y) +{ + /*Your code comes here*/ + + (*x) = 0; + (*y) = 0; +} + +/*------------------ + * Keypad + * -----------------*/ + +/* Initialize your keypad */ +static void keypad_init(void) +{ + /*Your code comes here*/ +} + +/* Will be called by the library to read the mouse */ +static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) +{ + static uint32_t last_key = 0; + + /*Get the current x and y coordinates*/ + mouse_get_xy(&data->point.x, &data->point.y); + + /*Get whether the a key is pressed and save the pressed key*/ + uint32_t act_key = keypad_get_key(); + if(act_key != 0) { + data->state = LV_INDEV_STATE_PR; + + /*Translate the keys to LVGL control characters according to your key definitions*/ + switch(act_key) { + case 1: + act_key = LV_KEY_NEXT; + break; + case 2: + act_key = LV_KEY_PREV; + break; + case 3: + act_key = LV_KEY_LEFT; + break; + case 4: + act_key = LV_KEY_RIGHT; + break; + case 5: + act_key = LV_KEY_ENTER; + break; + } + + last_key = act_key; + } else { + data->state = LV_INDEV_STATE_REL; + } + + data->key = last_key; + + /*Return `false` because we are not buffering and no more data to read*/ + return false; +} + +/*Get the currently being pressed key. 0 if no key is pressed*/ +static uint32_t keypad_get_key(void) +{ + /*Your code comes here*/ + + return 0; +} + +/*------------------ + * Encoder + * -----------------*/ + +/* Initialize your keypad */ +static void encoder_init(void) +{ + /*Your code comes here*/ +} + +/* Will be called by the library to read the encoder */ +static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) +{ + + data->enc_diff = encoder_diff; + data->state = encoder_state; + + /*Return `false` because we are not buffering and no more data to read*/ + return false; +} + +/*Call this function in an interrupt to process encoder events (turn, press)*/ +static void encoder_handler(void) +{ + /*Your code comes here*/ + + encoder_diff += 0; + encoder_state = LV_INDEV_STATE_REL; +} + +/*------------------ + * Button + * -----------------*/ + +/* Initialize your buttons */ +static void button_init(void) +{ + /*Your code comes here*/ +} + +/* Will be called by the library to read the button */ +static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) +{ + + static uint8_t last_btn = 0; + + /*Get the pressed button's ID*/ + int8_t btn_act = button_get_pressed_id(); + + if(btn_act >= 0) { + data->state = LV_INDEV_STATE_PR; + last_btn = btn_act; + } else { + data->state = LV_INDEV_STATE_REL; + } + + /*Save the last pressed button's ID*/ + data->btn_id = last_btn; + + /*Return `false` because we are not buffering and no more data to read*/ + return false; +} + +/*Get ID (0, 1, 2 ..) of the pressed button*/ +static int8_t button_get_pressed_id(void) +{ + uint8_t i; + + /*Check to buttons see which is being pressed (assume there are 2 buttons)*/ + for(i = 0; i < 2; i++) { + /*Return the pressed button's ID*/ + if(button_is_pressed(i)) { + return i; + } + } + + /*No button pressed*/ + return -1; +} + +/*Test if `id` button is pressed or not*/ +static bool button_is_pressed(uint8_t id) +{ + + /*Your code comes here*/ + + return false; +} + +#else /* Enable this file at the top */ + +/* This dummy typedef exists purely to silence -Wpedantic. */ +typedef int keep_pedantic_happy; +#endif diff --git a/src/libs/lvgl/examples/porting/lv_port_indev_template.h b/src/libs/lvgl/examples/porting/lv_port_indev_template.h new file mode 100644 index 00000000..b235d309 --- /dev/null +++ b/src/libs/lvgl/examples/porting/lv_port_indev_template.h @@ -0,0 +1,44 @@ + +/** + * @file lv_port_indev_templ.h + * + */ + + /*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/ +#if 0 + +#ifndef LV_PORT_INDEV_TEMPL_H +#define LV_PORT_INDEV_TEMPL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "lvgl/lvgl.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_PORT_INDEV_TEMPL_H*/ + +#endif /*Disable/Enable content*/ diff --git a/src/libs/lvgl/library.json b/src/libs/lvgl/library.json index d8b0bf76..a41b15c6 100644 --- a/src/libs/lvgl/library.json +++ b/src/libs/lvgl/library.json @@ -1,14 +1,17 @@ { - "name": "lvgl", - "version": "v6.1.2", - "keywords": "graphics, gui, embedded, littlevgl", - "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", - "repository": - { - "type": "git", - "url": "https://github.com/littlevgl/lvgl.git" - }, - "build": { - "includeDir": "." - } + "name": "lvgl", + "version": "7.11.0", + "keywords": "graphics, gui, embedded, tft, lvgl", + "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", + "repository": { + "type": "git", + "url": "https://github.com/lvgl/lvgl.git" + }, + "build": { + "includeDir": "." + }, + "license": "MIT", + "homepage": "https://lvgl.io", + "frameworks": "*", + "platforms": "*" } diff --git a/src/libs/lvgl/library.properties b/src/libs/lvgl/library.properties new file mode 100644 index 00000000..37d5c06e --- /dev/null +++ b/src/libs/lvgl/library.properties @@ -0,0 +1,10 @@ +name=lvgl +version=7.11.0 +author=kisvegabor +maintainer=kisvegabor,embeddedt,pete-pjb +sentence=Full-featured Graphics Library for Embedded Systems +paragraph=Powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash). +category=Display +url=https://lvgl.io +architectures=* +includes=lvgl.h diff --git a/src/libs/lvgl/lv_conf_template.h b/src/libs/lvgl/lv_conf_template.h index 77b97b11..dc1881bf 100644 --- a/src/libs/lvgl/lv_conf_template.h +++ b/src/libs/lvgl/lv_conf_template.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * + * Configuration file for v7.10.1 */ /* @@ -25,7 +25,7 @@ /* Color depth: * - 1: 1 byte per pixel - * - 8: RGB233 + * - 8: RGB332 * - 16: RGB565 * - 32: ARGB8888 */ @@ -43,9 +43,6 @@ /*Images pixels with this color will not be drawn (with chroma keying)*/ #define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ -/* Enable chroma keying for indexed images. */ -#define LV_INDEXED_CHROMA 1 - /* Enable anti-aliasing (lines, and radiuses will be smoothed) */ #define LV_ANTIALIAS 1 @@ -56,11 +53,25 @@ /* Dot Per Inch: used to initialize default sizes. * E.g. a button with width = LV_DPI / 2 -> half inch wide * (Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI 100 /*[px]*/ +#define LV_DPI 130 /*[px]*/ + +/* The the real width of the display changes some default values: + * default object sizes, layout of examples, etc. + * According to the width of the display (hor. res. / dpi) + * the displays fall in 4 categories. + * The 4th is extra large which has no upper limit so not listed here + * The upper limit of the categories are set below in 0.1 inch unit. + */ +#define LV_DISP_SMALL_LIMIT 30 +#define LV_DISP_MEDIUM_LIMIT 50 +#define LV_DISP_LARGE_LIMIT 70 /* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ typedef int16_t lv_coord_t; +/* Maximum buffer size to allocate for rotation. Only used if software rotation is enabled. */ +#define LV_DISP_ROT_MAX_BUF (10U * 1024U) + /*========================= Memory manager settings *=========================*/ @@ -74,7 +85,7 @@ typedef int16_t lv_coord_t; /* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ # define LV_MEM_SIZE (32U * 1024U) -/* Complier prefix for a big array declaration */ +/* Compiler prefix for a big array declaration */ # define LV_MEM_ATTR /* Set an address for the memory pool instead of allocating it as an array. @@ -89,6 +100,10 @@ typedef int16_t lv_coord_t; # define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ #endif /*LV_MEM_CUSTOM*/ +/* Use the standard memcpy and memset instead of LVGL's own functions. + * The standard functions might or might not be faster depending on their implementation. */ +#define LV_MEMCPY_MEMSET_STD 0 + /* Garbage Collector settings * Used if lvgl is binded to higher level language and the memory is managed by that language */ #define LV_ENABLE_GC 0 @@ -112,16 +127,22 @@ typedef int16_t lv_coord_t; #define LV_INDEV_DEF_DRAG_LIMIT 10 /* Drag throw slow-down in [%]. Greater value -> faster slow-down */ -#define LV_INDEV_DEF_DRAG_THROW 20 +#define LV_INDEV_DEF_DRAG_THROW 10 /* Long press time in milliseconds. - * Time to send `LV_EVENT_LONG_PRESSSED`) */ + * Time to send `LV_EVENT_LONG_PRESSED`) */ #define LV_INDEV_DEF_LONG_PRESS_TIME 400 /* Repeated trigger period in long press [ms] * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ #define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 +/* Gesture threshold in pixels */ +#define LV_INDEV_DEF_GESTURE_LIMIT 50 + +/* Gesture min velocity at release before swipe (pixels)*/ +#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3 + /*================== * Feature usage *==================*/ @@ -135,8 +156,33 @@ typedef void * lv_anim_user_data_t; #endif -/* 1: Enable shadow drawing*/ +/* 1: Enable shadow drawing on rectangles*/ #define LV_USE_SHADOW 1 +#if LV_USE_SHADOW +/* Allow buffering some shadow calculation + * LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, + * where shadow size is `shadow_width + radius` + * Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ +#define LV_SHADOW_CACHE_SIZE 0 +#endif + +/*1: enable outline drawing on rectangles*/ +#define LV_USE_OUTLINE 1 + +/*1: enable pattern drawing on rectangles*/ +#define LV_USE_PATTERN 1 + +/*1: enable value string drawing on rectangles*/ +#define LV_USE_VALUE_STR 1 + +/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/ +#define LV_USE_BLEND_MODES 1 + +/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/ +#define LV_USE_OPA_SCALE 1 + +/* 1: Use image zoom and rotation*/ +#define LV_USE_IMG_TRANSFORM 1 /* 1: Enable object groups (for keyboard/encoder navigation) */ #define LV_USE_GROUP 1 @@ -145,7 +191,24 @@ typedef void * lv_group_user_data_t; #endif /*LV_USE_GROUP*/ /* 1: Enable GPU interface*/ -#define LV_USE_GPU 1 +#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */ +#define LV_USE_GPU_STM32_DMA2D 0 +/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor +e.g. "stm32f769xx.h" or "stm32f429xx.h" */ +#define LV_GPU_DMA2D_CMSIS_INCLUDE + +/*1: Use PXP for CPU off-load on NXP RTxxx platforms */ +#define LV_USE_GPU_NXP_PXP 0 + +/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) + * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS + * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. + *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() + * */ +#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 + +/*1: Use VG-Lite for CPU offload on NXP RTxxx platforms */ +#define LV_USE_GPU_NXP_VG_LITE 0 /* 1: Enable file system (might be required for images */ #define LV_USE_FILESYSTEM 1 @@ -157,6 +220,13 @@ typedef void * lv_fs_drv_user_data_t; /*1: Add a `user_data` to drivers and objects*/ #define LV_USE_USER_DATA 0 +/*1: Show CPU usage and FPS count in the right bottom corner*/ +#define LV_USE_PERF_MONITOR 0 + +/*1: Use the functions and types from the older API if possible */ +#define LV_USE_API_EXTENSION_V6 1 +#define LV_USE_API_EXTENSION_V7 1 + /*======================== * Image decoder and cache *========================*/ @@ -172,7 +242,7 @@ typedef void * lv_fs_drv_user_data_t; * (I.e. no new image decoder is added) * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. * However the opened images might consume additional RAM. - * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ + * Set it to 0 to disable caching */ #define LV_IMG_CACHE_DEF_SIZE 1 /*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ @@ -181,21 +251,37 @@ typedef void * lv_img_decoder_user_data_t; /*===================== * Compiler settings *====================*/ + +/* For big endian systems set to 1 */ +#define LV_BIG_ENDIAN_SYSTEM 0 + /* Define a custom attribute to `lv_tick_inc` function */ #define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_task_handler` function */ #define LV_ATTRIBUTE_TASK_HANDLER +/* Define a custom attribute to `lv_disp_flush_ready` function */ +#define LV_ATTRIBUTE_FLUSH_READY + +/* Required alignment size for buffers */ +#define LV_ATTRIBUTE_MEM_ALIGN_SIZE + /* With size optimization (-Os) the compiler might not align data to - * 4 or 8 byte boundary. This alignment will be explicitly applied where needed. - * E.g. __attribute__((aligned(4))) */ + * 4 or 8 byte boundary. Some HW may need even 32 or 64 bytes. + * This alignment will be explicitly applied where needed. + * LV_ATTRIBUTE_MEM_ALIGN_SIZE should be used to specify required align size. + * E.g. __attribute__((aligned(LV_ATTRIBUTE_MEM_ALIGN_SIZE))) */ #define LV_ATTRIBUTE_MEM_ALIGN /* Attribute to mark large constant arrays for example * font's bitmaps */ #define LV_ATTRIBUTE_LARGE_CONST +/* Prefix performance critical functions to place them into a faster memory (e.g RAM) + * Uses 15-20 kB extra memory */ +#define LV_ATTRIBUTE_FAST_MEM + /* Export integer constant to binding. * This macro is used with constants in the form of LV_ that * should also appear on lvgl binding API such as Micropython @@ -204,6 +290,10 @@ typedef void * lv_img_decoder_user_data_t; */ #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning +/* Prefix variables that are used in GPU accelerated operations, often these need to be + * placed in RAM sections that are DMA accessible */ +#define LV_ATTRIBUTE_DMA + /*=================== * HAL settings *==================*/ @@ -212,8 +302,8 @@ typedef void * lv_img_decoder_user_data_t; * It removes the need to manually update the tick with `lv_tick_inc`) */ #define LV_TICK_CUSTOM 0 #if LV_TICK_CUSTOM == 1 -#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ +#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ #endif /*LV_TICK_CUSTOM*/ typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ @@ -248,7 +338,7 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i * If an invalid parameter is found an error log message is printed and * the MCU halts at the error. (`LV_USE_LOG` should be enabled) * If you are debugging the MCU you can pause - * the debugger to see exactly where the issue is. + * the debugger to see exactly where the issue is. * * The behavior of asserts can be overwritten by redefining them here. * E.g. #define LV_ASSERT_MEM(p) @@ -262,6 +352,9 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i /*Checks is the memory is successfully allocated or no. (Quite fast)*/ #define LV_USE_ASSERT_MEM 1 +/*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 0 + /* Check the strings. * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ @@ -272,48 +365,54 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i #define LV_USE_ASSERT_OBJ 0 /*Check if the styles are properly initialized. (Fast)*/ -#define LV_USE_ASSERT_STYLE 1 +#define LV_USE_ASSERT_STYLE 0 #endif /*LV_USE_DEBUG*/ -/*================ - * THEME USAGE - *================*/ -#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/ - -#define LV_USE_THEME_TEMPL 0 /*Just for test*/ -#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/ -#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/ -#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/ -#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/ -#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/ -#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */ -#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/ - /*================== * FONT USAGE *===================*/ -/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. +/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. * The symbols are available via `LV_SYMBOL_...` defines - * More info about fonts: https://docs.littlevgl.com/#Fonts - * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array + * More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html + * To create a new font go to: https://lvgl.com/ttf-font-to-c-array */ -/* Robot fonts with bpp = 4 - * https://fonts.google.com/specimen/Roboto */ -#define LV_FONT_ROBOTO_12 0 -#define LV_FONT_ROBOTO_16 1 -#define LV_FONT_ROBOTO_22 0 -#define LV_FONT_ROBOTO_28 0 +/* Montserrat fonts with bpp = 4 + * https://fonts.google.com/specimen/Montserrat */ +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 0 +#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_14 1 +#define LV_FONT_MONTSERRAT_16 0 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 0 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 0 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 /* Demonstrate special features */ -#define LV_FONT_ROBOTO_12_SUBPX 1 -#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/ +#define LV_FONT_MONTSERRAT_12_SUBPX 0 +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/ +#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ /*Pixel perfect monospace font * http://pelulamu.net/unscii/ */ #define LV_FONT_UNSCII_8 0 +#define LV_FONT_UNSCII_16 0 /* Optionally declare your custom fonts here. * You can use these fonts as default font too @@ -323,23 +422,69 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i */ #define LV_FONT_CUSTOM_DECLARE -/*Always set a default font from the built-in fonts*/ -#define LV_FONT_DEFAULT &lv_font_roboto_16 - /* Enable it if you have fonts with a lot of characters. * The limit depends on the font size, font face and bpp * but with > 10,000 characters if you see issues probably you need to enable it.*/ #define LV_FONT_FMT_TXT_LARGE 0 +/* Enables/disables support for compressed fonts. If it's disabled, compressed + * glyphs cannot be processed by the library and won't be rendered. + */ +#define LV_USE_FONT_COMPRESSED 1 + +/* Enable subpixel rendering */ +#define LV_USE_FONT_SUBPX 1 +#if LV_USE_FONT_SUBPX /* Set the pixel order of the display. * Important only if "subpx fonts" are used. * With "normal" font it doesn't matter. */ #define LV_FONT_SUBPX_BGR 0 +#endif /*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ typedef void * lv_font_user_data_t; +/*================ + * THEME USAGE + *================*/ + +/*Always enable at least on theme*/ + +/* No theme, you can apply your styles as you need + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ +#define LV_USE_THEME_EMPTY 1 + +/*Simple to the create your theme based on it + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ +#define LV_USE_THEME_TEMPLATE 1 + +/* A fast and impressive theme. + * Flags: + * LV_THEME_MATERIAL_FLAG_LIGHT: light theme + * LV_THEME_MATERIAL_FLAG_DARK: dark theme + * LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations) + * LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state) + * */ +#define LV_USE_THEME_MATERIAL 1 + +/* Mono-color theme for monochrome displays. + * If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the + * texts and borders will be black and the background will be + * white. Else the colors are inverted. + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ +#define LV_USE_THEME_MONO 1 + +#define LV_THEME_DEFAULT_INCLUDE /*Include a header for the init. function*/ +#define LV_THEME_DEFAULT_INIT lv_theme_material_init +#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1) +#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6) +#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT +#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14 +#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14 +#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14 +#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14 + /*================= * Text settings *=================*/ @@ -356,7 +501,7 @@ typedef void * lv_font_user_data_t; /* If a word is at least this long, will break wherever "prettiest" * To disable, set to a value <= 0 */ -#define LV_TXT_LINE_BREAK_LONG_LEN 12 +#define LV_TXT_LINE_BREAK_LONG_LEN 0 /* Minimum number of characters in a long word to put on a line before a break. * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ @@ -371,7 +516,7 @@ typedef void * lv_font_user_data_t; /* Support bidirectional texts. * Allows mixing Left-to-Right and Right-to-Left texts. - * The direction will be processed according to the Unicode Bidirectioanl Algorithm: + * The direction will be processed according to the Unicode Bidirectional Algorithm: * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ #define LV_USE_BIDI 0 #if LV_USE_BIDI @@ -382,22 +527,38 @@ typedef void * lv_font_user_data_t; #define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO #endif +/* Enable Arabic/Persian processing + * In these languages characters should be replaced with + * an other form based on their position in the text */ +#define LV_USE_ARABIC_PERSIAN_CHARS 0 + /*Change the built in (v)snprintf functions*/ #define LV_SPRINTF_CUSTOM 0 #if LV_SPRINTF_CUSTOM # define LV_SPRINTF_INCLUDE # define lv_snprintf snprintf # define lv_vsnprintf vsnprintf +#else /*!LV_SPRINTF_CUSTOM*/ +# define LV_SPRINTF_DISABLE_FLOAT 1 #endif /*LV_SPRINTF_CUSTOM*/ /*=================== * LV_OBJ SETTINGS *==================*/ +#if LV_USE_USER_DATA /*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ typedef void * lv_obj_user_data_t; +/*Provide a function to free user data*/ +#define LV_USE_USER_DATA_FREE 0 +#if LV_USE_USER_DATA_FREE +# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/ +/* Function prototype : void user_data_free(lv_obj_t * obj); */ +# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/ +#endif +#endif -/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ +/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/ #define LV_USE_OBJ_REALIGN 1 /* Enable to make the object clickable on a larger area. @@ -405,13 +566,13 @@ typedef void * lv_obj_user_data_t; * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) */ -#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF +#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY /*================== * LV OBJ X USAGE *================*/ /* - * Documentation of the object types: https://docs.littlevgl.com/#Object-types + * Documentation of the object types: https://docs.lvgl.com/#Object-types */ /*Arc (dependencies: -)*/ @@ -422,27 +583,26 @@ typedef void * lv_obj_user_data_t; /*Button (dependencies: lv_cont*/ #define LV_USE_BTN 1 -#if LV_USE_BTN != 0 -/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/ -# define LV_BTN_INK_EFFECT 0 -#endif /*Button matrix (dependencies: -)*/ -#define LV_USE_BTNM 1 +#define LV_USE_BTNMATRIX 1 /*Calendar (dependencies: -)*/ #define LV_USE_CALENDAR 1 +#if LV_USE_CALENDAR +# define LV_CALENDAR_WEEK_STARTS_MONDAY 0 +#endif /*Canvas (dependencies: lv_img)*/ #define LV_USE_CANVAS 1 /*Check box (dependencies: lv_btn, lv_label)*/ -#define LV_USE_CB 1 +#define LV_USE_CHECKBOX 1 /*Chart (dependencies: -)*/ #define LV_USE_CHART 1 #if LV_USE_CHART -# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20 +# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256 #endif /*Container (dependencies: -*/ @@ -452,13 +612,13 @@ typedef void * lv_obj_user_data_t; #define LV_USE_CPICKER 1 /*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ -#define LV_USE_DDLIST 1 -#if LV_USE_DDLIST != 0 +#define LV_USE_DROPDOWN 1 +#if LV_USE_DROPDOWN != 0 /*Open and close default animation time [ms] (0: no animation)*/ -# define LV_DDLIST_DEF_ANIM_TIME 200 +# define LV_DROPDOWN_DEF_ANIM_TIME 200 #endif -/*Gauge (dependencies:lv_bar, lv_lmeter)*/ +/*Gauge (dependencies:lv_bar, lv_linemeter)*/ #define LV_USE_GAUGE 1 /*Image (dependencies: lv_label*/ @@ -472,7 +632,7 @@ typedef void * lv_obj_user_data_t; #endif /*Keyboard (dependencies: lv_btnm)*/ -#define LV_USE_KB 1 +#define LV_USE_KEYBOARD 1 /*Label (dependencies: -*/ #define LV_USE_LABEL 1 @@ -492,6 +652,10 @@ typedef void * lv_obj_user_data_t; /*LED (dependencies: -)*/ #define LV_USE_LED 1 +#if LV_USE_LED +# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/ +# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/ +#endif /*Line (dependencies: -*/ #define LV_USE_LINE 1 @@ -504,10 +668,22 @@ typedef void * lv_obj_user_data_t; #endif /*Line meter (dependencies: *;)*/ -#define LV_USE_LMETER 1 +#define LV_USE_LINEMETER 1 +#if LV_USE_LINEMETER +/* Draw line more precisely at cost of performance. + * Useful if there are lot of lines any minor are visible + * 0: No extra precision + * 1: Some extra precision + * 2: Best precision + */ +# define LV_LINEMETER_PRECISE 1 +#endif + +/*Mask (dependencies: -)*/ +#define LV_USE_OBJMASK 1 /*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ -#define LV_USE_MBOX 1 +#define LV_USE_MSGBOX 1 /*Page (dependencies: lv_cont)*/ #define LV_USE_PAGE 1 @@ -517,11 +693,11 @@ typedef void * lv_obj_user_data_t; #endif /*Preload (dependencies: lv_arc, lv_anim)*/ -#define LV_USE_PRELOAD 1 -#if LV_USE_PRELOAD != 0 -# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/ -# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/ -# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC +#define LV_USE_SPINNER 1 +#if LV_USE_SPINNER != 0 +# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/ +# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/ +# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC #endif /*Roller (dependencies: lv_ddlist)*/ @@ -541,19 +717,20 @@ typedef void * lv_obj_user_data_t; #define LV_USE_SPINBOX 1 /*Switch (dependencies: lv_slider)*/ -#define LV_USE_SW 1 +#define LV_USE_SWITCH 1 /*Text area (dependencies: lv_label, lv_page)*/ -#define LV_USE_TA 1 -#if LV_USE_TA != 0 -# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ -# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#define LV_USE_TEXTAREA 1 +#if LV_USE_TEXTAREA != 0 +# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ +# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ #endif /*Table (dependencies: lv_label)*/ #define LV_USE_TABLE 1 #if LV_USE_TABLE # define LV_TABLE_COL_MAX 12 +# define LV_TABLE_CELL_STYLE_CNT 4 #endif /*Tab (dependencies: lv_page, lv_btnm)*/ @@ -583,9 +760,6 @@ typedef void * lv_obj_user_data_t; /*--END OF LV_CONF_H--*/ -/*Be sure every define has a default value*/ -#include "lvgl/src/lv_conf_checker.h" - #endif /*LV_CONF_H*/ #endif /*End of "Content enable"*/ diff --git a/src/libs/lvgl/lvgl.h b/src/libs/lvgl/lvgl.h index 418ffd2a..02ace0af 100644 --- a/src/libs/lvgl/lvgl.h +++ b/src/libs/lvgl/lvgl.h @@ -10,12 +10,18 @@ extern "C" { #endif +/*************************** + * CURRENT VERSION OF LVGL + ***************************/ +#define LVGL_VERSION_MAJOR 7 +#define LVGL_VERSION_MINOR 11 +#define LVGL_VERSION_PATCH 0 +#define LVGL_VERSION_INFO "dev" + /********************* * INCLUDES *********************/ -#include "src/lv_version.h" - #include "src/lv_misc/lv_log.h" #include "src/lv_misc/lv_task.h" #include "src/lv_misc/lv_math.h" @@ -29,51 +35,52 @@ extern "C" { #include "src/lv_core/lv_refr.h" #include "src/lv_core/lv_disp.h" -#include "src/lv_core/lv_debug.h" #include "src/lv_themes/lv_theme.h" #include "src/lv_font/lv_font.h" +#include "src/lv_font/lv_font_loader.h" #include "src/lv_font/lv_font_fmt_txt.h" -#include "src/lv_misc/lv_bidi.h" #include "src/lv_misc/lv_printf.h" -#include "src/lv_objx/lv_btn.h" -#include "src/lv_objx/lv_imgbtn.h" -#include "src/lv_objx/lv_img.h" -#include "src/lv_objx/lv_label.h" -#include "src/lv_objx/lv_line.h" -#include "src/lv_objx/lv_page.h" -#include "src/lv_objx/lv_cont.h" -#include "src/lv_objx/lv_list.h" -#include "src/lv_objx/lv_chart.h" -#include "src/lv_objx/lv_table.h" -#include "src/lv_objx/lv_cb.h" -#include "src/lv_objx/lv_cpicker.h" -#include "src/lv_objx/lv_bar.h" -#include "src/lv_objx/lv_slider.h" -#include "src/lv_objx/lv_led.h" -#include "src/lv_objx/lv_btnm.h" -#include "src/lv_objx/lv_kb.h" -#include "src/lv_objx/lv_ddlist.h" -#include "src/lv_objx/lv_roller.h" -#include "src/lv_objx/lv_ta.h" -#include "src/lv_objx/lv_canvas.h" -#include "src/lv_objx/lv_win.h" -#include "src/lv_objx/lv_tabview.h" -#include "src/lv_objx/lv_tileview.h" -#include "src/lv_objx/lv_mbox.h" -#include "src/lv_objx/lv_gauge.h" -#include "src/lv_objx/lv_lmeter.h" -#include "src/lv_objx/lv_sw.h" -#include "src/lv_objx/lv_kb.h" -#include "src/lv_objx/lv_arc.h" -#include "src/lv_objx/lv_preload.h" -#include "src/lv_objx/lv_calendar.h" -#include "src/lv_objx/lv_spinbox.h" +#include "src/lv_widgets/lv_btn.h" +#include "src/lv_widgets/lv_imgbtn.h" +#include "src/lv_widgets/lv_img.h" +#include "src/lv_widgets/lv_label.h" +#include "src/lv_widgets/lv_line.h" +#include "src/lv_widgets/lv_page.h" +#include "src/lv_widgets/lv_cont.h" +#include "src/lv_widgets/lv_list.h" +#include "src/lv_widgets/lv_chart.h" +#include "src/lv_widgets/lv_table.h" +#include "src/lv_widgets/lv_checkbox.h" +#include "src/lv_widgets/lv_cpicker.h" +#include "src/lv_widgets/lv_bar.h" +#include "src/lv_widgets/lv_slider.h" +#include "src/lv_widgets/lv_led.h" +#include "src/lv_widgets/lv_btnmatrix.h" +#include "src/lv_widgets/lv_keyboard.h" +#include "src/lv_widgets/lv_dropdown.h" +#include "src/lv_widgets/lv_roller.h" +#include "src/lv_widgets/lv_textarea.h" +#include "src/lv_widgets/lv_canvas.h" +#include "src/lv_widgets/lv_win.h" +#include "src/lv_widgets/lv_tabview.h" +#include "src/lv_widgets/lv_tileview.h" +#include "src/lv_widgets/lv_msgbox.h" +#include "src/lv_widgets/lv_objmask.h" +#include "src/lv_widgets/lv_gauge.h" +#include "src/lv_widgets/lv_linemeter.h" +#include "src/lv_widgets/lv_switch.h" +#include "src/lv_widgets/lv_arc.h" +#include "src/lv_widgets/lv_spinner.h" +#include "src/lv_widgets/lv_calendar.h" +#include "src/lv_widgets/lv_spinbox.h" #include "src/lv_draw/lv_img_cache.h" +#include "src/lv_api_map.h" + /********************* * DEFINES *********************/ @@ -90,6 +97,53 @@ extern "C" { * MACROS **********************/ +/** Gives 1 if the x.y.z version is supported in the current version + * Usage: + * + * - Require v6 + * #if LV_VERSION_CHECK(6,0,0) + * new_func_in_v6(); + * #endif + * + * + * - Require at least v5.3 + * #if LV_VERSION_CHECK(5,3,0) + * new_feature_from_v5_3(); + * #endif + * + * + * - Require v5.3.2 bugfixes + * #if LV_VERSION_CHECK(5,3,2) + * bugfix_in_v5_3_2(); + * #endif + * + * */ +#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH))) + +/** + * Wrapper functions for VERSION macros + */ + +static inline int lv_version_major(void) +{ + return LVGL_VERSION_MAJOR; +} + +static inline int lv_version_minor(void) +{ + return LVGL_VERSION_MINOR; +} + +static inline int lv_version_patch(void) +{ + return LVGL_VERSION_PATCH; +} + +static inline const char *lv_version_info(void) +{ + return LVGL_VERSION_INFO; +} + #ifdef __cplusplus } #endif diff --git a/src/libs/lvgl/lvgl.mk b/src/libs/lvgl/lvgl.mk index 830fe119..1479c217 100644 --- a/src/libs/lvgl/lvgl.mk +++ b/src/libs/lvgl/lvgl.mk @@ -1,8 +1,8 @@ -include $(LVGL_DIR)/lvgl/src/lv_core/lv_core.mk -include $(LVGL_DIR)/lvgl/src/lv_hal/lv_hal.mk -include $(LVGL_DIR)/lvgl/src/lv_objx/lv_objx.mk -include $(LVGL_DIR)/lvgl/src/lv_font/lv_font.mk -include $(LVGL_DIR)/lvgl/src/lv_misc/lv_misc.mk -include $(LVGL_DIR)/lvgl/src/lv_themes/lv_themes.mk -include $(LVGL_DIR)/lvgl/src/lv_draw/lv_draw.mk - +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core/lv_core.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal/lv_hal.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets/lv_widgets.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font/lv_font.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc/lv_misc.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes/lv_themes.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw/lv_draw.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu/lv_gpu.mk diff --git a/src/libs/lvgl/patches/0001-lv_refr-add-support-for-selecting-render-direction.patch b/src/libs/lvgl/patches/0001-lv_refr-add-support-for-selecting-render-direction.patch deleted file mode 100644 index 2996c063..00000000 --- a/src/libs/lvgl/patches/0001-lv_refr-add-support-for-selecting-render-direction.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 1f57703589c6d202d9f6259f1d0fefe7bfd39061 Mon Sep 17 00:00:00 2001 -From: Koen Zandberg -Date: Thu, 27 Feb 2020 16:33:06 +0100 -Subject: [PATCH] lv_refr: add support for selecting render direction - ---- - src/lv_core/lv_refr.c | 71 ++++++++++++++++++++++++++++------------ - src/lv_hal/lv_hal_disp.h | 6 ++++ - 2 files changed, 56 insertions(+), 21 deletions(-) - -diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c -index 5ee3fbb2..e71e1629 100644 ---- a/src/lv_core/lv_refr.c -+++ b/src/lv_core/lv_refr.c -@@ -339,30 +339,59 @@ static void lv_refr_area(const lv_area_t * area_p) - } - } - -- /*Always use the full row*/ -- lv_coord_t row; -- lv_coord_t row_last = 0; -- for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) { -- /*Calc. the next y coordinates of VDB*/ -- vdb->area.x1 = area_p->x1; -- vdb->area.x2 = area_p->x2; -- vdb->area.y1 = row; -- vdb->area.y2 = row + max_row - 1; -- if(vdb->area.y2 > y2) vdb->area.y2 = y2; -- row_last = vdb->area.y2; -- lv_refr_area_part(area_p); -+ if (disp_refr->render_direction) { -+ /*Always use the full row*/ -+ lv_coord_t row; -+ lv_coord_t row_last = y2; -+ for(row = area_p->y2; row > max_row - 1 + area_p->y1; row -= max_row) { -+ /*Calc. the next y coordinates of VDB*/ -+ vdb->area.x1 = area_p->x1; -+ vdb->area.x2 = area_p->x2; -+ vdb->area.y1 = row - max_row + 1; -+ vdb->area.y2 = row; -+ if(vdb->area.y2 > y2) vdb->area.y2 = y2; -+ row_last = vdb->area.y1; -+ lv_refr_area_part(area_p); -+ } -+ -+ /*If the last (first) y coordinates are not handled yet ...*/ -+ if(area_p->y1 != row_last) { -+ /*Calc. the next y coordinates of VDB*/ -+ vdb->area.x1 = area_p->x1; -+ vdb->area.x2 = area_p->x2; -+ vdb->area.y1 = area_p->y1; -+ vdb->area.y2 = row; -+ -+ /*Refresh this part too*/ -+ lv_refr_area_part(area_p); -+ } - } -+ else { -+ /*Always use the full row*/ -+ lv_coord_t row; -+ lv_coord_t row_last = 0; -+ for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) { -+ /*Calc. the next y coordinates of VDB*/ -+ vdb->area.x1 = area_p->x1; -+ vdb->area.x2 = area_p->x2; -+ vdb->area.y1 = row; -+ vdb->area.y2 = row + max_row - 1; -+ if(vdb->area.y2 > y2) vdb->area.y2 = y2; -+ row_last = vdb->area.y2; -+ lv_refr_area_part(area_p); -+ } - -- /*If the last y coordinates are not handled yet ...*/ -- if(y2 != row_last) { -- /*Calc. the next y coordinates of VDB*/ -- vdb->area.x1 = area_p->x1; -- vdb->area.x2 = area_p->x2; -- vdb->area.y1 = row; -- vdb->area.y2 = y2; -+ /*If the last y coordinates are not handled yet ...*/ -+ if(y2 != row_last) { -+ /*Calc. the next y coordinates of VDB*/ -+ vdb->area.x1 = area_p->x1; -+ vdb->area.x2 = area_p->x2; -+ vdb->area.y1 = row; -+ vdb->area.y2 = y2; - -- /*Refresh this part too*/ -- lv_refr_area_part(area_p); -+ /*Refresh this part too*/ -+ lv_refr_area_part(area_p); -+ } - } - } - } -diff --git a/src/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h -index 8db692a0..eef22d98 100644 ---- a/src/lv_hal/lv_hal_disp.h -+++ b/src/lv_hal/lv_hal_disp.h -@@ -143,6 +143,7 @@ typedef struct _disp_t - uint8_t inv_area_joined[LV_INV_BUF_SIZE]; - uint32_t inv_p : 10; - -+ int render_direction; /**< 0 when rendering down, 1 when rendering up */ - /*Miscellaneous data*/ - uint32_t last_activity_time; /**< Last time there was activity on this display */ - } lv_disp_t; -@@ -230,6 +231,11 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp); - */ - bool lv_disp_get_antialiasing(lv_disp_t * disp); - -+static inline void lv_disp_set_direction(lv_disp_t * disp, int direction) -+{ -+ disp->render_direction = direction; -+} -+ - //! @cond Doxygen_Suppress - - /** --- -2.24.1 - diff --git a/src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch b/src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch deleted file mode 100644 index 7b4c204a..00000000 --- a/src/libs/lvgl/patches/0002-fix_bug_in_animation_management_for_lv_label.patch +++ /dev/null @@ -1,51 +0,0 @@ -Index: src/libs/lvgl/src/lv_misc/lv_anim.c -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/src/libs/lvgl/src/lv_misc/lv_anim.c b/src/libs/lvgl/src/lv_misc/lv_anim.c ---- a/src/libs/lvgl/src/lv_misc/lv_anim.c (revision 12a3b6cc8ec1fd6b951c353ab3a5fbbb9934fdd4) -+++ b/src/libs/lvgl/src/lv_misc/lv_anim.c (date 1610901672072) -@@ -158,12 +158,12 @@ - * @param end end value of the animation - * @return the required time [ms] for the animation with the given parameters - */ --uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) -+uint32_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) - { - int32_t d = LV_MATH_ABS((int32_t)start - end); - uint32_t time = (int32_t)((int32_t)(d * 1000) / speed); - -- if(time > UINT16_MAX) time = UINT16_MAX; -+ if(time > UINT32_MAX) time = UINT32_MAX; - - if(time == 0) { - time++; -Index: src/libs/lvgl/src/lv_misc/lv_anim.h -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/src/libs/lvgl/src/lv_misc/lv_anim.h b/src/libs/lvgl/src/lv_misc/lv_anim.h ---- a/src/libs/lvgl/src/lv_misc/lv_anim.h (revision 12a3b6cc8ec1fd6b951c353ab3a5fbbb9934fdd4) -+++ b/src/libs/lvgl/src/lv_misc/lv_anim.h (date 1610901672076) -@@ -73,8 +73,8 @@ - lv_anim_ready_cb_t ready_cb; /**< Call it when the animation is ready*/ - int32_t start; /**< Start value*/ - int32_t end; /**< End value*/ -- uint16_t time; /**< Animation time in ms*/ -- int16_t act_time; /**< Current time in animation. Set to negative to make delay.*/ -+ uint32_t time; /**< Animation time in ms*/ -+ int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/ - uint16_t playback_pause; /**< Wait before play back*/ - uint16_t repeat_pause; /**< Wait before repeat*/ - #if LV_USE_USER_DATA -@@ -266,7 +266,7 @@ - * @param end end value of the animation - * @return the required time [ms] for the animation with the given parameters - */ --uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end); -+uint32_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end); - - /** - * Calculate the current value of an animation applying linear characteristic diff --git a/src/libs/lvgl/porting/lv_port_disp_template.c b/src/libs/lvgl/porting/lv_port_disp_template.c deleted file mode 100644 index 9752d5d9..00000000 --- a/src/libs/lvgl/porting/lv_port_disp_template.c +++ /dev/null @@ -1,196 +0,0 @@ -/** - * @file lv_port_disp_templ.c - * - */ - - /*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/ -#if 0 - -/********************* - * INCLUDES - *********************/ -#include "lv_port_disp_template.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ -static void disp_init(void); - -static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p); -#if LV_USE_GPU -static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); -static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, - const lv_area_t * fill_area, lv_color_t color); -#endif - -/********************** - * STATIC VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -void lv_port_disp_init(void) -{ - /*------------------------- - * Initialize your display - * -----------------------*/ - disp_init(); - - /*----------------------------- - * Create a buffer for drawing - *----------------------------*/ - - /* LittlevGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row - * - * There are three buffering configurations: - * 1. Create ONE buffer with some rows: - * LittlevGL will draw the display's content here and writes it to your display - * - * 2. Create TWO buffer with some rows: - * LittlevGL will draw the display's content to a buffer and writes it your display. - * You should use DMA to write the buffer's content to the display. - * It will enable LittlevGL to draw the next part of the screen to the other buffer while - * the data is being sent form the first buffer. It makes rendering and flushing parallel. - * - * 3. Create TWO screen-sized buffer: - * Similar to 2) but the buffer have to be screen sized. When LittlevGL is ready it will give the - * whole frame to display. This way you only need to change the frame buffer's address instead of - * copying the pixels. - * */ - - /* Example for 1) */ - static lv_disp_buf_t disp_buf_1; - static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/ - lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/ - - /* Example for 2) */ - static lv_disp_buf_t disp_buf_2; - static lv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/ - static lv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/ - lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/ - - /* Example for 3) */ - static lv_disp_buf_t disp_buf_3; - static lv_color_t buf3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/ - static lv_color_t buf3_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/ - lv_disp_buf_init(&disp_buf_3, buf3_1, buf3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/ - - - /*----------------------------------- - * Register the display in LittlevGL - *----------------------------------*/ - - lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/ - lv_disp_drv_init(&disp_drv); /*Basic initialization*/ - - /*Set up the functions to access to your display*/ - - /*Set the resolution of the display*/ - disp_drv.hor_res = 480; - disp_drv.ver_res = 320; - - /*Used to copy the buffer's content to the display*/ - disp_drv.flush_cb = disp_flush; - - /*Set a display buffer*/ - disp_drv.buffer = &disp_buf_2; - -#if LV_USE_GPU - /*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/ - - /*Blend two color array using opacity*/ - disp_drv.gpu_blend_cb = gpu_blend; - - /*Fill a memory array with a color*/ - disp_drv.gpu_fill_cb = gpu_fill; -#endif - - /*Finally register the driver*/ - lv_disp_drv_register(&disp_drv); -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -/* Initialize your display and the required peripherals. */ -static void disp_init(void) -{ - /*You code here*/ -} - -/* Flush the content of the internal buffer the specific area on the display - * You can use DMA or any hardware acceleration to do this operation in the background but - * 'lv_disp_flush_ready()' has to be called when finished. */ -static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) -{ - /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/ - - int32_t x; - int32_t y; - for(y = area->y1; y <= area->y2; y++) { - for(x = area->x1; x <= area->x2; x++) { - /* Put a pixel to the display. For example: */ - /* put_px(x, y, *color_p)*/ - color_p++; - } - } - - /* IMPORTANT!!! - * Inform the graphics library that you are ready with the flushing*/ - lv_disp_flush_ready(disp_drv); -} - - -/*OPTIONAL: GPU INTERFACE*/ -#if LV_USE_GPU - -/* If your MCU has hardware accelerator (GPU) then you can use it to blend to memories using opacity - * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/ -static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa) -{ - /*It's an example code which should be done by your GPU*/ - uint32_t i; - for(i = 0; i < length; i++) { - dest[i] = lv_color_mix(dest[i], src[i], opa); - } -} - -/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color - * It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/ -static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width, - const lv_area_t * fill_area, lv_color_t color) -{ - /*It's an example code which should be done by your GPU*/ - int32_t x, y; - dest_buf += dest_width * fill_area->y1; /*Go to the first line*/ - - for(y = fill_area->y1; y < fill_area->y2; y++) { - for(x = fill_area->x1; x < fill_area->x2; x++) { - dest_buf[x] = color; - } - dest_buf+=dest_width; /*Go to the next line*/ - } -} - -#endif /*LV_USE_GPU*/ - -#else /* Enable this file at the top */ - -/* This dummy typedef exists purely to silence -Wpedantic. */ -typedef int keep_pedantic_happy; -#endif diff --git a/src/libs/lvgl/porting/lv_port_disp_template.h b/src/libs/lvgl/porting/lv_port_disp_template.h deleted file mode 100644 index eeca802b..00000000 --- a/src/libs/lvgl/porting/lv_port_disp_template.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file lv_port_disp_templ.h - * - */ - - /*Copy this file as "lv_port_disp.h" and set this value to "1" to enable content*/ -#if 0 - -#ifndef LV_PORT_DISP_TEMPL_H -#define LV_PORT_DISP_TEMPL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lvgl/lvgl.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_PORT_DISP_TEMPL_H*/ - -#endif /*Disable/Enable content*/ diff --git a/src/libs/lvgl/porting/lv_port_fs_template.c b/src/libs/lvgl/porting/lv_port_fs_template.c deleted file mode 100644 index 454899d6..00000000 --- a/src/libs/lvgl/porting/lv_port_fs_template.c +++ /dev/null @@ -1,379 +0,0 @@ -/** - * @file lv_port_fs_templ.c - * - */ - - /*Copy this file as "lv_port_fs.c" and set this value to "1" to enable content*/ -#if 0 - -/********************* - * INCLUDES - *********************/ -#include "lv_port_fs_template.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/* Create a type to store the required data about your file. - * If you are using a File System library - * it already should have a File type. - * For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/ -typedef struct { - /*Add the data you need to store about a file*/ - uint32_t dummy1; - uint32_t dummy2; -}file_t; - -/*Similarly to `file_t` create a type for directory reading too */ -typedef struct { - /*Add the data you need to store about directory reading*/ - uint32_t dummy1; - uint32_t dummy2; -}dir_t; - - -/********************** - * STATIC PROTOTYPES - **********************/ -static void fs_init(void); - -static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode); -static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p); -static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); -static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw); -static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos); -static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p); -static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); -static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path); -static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p); -static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname); -static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p); -static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path); -static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn); -static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p); - -/********************** - * STATIC VARIABLES - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -void lv_port_fs_init(void) -{ - /*---------------------------------------------------- - * Initialize your storage device and File System - * -------------------------------------------------*/ - fs_init(); - - /*--------------------------------------------------- - * Register the file system interface in LittlevGL - *--------------------------------------------------*/ - - /* Add a simple drive to open images */ - lv_fs_drv_t fs_drv; - lv_fs_drv_init(&fs_drv); - - /*Set up fields...*/ - fs_drv.file_size = sizeof(file_t); - fs_drv.letter = 'P'; - fs_drv.open_cb = fs_open; - fs_drv.close_cb = fs_close; - fs_drv.read_cb = fs_read; - fs_drv.write_cb = fs_write; - fs_drv.seek_cb = fs_seek; - fs_drv.tell_cb = fs_tell; - fs_drv.free_space_cb = fs_free; - fs_drv.size_cb = fs_size; - fs_drv.remove_cb = fs_remove; - fs_drv.rename_cb = fs_rename; - fs_drv.trunc_cb = fs_trunc; - - fs_drv.rddir_size = sizeof(dir_t); - fs_drv.dir_close_cb = fs_dir_close; - fs_drv.dir_open_cb = fs_dir_open; - fs_drv.dir_read_cb = fs_dir_read; - - lv_fs_drv_register(&fs_drv); -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -/* Initialize your Storage device and File system. */ -static void fs_init(void) -{ - /*E.g. for FatFS initalize the SD card and FatFS itself*/ - - /*You code here*/ -} - -/** - * Open a file - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable - * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) - * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - if(mode == LV_FS_MODE_WR) - { - /*Open a file for write*/ - - /* Add your code here*/ - } - else if(mode == LV_FS_MODE_RD) - { - /*Open a file for read*/ - - /* Add your code here*/ - } - else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) - { - /*Open a file for read and write*/ - - /* Add your code here*/ - } - - return res; -} - - -/** - * Close an opened file - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable. (opened with lv_ufs_open) - * @return LV_FS_RES_OK: no error, the file is read - * any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Read data from an opened file - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable. - * @param buf pointer to a memory block where to store the read data - * @param btr number of Bytes To Read - * @param br the real number of read bytes (Byte Read) - * @return LV_FS_RES_OK: no error, the file is read - * any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Write into a file - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable - * @param buf pointer to a buffer with the bytes to write - * @param btr Bytes To Write - * @param br the number of real written bytes (Bytes Written). NULL if unused. - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Set the read write pointer. Also expand the file size if necessary. - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable. (opened with lv_ufs_open ) - * @param pos the new position of read write pointer - * @return LV_FS_RES_OK: no error, the file is read - * any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Give the size of a file bytes - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable - * @param size pointer to a variable to store the size - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} -/** - * Give the position of the read write pointer - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to a file_t variable. - * @param pos_p pointer to to store the result - * @return LV_FS_RES_OK: no error, the file is read - * any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Delete a file - * @param drv pointer to a driver where this function belongs - * @param path path of the file to delete - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Truncate the file size to the current position of the read write pointer - * @param drv pointer to a driver where this function belongs - * @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open ) - * @return LV_FS_RES_OK: no error, the file is read - * any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Rename a file - * @param drv pointer to a driver where this function belongs - * @param oldname path to the file - * @param newname path with the new name - * @return LV_FS_RES_OK or any error from 'fs_res_t' - */ -static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Get the free and total size of a driver in kB - * @param drv pointer to a driver where this function belongs - * @param letter the driver letter - * @param total_p pointer to store the total size [kB] - * @param free_p pointer to store the free size [kB] - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Initialize a 'fs_read_dir_t' variable for directory reading - * @param drv pointer to a driver where this function belongs - * @param rddir_p pointer to a 'fs_read_dir_t' variable - * @param path path to a directory - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Read the next filename form a directory. - * The name of the directories will begin with '/' - * @param drv pointer to a driver where this function belongs - * @param rddir_p pointer to an initialized 'fs_read_dir_t' variable - * @param fn pointer to a buffer to store the filename - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -/** - * Close the directory reading - * @param drv pointer to a driver where this function belongs - * @param rddir_p pointer to an initialized 'fs_read_dir_t' variable - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum - */ -static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p) -{ - lv_fs_res_t res = LV_FS_RES_NOT_IMP; - - /* Add your code here*/ - - return res; -} - -#else /* Enable this file at the top */ - -/* This dummy typedef exists purely to silence -Wpedantic. */ -typedef int keep_pedantic_happy; -#endif diff --git a/src/libs/lvgl/porting/lv_port_fs_template.h b/src/libs/lvgl/porting/lv_port_fs_template.h deleted file mode 100644 index 7db06f65..00000000 --- a/src/libs/lvgl/porting/lv_port_fs_template.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file lv_port_fs_templ.h - * - */ - - /*Copy this file as "lv_port_fs.h" and set this value to "1" to enable content*/ -#if 0 - -#ifndef LV_PORT_FS_TEMPL_H -#define LV_PORT_FS_TEMPL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lvgl/lvgl.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_PORT_FS_TEMPL_H*/ - -#endif /*Disable/Enable content*/ diff --git a/src/libs/lvgl/porting/lv_port_indev_template.c b/src/libs/lvgl/porting/lv_port_indev_template.c deleted file mode 100644 index 54b8c9fd..00000000 --- a/src/libs/lvgl/porting/lv_port_indev_template.c +++ /dev/null @@ -1,428 +0,0 @@ -/** - * @file lv_port_indev_templ.c - * - */ - - /*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/ -#if 0 - -/********************* - * INCLUDES - *********************/ -#include "lv_port_indev_template.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ - -static void touchpad_init(void); -static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); -static bool touchpad_is_pressed(void); -static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y); - -static void mouse_init(void); -static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); -static bool mouse_is_pressed(void); -static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y); - -static void keypad_init(void); -static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); -static uint32_t keypad_get_key(void); - -static void encoder_init(void); -static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); -static void encoder_handler(void); - -static void button_init(void); -static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); -static int8_t button_get_pressed_id(void); -static bool button_is_pressed(uint8_t id); - -/********************** - * STATIC VARIABLES - **********************/ -lv_indev_t * indev_touchpad; -lv_indev_t * indev_mouse; -lv_indev_t * indev_keypad; -lv_indev_t * indev_encoder; -lv_indev_t * indev_button; - -static int32_t encoder_diff; -static lv_indev_state_t encoder_state; - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -void lv_port_indev_init(void) -{ - /* Here you will find example implementation of input devices supported by LittelvGL: - * - Touchpad - * - Mouse (with cursor support) - * - Keypad (supports GUI usage only with key) - * - Encoder (supports GUI usage only with: left, right, push) - * - Button (external buttons to press points on the screen) - * - * The `..._read()` function are only examples. - * You should shape them according to your hardware - */ - - - lv_indev_drv_t indev_drv; - - /*------------------ - * Touchpad - * -----------------*/ - - /*Initialize your touchpad if you have*/ - touchpad_init(); - - /*Register a touchpad input device*/ - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = touchpad_read; - indev_touchpad = lv_indev_drv_register(&indev_drv); - - /*------------------ - * Mouse - * -----------------*/ - - /*Initialize your touchpad if you have*/ - mouse_init(); - - /*Register a mouse input device*/ - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = mouse_read; - indev_mouse = lv_indev_drv_register(&indev_drv); - - /*Set cursor. For simplicity set a HOME symbol now.*/ - lv_obj_t * mouse_cursor = lv_img_create(lv_disp_get_scr_act(NULL), NULL); - lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME); - lv_indev_set_cursor(indev_mouse, mouse_cursor); - - /*------------------ - * Keypad - * -----------------*/ - - /*Initialize your keypad or keyboard if you have*/ - keypad_init(); - - /*Register a keypad input device*/ - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_KEYPAD; - indev_drv.read_cb = keypad_read; - indev_keypad = lv_indev_drv_register(&indev_drv); - - /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`, - * add objects to the group with `lv_group_add_obj(group, obj)` - * and assign this input device to group to navigate in it: - * `lv_indev_set_group(indev_keypad, group);` */ - - /*------------------ - * Encoder - * -----------------*/ - - /*Initialize your encoder if you have*/ - encoder_init(); - - /*Register a encoder input device*/ - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_KEYPAD; - indev_drv.read_cb = encoder_read; - indev_encoder = lv_indev_drv_register(&indev_drv); - - /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`, - * add objects to the group with `lv_group_add_obj(group, obj)` - * and assign this input device to group to navigate in it: - * `lv_indev_set_group(indev_keypad, group);` */ - - /*------------------ - * Button - * -----------------*/ - - /*Initialize your button if you have*/ - button_init(); - - /*Register a button input device*/ - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_BUTTON; - indev_drv.read_cb = button_read; - indev_button = lv_indev_drv_register(&indev_drv); - - /*Assign buttons to points on the screen*/ - static const lv_point_t btn_points[2] = { - {10, 10}, /*Button 0 -> x:10; y:10*/ - {40, 100}, /*Button 1 -> x:40; y:100*/ - }; - lv_indev_set_button_points(indev_button, btn_points); -} - -/********************** - * STATIC FUNCTIONS - **********************/ - - - -/*------------------ - * Touchpad - * -----------------*/ - -/*Initialize your touchpad*/ -static void touchpad_init(void) -{ - /*Your code comes here*/ -} - -/* Will be called by the library to read the touchpad */ -static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) -{ - static lv_coord_t last_x = 0; - static lv_coord_t last_y = 0; - - /*Save the pressed coordinates and the state*/ - if(touchpad_is_pressed()) { - touchpad_get_xy(&last_x, &last_y); - data->state = LV_INDEV_STATE_PR; - } else { - data->state = LV_INDEV_STATE_REL; - } - - /*Set the last pressed coordinates*/ - data->point.x = last_x; - data->point.y = last_y; - - /*Return `false` because we are not buffering and no more data to read*/ - return false; -} - -/*Return true is the touchpad is pressed*/ -static bool touchpad_is_pressed(void) -{ - /*Your code comes here*/ - - return false; -} - -/*Get the x and y coordinates if the touchpad is pressed*/ -static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y) -{ - /*Your code comes here*/ - - (*x) = 0; - (*y) = 0; -} - - -/*------------------ - * Mouse - * -----------------*/ - -/* Initialize your mouse */ -static void mouse_init(void) -{ - /*Your code comes here*/ -} - -/* Will be called by the library to read the mouse */ -static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) -{ - /*Get the current x and y coordinates*/ - mouse_get_xy(&data->point.x, &data->point.y); - - /*Get whether the mouse button is pressed or released*/ - if(mouse_is_pressed()) { - data->state = LV_INDEV_STATE_PR; - } else { - data->state = LV_INDEV_STATE_REL; - } - - /*Return `false` because we are not buffering and no more data to read*/ - return false; -} - -/*Return true is the mouse button is pressed*/ -static bool mouse_is_pressed(void) -{ - /*Your code comes here*/ - - return false; -} - -/*Get the x and y coordinates if the mouse is pressed*/ -static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y) -{ - /*Your code comes here*/ - - (*x) = 0; - (*y) = 0; -} - -/*------------------ - * Keypad - * -----------------*/ - -/* Initialize your keypad */ -static void keypad_init(void) -{ - /*Your code comes here*/ -} - -/* Will be called by the library to read the mouse */ -static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) -{ - static uint32_t last_key = 0; - - /*Get the current x and y coordinates*/ - mouse_get_xy(&data->point.x, &data->point.y); - - /*Get whether the a key is pressed and save the pressed key*/ - uint32_t act_key = keypad_get_key(); - if(act_key != 0) { - data->state = LV_INDEV_STATE_PR; - - /*Translate the keys to LittlevGL control characters according to your key definitions*/ - switch(act_key) { - case 1: - act_key = LV_KEY_NEXT; - break; - case 2: - act_key = LV_KEY_PREV; - break; - case 3: - act_key = LV_KEY_LEFT; - break; - case 4: - act_key = LV_KEY_RIGHT; - break; - case 5: - act_key = LV_KEY_ENTER; - break; - } - - last_key = act_key; - } else { - data->state = LV_INDEV_STATE_REL; - } - - data->key = last_key; - - /*Return `false` because we are not buffering and no more data to read*/ - return false; -} - -/*Get the currently being pressed key. 0 if no key is pressed*/ -static uint32_t keypad_get_key(void) -{ - /*Your code comes here*/ - - return 0; -} - -/*------------------ - * Encoder - * -----------------*/ - -/* Initialize your keypad */ -static void encoder_init(void) -{ - /*Your code comes here*/ -} - -/* Will be called by the library to read the encoder */ -static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) -{ - - data->enc_diff = encoder_diff; - data->state = encoder_state; - - /*Return `false` because we are not buffering and no more data to read*/ - return false; -} - -/*Call this function in an interrupt to process encoder events (turn, press)*/ -static void encoder_handler(void) -{ - /*Your code comes here*/ - - encoder_diff += 0; - encoder_state = LV_INDEV_STATE_REL; -} - - -/*------------------ - * Button - * -----------------*/ - -/* Initialize your buttons */ -static void button_init(void) -{ - /*Your code comes here*/ -} - -/* Will be called by the library to read the button */ -static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) -{ - - static uint8_t last_btn = 0; - - /*Get the pressed button's ID*/ - int8_t btn_act = button_get_pressed_id(); - - if(btn_act >= 0) { - data->state = LV_INDEV_STATE_PR; - last_btn = btn_act; - } else { - data->state = LV_INDEV_STATE_REL; - } - - /*Save the last pressed button's ID*/ - data->btn_id = last_btn; - - /*Return `false` because we are not buffering and no more data to read*/ - return false; -} - -/*Get ID (0, 1, 2 ..) of the pressed button*/ -static int8_t button_get_pressed_id(void) -{ - uint8_t i; - - /*Check to buttons see which is being pressed (assume there are 2 buttons)*/ - for(i = 0; i < 2; i++) { - /*Return the pressed button's ID*/ - if(button_is_pressed(i)) { - return i; - } - } - - /*No button pressed*/ - return -1; -} - -/*Test if `id` button is pressed or not*/ -static bool button_is_pressed(uint8_t id) -{ - - /*Your code comes here*/ - - return false; -} - -#else /* Enable this file at the top */ - -/* This dummy typedef exists purely to silence -Wpedantic. */ -typedef int keep_pedantic_happy; -#endif diff --git a/src/libs/lvgl/porting/lv_port_indev_template.h b/src/libs/lvgl/porting/lv_port_indev_template.h deleted file mode 100644 index ca0274e8..00000000 --- a/src/libs/lvgl/porting/lv_port_indev_template.h +++ /dev/null @@ -1,45 +0,0 @@ - -/** - * @file lv_port_indev_templ.h - * - */ - - /*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/ -#if 0 - -#ifndef LV_PORT_INDEV_TEMPL_H -#define LV_PORT_INDEV_TEMPL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lvgl/lvgl.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - -/********************** - * MACROS - **********************/ - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_PORT_INDEV_TEMPL_H*/ - -#endif /*Disable/Enable content*/ diff --git a/src/libs/lvgl/scripts/built_in_font/DejaVuSans.ttf b/src/libs/lvgl/scripts/built_in_font/DejaVuSans.ttf new file mode 100644 index 00000000..52672188 Binary files /dev/null and b/src/libs/lvgl/scripts/built_in_font/DejaVuSans.ttf differ diff --git a/src/libs/lvgl/scripts/built_in_font/Montserrat-Medium.ttf b/src/libs/lvgl/scripts/built_in_font/Montserrat-Medium.ttf new file mode 100644 index 00000000..6e079f69 Binary files /dev/null and b/src/libs/lvgl/scripts/built_in_font/Montserrat-Medium.ttf differ diff --git a/src/libs/lvgl/scripts/built_in_font/Roboto-Regular.woff b/src/libs/lvgl/scripts/built_in_font/Roboto-Regular.woff deleted file mode 100644 index f823258a..00000000 Binary files a/src/libs/lvgl/scripts/built_in_font/Roboto-Regular.woff and /dev/null differ diff --git a/src/libs/lvgl/scripts/built_in_font/SimSun.woff b/src/libs/lvgl/scripts/built_in_font/SimSun.woff new file mode 100644 index 00000000..8d081746 Binary files /dev/null and b/src/libs/lvgl/scripts/built_in_font/SimSun.woff differ diff --git a/src/libs/lvgl/scripts/built_in_font/built_in_font_gen.py b/src/libs/lvgl/scripts/built_in_font/built_in_font_gen.py old mode 100644 new mode 100755 index db8e88c1..1a052646 --- a/src/libs/lvgl/scripts/built_in_font/built_in_font_gen.py +++ b/src/libs/lvgl/scripts/built_in_font/built_in_font_gen.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3.6 + import argparse from argparse import RawTextHelpFormatter import os @@ -5,33 +7,40 @@ import sys parser = argparse.ArgumentParser(description="""Create fonts for LittelvGL including the built-in symbols. lv_font_conv needs to be installed. See https://github.com/littlevgl/lv_font_conv Example: python built_in_font_gen.py --size 16 -o lv_font_roboto_16.c --bpp 4 -r 0x20-0x7F""", formatter_class=RawTextHelpFormatter) -parser.add_argument('-s', '--size', - type=int, - metavar = 'px', - nargs='?', +parser.add_argument('-s', '--size', + type=int, + metavar = 'px', + nargs='?', help='Size of the font in px') -parser.add_argument('--bpp', - type=int, - metavar = '1,2,4', - nargs='?', +parser.add_argument('--bpp', + type=int, + metavar = '1,2,4', + nargs='?', help='Bit per pixel') -parser.add_argument('-r', '--range', - nargs='+', - metavar = 'start-end', - default='0x20-0x7F', +parser.add_argument('-r', '--range', + nargs='+', + metavar = 'start-end', + default=['0x20-0x7F,0xB0,0x2022'], help='Ranges and/or characters to include. Default is 0x20-7F (ASCII). E.g. -r 0x20-0x7F, 0x200, 324') -parser.add_argument('--font', - metavar = 'file', - nargs='?', - default='Roboto-Regular.woff', +parser.add_argument('--symbols', + nargs='+', + metavar = 'sym', + default=[''], + help=u'Symbols to include. E.g. -s ÁÉŐ'.encode('utf-8')) +parser.add_argument('--font', + metavar = 'file', + nargs='?', + default='Montserrat-Medium.ttf', help='A TTF or WOFF file') -parser.add_argument('-o', '--output', - nargs='?', - metavar='file', +parser.add_argument('-o', '--output', + nargs='?', + metavar='file', help='Output file name. E.g. my_font_20.c') parser.add_argument('--compressed', action='store_true', help='Compress the bitmaps') - +parser.add_argument('--subpx', action='store_true', + help='3 times wider letters for sub pixel rendering') + args = parser.parse_args() if args.compressed == False: @@ -39,9 +48,12 @@ if args.compressed == False: else: compr = "" +if len(args.symbols[0]) != 0: + args.symbols[0] = "--symbols " + args.symbols[0] + #Built in symbols syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650" -#Run the command -cmd = "lv_font_conv {} --bpp {} --size {} --font Roboto-Regular.woff -r {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.range[0], syms, args.output) +#Run the command (Add degree and bbullet symbol) +cmd = "lv_font_conv {} --bpp {} --size {} --font {} -r {} {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.font, args.range[0], args.symbols[0], syms, args.output) os.system(cmd) diff --git a/src/libs/lvgl/scripts/built_in_font/generate_all.py b/src/libs/lvgl/scripts/built_in_font/generate_all.py new file mode 100755 index 00000000..dab551f6 --- /dev/null +++ b/src/libs/lvgl/scripts/built_in_font/generate_all.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3.6 + +import os + +print("Generating 8 px") +os.system("./built_in_font_gen.py --size 8 -o lv_font_montserrat_8.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_8.c') + +print("\nGenerating 10 px") +os.system("./built_in_font_gen.py --size 10 -o lv_font_montserrat_10.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_10.c') + +print("\nGenerating 12 px") +os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12.c') + +print("\nGenerating 14 px") +os.system("./built_in_font_gen.py --size 14 -o lv_font_montserrat_14.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_14.c') + +print("\nGenerating 16 px") +os.system("./built_in_font_gen.py --size 16 -o lv_font_montserrat_16.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_16.c') + +print("\nGenerating 18 px") +os.system("./built_in_font_gen.py --size 18 -o lv_font_montserrat_18.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_18.c') + +print("\nGenerating 20 px") +os.system("./built_in_font_gen.py --size 20 -o lv_font_montserrat_20.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_20.c') + +print("\nGenerating 22 px") +os.system("./built_in_font_gen.py --size 22 -o lv_font_montserrat_22.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_22.c') + +print("\nGenerating 24 px") +os.system("./built_in_font_gen.py --size 24 -o lv_font_montserrat_24.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_24.c') + +print("\nGenerating 26 px") +os.system("./built_in_font_gen.py --size 26 -o lv_font_montserrat_26.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_26.c') + +print("\nGenerating 28 px") +os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28.c') + +print("\nGenerating 30 px") +os.system("./built_in_font_gen.py --size 30 -o lv_font_montserrat_30.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_30.c') + +print("\nGenerating 32 px") +os.system("./built_in_font_gen.py --size 32 -o lv_font_montserrat_32.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_32.c') + +print("\nGenerating 34 px") +os.system("./built_in_font_gen.py --size 34 -o lv_font_montserrat_34.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_34.c') + +print("\nGenerating 36 px") +os.system("./built_in_font_gen.py --size 36 -o lv_font_montserrat_36.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_36.c') + +print("\nGenerating 38 px") +os.system("./built_in_font_gen.py --size 38 -o lv_font_montserrat_38.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_38.c') + +print("\nGenerating 40 px") +os.system("./built_in_font_gen.py --size 40 -o lv_font_montserrat_40.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_40.c') + +print("\nGenerating 42 px") +os.system("./built_in_font_gen.py --size 42 -o lv_font_montserrat_42.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_42.c') + +print("\nGenerating 44 px") +os.system("./built_in_font_gen.py --size 44 -o lv_font_montserrat_44.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_44.c') + +print("\nGenerating 46 px") +os.system("./built_in_font_gen.py --size 46 -o lv_font_montserrat_46.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_46.c') + +print("\nGenerating 48 px") +os.system("./built_in_font_gen.py --size 48 -o lv_font_montserrat_48.c --bpp 4") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_48.c') + +print("\nGenerating 12 px subpx") +os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12_subpx.c --bpp 4 --subpx") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12_subpx.c') + +print("\nGenerating 28 px compressed") +os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28_compressed.c --bpp 4 --compressed") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28_compressed.c') + +print("\nGenerating 16 px CJK") +os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8')) +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c') + +print("\nGenerating 16 px Hebrew, Persian") +os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF") +os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_dejavu_16_persian_hebrew.c') diff --git a/src/libs/lvgl/scripts/clang-formatter.sh b/src/libs/lvgl/scripts/clang-formatter.sh deleted file mode 100755 index d831917c..00000000 --- a/src/libs/lvgl/scripts/clang-formatter.sh +++ /dev/null @@ -1,13 +0,0 @@ -clang-format-7 -style=file ../src/lv_core/*.c -i -clang-format-7 -style=file ../src/lv_draw/*.c -i -clang-format-7 -style=file ../src/lv_hal/*.c -i -clang-format-7 -style=file ../src/lv_misc/*.c -i -clang-format-7 -style=file ../src/lv_objx/*.c -i -clang-format-7 -style=file ../src/lv_themes/*.c -i - -clang-format-7 -style=file ../src/lv_core/*.h -i -clang-format-7 -style=file ../src/lv_draw/*.h -i -clang-format-7 -style=file ../src/lv_hal/*.h -i -clang-format-7 -style=file ../src/lv_misc/*.h -i -clang-format-7 -style=file ../src/lv_objx/*.h -i -clang-format-7 -style=file ../src/lv_themes/*.h -i diff --git a/src/libs/lvgl/scripts/code-format.cfg b/src/libs/lvgl/scripts/code-format.cfg new file mode 100644 index 00000000..0d786927 --- /dev/null +++ b/src/libs/lvgl/scripts/code-format.cfg @@ -0,0 +1,49 @@ +--style=kr +--indent=spaces=4 +--indent-classes +--indent-switches +--indent-cases +--indent-preproc-block +--indent-preproc-define +--indent-col1-comments +--pad-oper +--unpad-paren +--align-pointer=middle +--align-reference=middle +--convert-tabs +--max-code-length=120 +--break-after-logical +--break-closing-braces +--attach-closing-while +--min-conditional-indent=0 +--max-continuation-indent=120 +--mode=c +--lineend=linux +--recursive +--suffix=none +--preserve-date +--formatted +--exclude=lv_conf_internal.h +--exclude=../src/lv_font/lv_font_montserrat_12.c +--exclude=../src/lv_font/lv_font_montserrat_14.c +--exclude=../src/lv_font/lv_font_montserrat_16.c +--exclude=../src/lv_font/lv_font_montserrat_18.c +--exclude=../src/lv_font/lv_font_montserrat_20.c +--exclude=../src/lv_font/lv_font_montserrat_22.c +--exclude=../src/lv_font/lv_font_montserrat_24.c +--exclude=../src/lv_font/lv_font_montserrat_26.c +--exclude=../src/lv_font/lv_font_montserrat_28.c +--exclude=../src/lv_font/lv_font_montserrat_30.c +--exclude=../src/lv_font/lv_font_montserrat_32.c +--exclude=../src/lv_font/lv_font_montserrat_34.c +--exclude=../src/lv_font/lv_font_montserrat_36.c +--exclude=../src/lv_font/lv_font_montserrat_38.c +--exclude=../src/lv_font/lv_font_montserrat_40.c +--exclude=../src/lv_font/lv_font_montserrat_42.c +--exclude=../src/lv_font/lv_font_montserrat_44.c +--exclude=../src/lv_font/lv_font_montserrat_46.c +--exclude=../src/lv_font/lv_font_montserrat_48.c +--exclude=../src/lv_font/lv_font_montserrat_12_subpx.c +--exclude=../src/lv_font/lv_font_montserrat_28_compressed.c +--exclude=../src/lv_font/lv_font_simsun_16_cjk.c +--exclude=../src/lv_font/lv_font_dejavu_16_persian_hebrew.c diff --git a/src/libs/lvgl/scripts/code-format.sh b/src/libs/lvgl/scripts/code-format.sh new file mode 100755 index 00000000..561f4330 --- /dev/null +++ b/src/libs/lvgl/scripts/code-format.sh @@ -0,0 +1 @@ +astyle --options=code-format.cfg "../src/*.c,*.h" diff --git a/src/libs/lvgl/scripts/cppcheck_run.sh b/src/libs/lvgl/scripts/cppcheck_run.sh index 1db16fc9..3916c767 100755 --- a/src/libs/lvgl/scripts/cppcheck_run.sh +++ b/src/libs/lvgl/scripts/cppcheck_run.sh @@ -1,2 +1 @@ -cppcheck --template="{severity}\t{file}:{line}\t{id}: {message}" --enable=all ../src/ --output-file=cppcheck_res.txt --suppress=unusedFunction --suppress=preprocessorErrorDirective --force - +cppcheck -j8 --template="{severity}\t{file}:{line}\t{id}: {message}" --enable=all ../src/ --output-file=cppcheck_res.txt --suppress=unusedFunction --suppress=preprocessorErrorDirective --force diff --git a/src/libs/lvgl/scripts/infer_run.sh b/src/libs/lvgl/scripts/infer_run.sh new file mode 100755 index 00000000..f1d12235 --- /dev/null +++ b/src/libs/lvgl/scripts/infer_run.sh @@ -0,0 +1,9 @@ +# https://github.com/facebook/infer +# +# Install: +# VERSION=0.17.0; \ +# curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux64-v$VERSION.tar.xz" \ +# | sudo tar -C /opt -xJ && \ +# sudoln -s "/opt/infer-linux64-v$VERSION/bin/infer" /usr/local/bin/infer + +infer run -- make -j8 diff --git a/src/libs/lvgl/scripts/lv_conf_checker.py b/src/libs/lvgl/scripts/lv_conf_checker.py index c2171ff8..55aeea82 100755 --- a/src/libs/lvgl/scripts/lv_conf_checker.py +++ b/src/libs/lvgl/scripts/lv_conf_checker.py @@ -1,25 +1,63 @@ -#!/usr/bin/env python3.6 +#!/usr/bin/env python3 ''' -Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values +Generates a checker file for lv_conf.h from lv_conf_template.h define all the not defined values ''' - +import sys import re -fin = open("../lv_conf_template.h", "r") -fout = open("../src/lv_conf_checker.h", "w") +if sys.version_info < (3,6,0): + print("Python >=3.6 is required", file=sys.stderr) + exit(1) +fin = open("../lv_conf_template.h", "r") +fout = open("../src/lv_conf_internal.h", "w") fout.write( '''/** * GENERATED FILE, DO NOT EDIT IT! - * @file lv_conf_checker.h + * @file lv_conf_internal.h * Make sure all the defines of lv_conf.h have a default value **/ -#ifndef LV_CONF_CHECKER_H -#define LV_CONF_CHECKER_H +#ifndef LV_CONF_INTERNAL_H +#define LV_CONF_INTERNAL_H +/* clang-format off */ + +#include + +/* Handle special Kconfig options */ +#include "lv_conf_kconfig.h" + +#ifdef CONFIG_LV_CONF_SKIP +#define LV_CONF_SKIP +#endif + +/* If "lv_conf.h" is available from here try to use it later.*/ +#if defined __has_include +# if __has_include("lv_conf.h") +# ifndef LV_CONF_INCLUDE_SIMPLE +# define LV_CONF_INCLUDE_SIMPLE +# endif +# endif +#endif + +/*If lv_conf.h is not skipped include it*/ +#if !defined(LV_CONF_SKIP) +# if defined(LV_CONF_PATH) /*If there is a path defined for lv_conf.h use it*/ +# define __LV_TO_STR_AUX(x) #x +# define __LV_TO_STR(x) __LV_TO_STR_AUX(x) +# include __LV_TO_STR(LV_CONF_PATH) +# undef __LV_TO_STR_AUX +# undef __LV_TO_STR +# elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/ +# include "lv_conf.h" +# else +# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder */ +# endif +#endif + ''' ) @@ -36,23 +74,70 @@ for i in fin.read().splitlines(): if '/*--END OF LV_CONF_H--*/' in i: break r = re.search(r'^ *# *define ([^\s]+).*$', i) - + +#ifndef LV_USE_BTN /*Only if not defined in lv_conf.h*/ +# ifdef CONFIG_LV_USE_BTN /*Use KConfig value if set*/ +# define LV_USE_BTN CONFIG_LV_USE_BTN +# else +# define LV_USE_BTN 1 /*Use default value*/ +# endif +#endif + if r: line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros + dr = re.sub('.*# *define', '', i, 1) + d = "# define " + dr + fout.write( f'#ifndef {line}\n' - f'{i}\n' - '#endif\n' + f'# ifdef CONFIG_{line.upper()}\n' + f'# define {line} CONFIG_{line.upper()}\n' + f'# else\n' + f'{d}\n' + f'# endif\n' + f'#endif\n' ) elif re.search('^ *typedef .*;.*$', i): continue #ignore typedefs to avoide redeclaration else: fout.write(f'{i}\n') - fout.write( ''' -#endif /*LV_CONF_CHECKER_H*/ + +/*If running without lv_conf.h add typdesf with default value*/ +#if defined(LV_CONF_SKIP) + + /* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ + typedef int16_t lv_coord_t; + +# if LV_USE_ANIMATION + /*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ + typedef void * lv_anim_user_data_t; +# endif + +# if LV_USE_GROUP + typedef void * lv_group_user_data_t; +# endif + +# if LV_USE_FILESYSTEM + typedef void * lv_fs_drv_user_data_t; +# endif + + typedef void * lv_img_decoder_user_data_t; + + typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ + typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/ + + typedef void * lv_font_user_data_t; + +# if LV_USE_USER_DATA + typedef void * lv_obj_user_data_t; +# endif + +#endif + +#endif /*LV_CONF_INTERNAL_H*/ ''' ) diff --git a/src/libs/lvgl/scripts/release/com.py b/src/libs/lvgl/scripts/release/com.py new file mode 100755 index 00000000..5b5300e9 --- /dev/null +++ b/src/libs/lvgl/scripts/release/com.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python + +import sys +import os.path +from os import path +import os, fnmatch +import re +import subprocess +import com + +def cmd(c, ask_on_err = True): + print("\n" + c) + r = os.system(c) + if r: + print("### Error: " + str(r)) + if ask_on_err: + input("Press Enter to continue execution...") + +def define_set(fn, name, value): + print("In " + fn + " set " + name + " to " + value) + + new_content = "" + s = r'^ *# *define +' + str(name).rstrip() + ' +' + + f = open(fn, "r") + for i in f.read().splitlines(): + r = re.search(s, i) + if r: + d = i.split("define") + i = d[0] + "define " + name + " " + value + new_content += i + '\n' + + f.close() + + f = open(fn, "w") + f.write(new_content) + f.close() + +def ver_format(ver): + s = "v" + str(ver[0]) + "." + str(ver[1]) + "." + str(ver[2]) + if(ver[3] != ""): s = s + "-" + ver[3] + return s + +def get_lvgl_version(br): + print("Get LVGL's version") + + ver = [0, 0, 0, ""] + + os.chdir("./lvgl") + + com.cmd("git checkout " + br) + + f = open("./lvgl.h", "r") + + lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+') + for i in f.read().splitlines(): + r = re.search(r'^#define LVGL_VERSION_MAJOR ', i) + if r: + m = lastNum.search(i) + if m: ver[0] = m.group(1) + + r = re.search(r'^#define LVGL_VERSION_MINOR ', i) + if r: + m = lastNum.search(i) + if m: ver[1] = m.group(1) + + r = re.search(r'^#define LVGL_VERSION_PATCH ', i) + if r: + m = lastNum.search(i) + if m: ver[2] = m.group(1) + + f.close() + + com.cmd("git checkout master") + + os.chdir("../") + return ver + +def push(c): + cmd("git push " + c) + +def update_version(ver): + ver_str = ver_format(ver) + ver_num = ver[0] + "." + ver[1] + "." + ver[2] + + templ = fnmatch.filter(os.listdir('.'), '*_templ*.h') + + if len(templ) > 0 and templ[0]: + print("Updating version in " + templ[0]) + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ "v" + ver_num + "/' " + templ[0]) + + if os.path.exists("library.json"): + print("Updating version in library.json") + cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_num +"/' library.json") + + if path.exists("library.properties"): + print("Updating version in library.properties") + cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_num + "/' library.properties") + + if path.exists("conf.py"): + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/" + ver_str + "/' conf.py") + + if path.exists("Kconfig"): + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/" + ver_str + "/' Kconfig") + + if path.exists("lvgl.h"): + define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver[0])) + define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver[1])) + define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver[2])) + define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"" + ver[3] + "\"") diff --git a/src/libs/lvgl/scripts/release/dev.py b/src/libs/lvgl/scripts/release/dev.py new file mode 100755 index 00000000..7b53fe53 --- /dev/null +++ b/src/libs/lvgl/scripts/release/dev.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +import re +import os, fnmatch +import os.path +from os import path +from datetime import date +import com + +def lvgl_update_ver(ver, br): + os.chdir("./lvgl") + + com.cmd("git checkout " + br) + com.update_version(ver) + com.cmd("git commit -am 'Update " + br + " version'") + com.push("origin " + br) + com.cmd("git checkout master") + + os.chdir("../") + +def docs_update_ver(ver, br): + os.chdir("./docs") + com.cmd("git checkout " + br + " --") + com.update_version(ver) + com.cmd("git commit -am 'Update " + br + " version'") + com.push("origin " + br) + com.cmd("git checkout master --") + + os.chdir("../") + +def merge_dev_to_master(): + os.chdir("./lvgl") + com.cmd("git checkout master") + com.cmd("git merge dev") + com.push("origin master") + os.chdir("../") + + os.chdir("./docs") + com.cmd("git checkout dev -- ") #'dev' sometimes is not recognized so switch to it first + com.cmd("git checkout latest --") + com.cmd("git merge dev -X theirs --no-edit;") + com.push("origin latest") + os.chdir("../") + +def make(mode): + if(mode == "bugfix"): + ver = com.get_lvgl_version("master") + ver[3] = "dev" + ver[2] = str(int(ver[2]) + 1) + lvgl_update_ver(ver, "master") + docs_update_ver(ver, "latest") + else: + ver = com.get_lvgl_version("dev") + ver[3] = "dev" + merge_dev_to_master() + if(mode == "major"): + ver[0] = str(int(ver[0]) + 1) + ver[1] = '0' + ver[2] = '0' + if(mode == "minor"): + ver[1] = str(int(ver[1]) + 1) + ver[2] = '0' + + lvgl_update_ver(ver, "dev") + docs_update_ver(ver, "dev") + +if __name__ == '__main__': + if(len(sys.argv) != 2): + print("Missing argument. Usage ./dev.py major | minor | bugfix") + print("E.g. ./dev.py minor") + else: + make(sys.argv[1]) diff --git a/src/libs/lvgl/scripts/release/main.py b/src/libs/lvgl/scripts/release/main.py new file mode 100755 index 00000000..ba9ab204 --- /dev/null +++ b/src/libs/lvgl/scripts/release/main.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + +import os.path +from os import path +from datetime import date +import sys +import com +import release +import dev +import proj + +upstream_org_url = "https://github.com/lvgl/" +workdir = "./release_tmp" +proj_list = [ "lv_sim_eclipse_sdl", "lv_sim_emscripten"] + +def upstream(repo): + return upstream_org_url + repo + ".git" + +def clone(repo): + com.cmd("git clone --recurse-submodules " + upstream(repo)) + os.chdir("./" + repo) + com.cmd("git checkout master") + com.cmd("git remote update origin --prune") + com.cmd("git pull origin --tags") + os.chdir("..") + +def clone_repos(): + com.cmd("rm -fr " + workdir) + com.cmd("mkdir " + workdir) + os.chdir(workdir) + clone("lvgl") + clone("lv_examples") + clone("lv_drivers") + clone("docs") + clone("blog") + + for p in proj_list: + clone(p) + +def cleanup(): + os.chdir("../") + com.cmd("rm -fr " + workdir) + +if __name__ == '__main__': + prepare_type = ['major', 'minor', 'bugfix'] + dev_prepare = 'minor' + +# if(len(sys.argv) != 2): +# print("Missing argument. Usage ./release.py bugfix | minor | major") +# print("Use minor by default") +# else: +# dev_prepare = sys.argv[1] + + if not (dev_prepare in prepare_type): + print("Invalid argument. Usage ./release.py bugfix | minor | major") + exit(1) + + #os.chdir(workdir) + clone_repos() + release.make() + for p in proj_list: + proj.make(p, True) + + dev.make(dev_prepare) + #cleanup() diff --git a/src/libs/lvgl/scripts/release/proj.py b/src/libs/lvgl/scripts/release/proj.py new file mode 100755 index 00000000..c28fd320 --- /dev/null +++ b/src/libs/lvgl/scripts/release/proj.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +import sys +import os.path +from os import path +import re +import subprocess +import com + +def make(repo_path, auto_push = False): + os.chdir("./" + repo_path) + com.cmd('git checkout master') + print("Update lvgl"); + os.chdir("./lvgl") + com.cmd("git checkout master") + com.cmd("git pull origin --tags") + + out = subprocess.Popen(['git', 'tag', '--sort=-creatordate'], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + stdout,stderr = out.communicate() + + ver_str = stdout.decode("utf-8").split('\n')[0] + release_br = ver_str[1:] #trim "v" + release_br = release_br.split('.')[0] # get the first number + release_br = "release/v" + release_br + + com.cmd("git checkout " + release_br + "; git pull origin " + release_br) + + os.chdir("..") + + com.cmd("cp -f lvgl/lv_conf_template.h lv_conf.h") + com.cmd("sed -i -r 's/#if 0/#if 1/' lv_conf.h") # Enable lv_conf.h + with open("confdef.txt") as f: + for line in f: + (key, val) = line.rstrip().split('\t') + com.define_set("lv_conf.h", str(key), str(val)) + + if os.path.exists("lv_examples"): + print("Update lv_examples"); + com.cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br) + + if os.path.exists("lv_drivers"): + print("update lv_drivers"); + com.cmd("cd lv_drivers " + release_br + "; git pull origin " + release_br) + + msg = 'Update to ' + ver_str + com.cmd("git add .") + com.cmd('git commit -am "' + msg + '"') + com.cmd("git tag -a " + ver_str + " -m '" + msg + "' " ) + if auto_push: + com.push("origin --tags") + com.push("origin master") + + os.chdir("../") + +if __name__ == '__main__': + if(len(sys.argv) != 2): + print("Missing argument. Usage ./projs_update.py repo_path") + print("E.g. ./projs_update.py ./lv_sim_eclipse_sdl") + else: + make(sys.argv[1], sys.argv[2]) diff --git a/src/libs/lvgl/scripts/release/release.py b/src/libs/lvgl/scripts/release/release.py new file mode 100755 index 00000000..1e6037df --- /dev/null +++ b/src/libs/lvgl/scripts/release/release.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python + +import os.path +from os import path +from datetime import date +import sys +import com +import re + +def update_release_branch(release_br, master_br = "master"): + com.cmd("git checkout " + release_br) + com.cmd("git pull origin " + release_br) + com.cmd("git merge "+ master_br +" -X ours"); + com.push("origin " + release_br); + com.cmd("git checkout master"); + +def lvgl_release(ver): + print("Release lvgl") + + ver_str = com.ver_format(ver) + release_br = "release/v" + str(ver[0]) + + os.chdir("./lvgl") + com.define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"') + + # Run some scripts + os.chdir("./scripts") + com.cmd("./code-format.sh") + com.cmd("./lv_conf_checker.py") + com.cmd("doxygen") + os.chdir("../") + + com.update_version(ver) + + #update CHANGLELOG + new_content = "" + f = open("./CHANGELOG.md", "r") + + release_note = "" + note_state = 0 + for i in f.read().splitlines(): + if note_state == 0: + r = re.search(r'^## ' + ver_str, i) + if r: + i = i.replace("planned on ", "") + note_state+=1 + + elif note_state == 1: + r = re.search(r'^## ', i) + if r: + note_state+=1 + else: + release_note += i + '\n' + + new_content += i + '\n' + + f.close() + + f = open("./CHANGELOG.md", "w") + f.write(new_content) + f.close() + + com.cmd('git commit -am "Release ' + ver_str + '"') + + com.cmd('git checkout dev') + com.cmd("git merge master -X ours") + com.cmd("git add .") + com.cmd("git commit -am 'Merge master'", False) + com.push('origin dev') + com.cmd('git checkout master') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br) + + os.chdir("../") + + return release_note + +def lv_examples_release(ver): + print("Release lv_examples") + + os.chdir("./lv_examples") + release_br = "release/v" + str(ver[0]) + ver_str = com.ver_format(ver) + + com.update_version(ver) + + com.cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK\(" + str(ver[0]) + ", " + str(ver[1]) + ", " + str(ver[2]) + ")/' lv_examples.h") + + com.cmd('git commit -am "Release ' + ver_str + '"') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br) + + os.chdir("../") + +def lv_drivers_release(ver): + print("Release lv_drivers") + + os.chdir("./lv_drivers") + release_br = "release/v" + str(ver[0]) + ver_str = com.ver_format(ver) + + com.update_version(ver) + + com.cmd('git commit -am "Release ' + ver_str + '"') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br) + + os.chdir("../") + +def docs_release(ver): + print("Release docs") + + os.chdir("./docs") + release_br = "release/v" + str(ver[0]) + ver_str = com.ver_format(ver) + + com.cmd("git co latest --") + com.cmd("rm -rf xml"); + com.cmd("cp -r ../lvgl/docs/api_doc/xml ."); + com.cmd("git add xml"); + + com.update_version(ver) + + com.cmd('git commit -am "Release ' + ver_str + '"') + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.push('origin master') + com.push('origin --tags') + + update_release_branch(release_br, "latest") + + os.chdir("../") + +def blog_release(ver, release_note): + + os.chdir("./blog/_posts") + + ver_str = com.ver_format(ver) + + post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n" + post += release_note + + today = date.today() + d = today.strftime("%Y-%m-%d") + + f = open(d + "-release_" + ver_str + ".md", "w") + f.write(post) + f.close() + + com.cmd("git add .") + com.cmd("git commit -am 'Add " + ver_str + " release post'") + com.push('origin master') + + os.chdir("../../") + +def make(): + ver = com.get_lvgl_version("master") + release_note = lvgl_release(ver) + lv_examples_release(ver) + lv_drivers_release(ver) + docs_release(ver) + blog_release(ver, release_note) + +if __name__ == '__main__': + make() diff --git a/src/libs/lvgl/src/lv_api_map.h b/src/libs/lvgl/src/lv_api_map.h new file mode 100644 index 00000000..bd58d1aa --- /dev/null +++ b/src/libs/lvgl/src/lv_api_map.h @@ -0,0 +1,232 @@ +/** + * @file lv_api_map.h + * + */ + +#ifndef LV_API_MAP_H +#define LV_API_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lvgl.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/*--------------------- + * V6.0 COMPATIBILITY + *--------------------*/ +#if LV_USE_API_EXTENSION_V6 + +static inline void lv_task_once(lv_task_t * task) +{ + lv_task_set_repeat_count(task, 1); +} + +#if LV_USE_CHECKBOX + +#define lv_checkbox_set_static_text lv_checkbox_set_text_static + +#endif + +#if LV_USE_CHART + +#define lv_chart_get_point_cnt lv_chart_get_point_count + +#endif + +#if LV_USE_DROPDOWN + +static inline void lv_dropdown_set_draw_arrow(lv_obj_t * ddlist, bool en) +{ + if(en) lv_dropdown_set_symbol(ddlist, LV_SYMBOL_DOWN); + else lv_dropdown_set_symbol(ddlist, NULL); +} + +static inline bool lv_dropdown_get_draw_arrow(lv_obj_t * ddlist) +{ + if(lv_dropdown_get_symbol(ddlist)) return true; + else return false; +} + +#define lv_dropdown_set_static_options lv_dropdown_set_options_static + +#endif + +#if LV_USE_BAR + +/** + * Make the bar symmetric to zero. The indicator will grow from zero instead of the minimum + * position. + * @param bar pointer to a bar object + * @param en true: enable disable symmetric behavior; false: disable + * @deprecated As of v7.0, you should use `lv_bar_set_type` instead. + */ +static inline void lv_bar_set_sym(lv_obj_t * bar, bool en) +{ + if(en) + lv_bar_set_type(bar, LV_BAR_TYPE_SYMMETRICAL); + else + lv_bar_set_type(bar, LV_BAR_TYPE_NORMAL); +} + +/** + * Get whether the bar is symmetric or not. + * @param bar pointer to a bar object + * @return true: symmetric is enabled; false: disable + * @deprecated As of v7.0, you should use `lv_bar_get_type` instead. + */ +static inline bool lv_bar_get_sym(lv_obj_t * bar) +{ + return lv_bar_get_type(bar) == LV_BAR_TYPE_SYMMETRICAL; +} + +#endif + +#if LV_USE_LABEL + +#define lv_label_set_static_text lv_label_set_text_static + +#endif + +#if LV_USE_SLIDER + +/** + * Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum + * position. + * @param slider pointer to a bar object + * @param en true: enable disable symmetric behavior; false: disable + * @deprecated As of v7.0, you should use `lv_slider_set_type` instead. + */ +static inline void lv_slider_set_sym(lv_obj_t * slider, bool en) +{ + lv_bar_set_sym(slider, en); +} + +/** + * Get whether the slider is symmetric or not. + * @param slider pointer to a slider object + * @return true: symmetric is enabled; false: disable + * @deprecated As of v7.0, you should use `lv_slider_get_type` instead. + */ +static inline bool lv_slider_get_sym(lv_obj_t * slider) +{ + return lv_bar_get_sym(slider); +} + +#endif + +#if LV_USE_ROLLER + +/** + * Set a fixed width for the roller. + * @param roller pointer to a roller object + * @param w width + * @deprecated As of v7.0, you should use `lv_roller_set_auto_fit` and set the width normally instead. + */ +static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w) +{ + lv_roller_set_auto_fit(roller, false); + lv_obj_set_width(roller, w); +} + +#endif + +#if LV_USE_PAGE +#define lv_scrlbar_mode_t lv_scrollbar_mode_t + +#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF +#define LV_SCRLBAR_MODE_ON LV_SCROLLBAR_MODE_ON +#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG +#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO +#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE +#define LV_SCRLBAR_MODE_UNHIDE LV_SCROLLBAR_MODE_UNHIDE + +static inline void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode) +{ + lv_page_set_scrollbar_mode(page, sb_mode); +} +static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page) +{ + return lv_page_get_scrollbar_mode(page); +} + +static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page) +{ + return lv_page_get_scrollable(page); +} +#endif + +#endif /*LV_USE_API_EXTENSION_V6*/ + +/*--------------------- + * V7.0 COMPATIBILITY + *--------------------*/ +#if LV_USE_API_EXTENSION_V7 + +#if LV_USE_ROLLER +#define LV_ROLLER_MODE_INIFINITE LV_ROLLER_MODE_INFINITE +#endif + +#if LV_USE_WIN + +static inline lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src) +{ + return lv_win_add_btn_right(win, img_src); +} + +#endif + +#if LV_USE_CHART +static inline void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax) +{ + lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax); +} + +static inline void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * series) +{ + lv_chart_clear_series(chart, series); +} + +#endif + +static inline void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, + lv_coord_t y_ofs) +{ + lv_obj_align_mid(obj, base, align, x_ofs, y_ofs); +} + +static inline void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs) +{ + lv_obj_align_mid_y(obj, base, align, x_ofs); +} + +static inline void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs) +{ + lv_obj_align_mid_y(obj, base, align, y_ofs); +} + +#endif /*LV_USE_API_EXTENSION_V6*/ +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_API_MAP_H*/ diff --git a/src/libs/lvgl/src/lv_conf_checker.h b/src/libs/lvgl/src/lv_conf_checker.h deleted file mode 100644 index 4b0d9a67..00000000 --- a/src/libs/lvgl/src/lv_conf_checker.h +++ /dev/null @@ -1,851 +0,0 @@ -/** - * GENERATED FILE, DO NOT EDIT IT! - * @file lv_conf_checker.h - * Make sure all the defines of lv_conf.h have a default value -**/ - -#ifndef LV_CONF_CHECKER_H -#define LV_CONF_CHECKER_H -/* clang-format off */ - -#include - -/*==================== - Graphical settings - *====================*/ - -/* Maximal horizontal and vertical resolution to support by the library.*/ -#ifndef LV_HOR_RES_MAX -#define LV_HOR_RES_MAX (480) -#endif -#ifndef LV_VER_RES_MAX -#define LV_VER_RES_MAX (320) -#endif - -/* Color depth: - * - 1: 1 byte per pixel - * - 8: RGB233 - * - 16: RGB565 - * - 32: ARGB8888 - */ -#ifndef LV_COLOR_DEPTH -#define LV_COLOR_DEPTH 16 -#endif - -/* Swap the 2 bytes of RGB565 color. - * Useful if the display has a 8 bit interface (e.g. SPI)*/ -#ifndef LV_COLOR_16_SWAP -#define LV_COLOR_16_SWAP 0 -#endif - -/* 1: Enable screen transparency. - * Useful for OSD or other overlapping GUIs. - * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/ -#ifndef LV_COLOR_SCREEN_TRANSP -#define LV_COLOR_SCREEN_TRANSP 0 -#endif - -/*Images pixels with this color will not be drawn (with chroma keying)*/ -#ifndef LV_COLOR_TRANSP -#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ -#endif - -/* Enable chroma keying for indexed images. */ -#ifndef LV_INDEXED_CHROMA -#define LV_INDEXED_CHROMA 1 -#endif - -/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ -#ifndef LV_ANTIALIAS -#define LV_ANTIALIAS 1 -#endif - -/* Default display refresh period. - * Can be changed in the display driver (`lv_disp_drv_t`).*/ -#ifndef LV_DISP_DEF_REFR_PERIOD -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ -#endif - -/* Dot Per Inch: used to initialize default sizes. - * E.g. a button with width = LV_DPI / 2 -> half inch wide - * (Not so important, you can adjust it to modify default sizes and spaces)*/ -#ifndef LV_DPI -#define LV_DPI 100 /*[px]*/ -#endif - -/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ - -/*========================= - Memory manager settings - *=========================*/ - -/* LittelvGL's internal memory manager's settings. - * The graphical objects and other related data are stored here. */ - -/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */ -#ifndef LV_MEM_CUSTOM -#define LV_MEM_CUSTOM 0 -#endif -#if LV_MEM_CUSTOM == 0 -/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ -#ifndef LV_MEM_SIZE -# define LV_MEM_SIZE (32U * 1024U) -#endif - -/* Complier prefix for a big array declaration */ -#ifndef LV_MEM_ATTR -# define LV_MEM_ATTR -#endif - -/* Set an address for the memory pool instead of allocating it as an array. - * Can be in external SRAM too. */ -#ifndef LV_MEM_ADR -# define LV_MEM_ADR 0 -#endif - -/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */ -#ifndef LV_MEM_AUTO_DEFRAG -# define LV_MEM_AUTO_DEFRAG 1 -#endif -#else /*LV_MEM_CUSTOM*/ -#ifndef LV_MEM_CUSTOM_INCLUDE -# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ -#endif -#ifndef LV_MEM_CUSTOM_ALLOC -# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ -#endif -#ifndef LV_MEM_CUSTOM_FREE -# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ -#endif -#endif /*LV_MEM_CUSTOM*/ - -/* Garbage Collector settings - * Used if lvgl is binded to higher level language and the memory is managed by that language */ -#ifndef LV_ENABLE_GC -#define LV_ENABLE_GC 0 -#endif -#if LV_ENABLE_GC != 0 -#ifndef LV_GC_INCLUDE -# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -#endif -#ifndef LV_MEM_CUSTOM_REALLOC -# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ -#endif -#ifndef LV_MEM_CUSTOM_GET_SIZE -# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ -#endif -#endif /* LV_ENABLE_GC */ - -/*======================= - Input device settings - *=======================*/ - -/* Input device default settings. - * Can be changed in the Input device driver (`lv_indev_drv_t`)*/ - -/* Input device read period in milliseconds */ -#ifndef LV_INDEV_DEF_READ_PERIOD -#define LV_INDEV_DEF_READ_PERIOD 30 -#endif - -/* Drag threshold in pixels */ -#ifndef LV_INDEV_DEF_DRAG_LIMIT -#define LV_INDEV_DEF_DRAG_LIMIT 10 -#endif - -/* Drag throw slow-down in [%]. Greater value -> faster slow-down */ -#ifndef LV_INDEV_DEF_DRAG_THROW -#define LV_INDEV_DEF_DRAG_THROW 20 -#endif - -/* Long press time in milliseconds. - * Time to send `LV_EVENT_LONG_PRESSSED`) */ -#ifndef LV_INDEV_DEF_LONG_PRESS_TIME -#define LV_INDEV_DEF_LONG_PRESS_TIME 400 -#endif - -/* Repeated trigger period in long press [ms] - * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ -#ifndef LV_INDEV_DEF_LONG_PRESS_REP_TIME -#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 -#endif - -/*================== - * Feature usage - *==================*/ - -/*1: Enable the Animations */ -#ifndef LV_USE_ANIMATION -#define LV_USE_ANIMATION 1 -#endif -#if LV_USE_ANIMATION - -/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ - -#endif - -/* 1: Enable shadow drawing*/ -#ifndef LV_USE_SHADOW -#define LV_USE_SHADOW 1 -#endif - -/* 1: Enable object groups (for keyboard/encoder navigation) */ -#ifndef LV_USE_GROUP -#define LV_USE_GROUP 1 -#endif -#if LV_USE_GROUP -#endif /*LV_USE_GROUP*/ - -/* 1: Enable GPU interface*/ -#ifndef LV_USE_GPU -#define LV_USE_GPU 1 -#endif - -/* 1: Enable file system (might be required for images */ -#ifndef LV_USE_FILESYSTEM -#define LV_USE_FILESYSTEM 1 -#endif -#if LV_USE_FILESYSTEM -/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/ -#endif - -/*1: Add a `user_data` to drivers and objects*/ -#ifndef LV_USE_USER_DATA -#define LV_USE_USER_DATA 0 -#endif - -/*======================== - * Image decoder and cache - *========================*/ - -/* 1: Enable indexed (palette) images */ -#ifndef LV_IMG_CF_INDEXED -#define LV_IMG_CF_INDEXED 1 -#endif - -/* 1: Enable alpha indexed images */ -#ifndef LV_IMG_CF_ALPHA -#define LV_IMG_CF_ALPHA 1 -#endif - -/* Default image cache size. Image caching keeps the images opened. - * If only the built-in image formats are used there is no real advantage of caching. - * (I.e. no new image decoder is added) - * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - * However the opened images might consume additional RAM. - * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ -#ifndef LV_IMG_CACHE_DEF_SIZE -#define LV_IMG_CACHE_DEF_SIZE 1 -#endif - -/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ - -/*===================== - * Compiler settings - *====================*/ -/* Define a custom attribute to `lv_tick_inc` function */ -#ifndef LV_ATTRIBUTE_TICK_INC -#define LV_ATTRIBUTE_TICK_INC -#endif - -/* Define a custom attribute to `lv_task_handler` function */ -#ifndef LV_ATTRIBUTE_TASK_HANDLER -#define LV_ATTRIBUTE_TASK_HANDLER -#endif - -/* With size optimization (-Os) the compiler might not align data to - * 4 or 8 byte boundary. This alignment will be explicitly applied where needed. - * E.g. __attribute__((aligned(4))) */ -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -/* Attribute to mark large constant arrays for example - * font's bitmaps */ -#ifndef LV_ATTRIBUTE_LARGE_CONST -#define LV_ATTRIBUTE_LARGE_CONST -#endif - -/* Export integer constant to binding. - * This macro is used with constants in the form of LV_ that - * should also appear on lvgl binding API such as Micropython - * - * The default value just prevents a GCC warning. - */ -#ifndef LV_EXPORT_CONST_INT -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning -#endif - -/*=================== - * HAL settings - *==================*/ - -/* 1: use a custom tick source. - * It removes the need to manually update the tick with `lv_tick_inc`) */ -#ifndef LV_TICK_CUSTOM -#define LV_TICK_CUSTOM 0 -#endif -#if LV_TICK_CUSTOM == 1 -#ifndef LV_TICK_CUSTOM_INCLUDE -#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ -#endif -#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ -#endif -#endif /*LV_TICK_CUSTOM*/ - - -/*================ - * Log settings - *===============*/ - -/*1: Enable the log module*/ -#ifndef LV_USE_LOG -#define LV_USE_LOG 0 -#endif -#if LV_USE_LOG -/* How important log should be added: - * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - * LV_LOG_LEVEL_INFO Log important events - * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - * LV_LOG_LEVEL_NONE Do not log anything - */ -#ifndef LV_LOG_LEVEL -# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN -#endif - -/* 1: Print the log with 'printf'; - * 0: user need to register a callback with `lv_log_register_print_cb`*/ -#ifndef LV_LOG_PRINTF -# define LV_LOG_PRINTF 0 -#endif -#endif /*LV_USE_LOG*/ - -/*================= - * Debug settings - *================*/ - -/* If Debug is enabled LittelvGL validates the parameters of the functions. - * If an invalid parameter is found an error log message is printed and - * the MCU halts at the error. (`LV_USE_LOG` should be enabled) - * If you are debugging the MCU you can pause - * the debugger to see exactly where the issue is. - * - * The behavior of asserts can be overwritten by redefining them here. - * E.g. #define LV_ASSERT_MEM(p) - */ -#ifndef LV_USE_DEBUG -#define LV_USE_DEBUG 1 -#endif -#if LV_USE_DEBUG - -/*Check if the parameter is NULL. (Quite fast) */ -#ifndef LV_USE_ASSERT_NULL -#define LV_USE_ASSERT_NULL 1 -#endif - -/*Checks is the memory is successfully allocated or no. (Quite fast)*/ -#ifndef LV_USE_ASSERT_MEM -#define LV_USE_ASSERT_MEM 1 -#endif - -/* Check the strings. - * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) - * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ -#ifndef LV_USE_ASSERT_STR -#define LV_USE_ASSERT_STR 0 -#endif - -/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow) - * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ -#ifndef LV_USE_ASSERT_OBJ -#define LV_USE_ASSERT_OBJ 0 -#endif - -/*Check if the styles are properly initialized. (Fast)*/ -#ifndef LV_USE_ASSERT_STYLE -#define LV_USE_ASSERT_STYLE 1 -#endif - -#endif /*LV_USE_DEBUG*/ - -/*================ - * THEME USAGE - *================*/ -#ifndef LV_THEME_LIVE_UPDATE -#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/ -#endif - -#ifndef LV_USE_THEME_TEMPL -#define LV_USE_THEME_TEMPL 0 /*Just for test*/ -#endif -#ifndef LV_USE_THEME_DEFAULT -#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/ -#endif -#ifndef LV_USE_THEME_ALIEN -#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/ -#endif -#ifndef LV_USE_THEME_NIGHT -#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/ -#endif -#ifndef LV_USE_THEME_MONO -#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/ -#endif -#ifndef LV_USE_THEME_MATERIAL -#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/ -#endif -#ifndef LV_USE_THEME_ZEN -#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */ -#endif -#ifndef LV_USE_THEME_NEMO -#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/ -#endif - -/*================== - * FONT USAGE - *===================*/ - -/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. - * The symbols are available via `LV_SYMBOL_...` defines - * More info about fonts: https://docs.littlevgl.com/#Fonts - * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array - */ - -/* Robot fonts with bpp = 4 - * https://fonts.google.com/specimen/Roboto */ -#ifndef LV_FONT_ROBOTO_12 -#define LV_FONT_ROBOTO_12 0 -#endif -#ifndef LV_FONT_ROBOTO_16 -#define LV_FONT_ROBOTO_16 1 -#endif -#ifndef LV_FONT_ROBOTO_22 -#define LV_FONT_ROBOTO_22 0 -#endif -#ifndef LV_FONT_ROBOTO_28 -#define LV_FONT_ROBOTO_28 0 -#endif - -/* Demonstrate special features */ -#ifndef LV_FONT_ROBOTO_12_SUBPX -#define LV_FONT_ROBOTO_12_SUBPX 1 -#endif -#ifndef LV_FONT_ROBOTO_28_COMPRESSED -#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/ -#endif - -/*Pixel perfect monospace font - * http://pelulamu.net/unscii/ */ -#ifndef LV_FONT_UNSCII_8 -#define LV_FONT_UNSCII_8 0 -#endif - -/* Optionally declare your custom fonts here. - * You can use these fonts as default font too - * and they will be available globally. E.g. - * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ - * LV_FONT_DECLARE(my_font_2) - */ -#ifndef LV_FONT_CUSTOM_DECLARE -#define LV_FONT_CUSTOM_DECLARE -#endif - -/*Always set a default font from the built-in fonts*/ -#ifndef LV_FONT_DEFAULT -#define LV_FONT_DEFAULT &lv_font_roboto_16 -#endif - -/* Enable it if you have fonts with a lot of characters. - * The limit depends on the font size, font face and bpp - * but with > 10,000 characters if you see issues probably you need to enable it.*/ -#ifndef LV_FONT_FMT_TXT_LARGE -#define LV_FONT_FMT_TXT_LARGE 0 -#endif - -/* Set the pixel order of the display. - * Important only if "subpx fonts" are used. - * With "normal" font it doesn't matter. - */ -#ifndef LV_FONT_SUBPX_BGR -#define LV_FONT_SUBPX_BGR 0 -#endif - -/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ - -/*================= - * Text settings - *=================*/ - -/* Select a character encoding for strings. - * Your IDE or editor should have the same character encoding - * - LV_TXT_ENC_UTF8 - * - LV_TXT_ENC_ASCII - * */ -#ifndef LV_TXT_ENC -#define LV_TXT_ENC LV_TXT_ENC_UTF8 -#endif - - /*Can break (wrap) texts on these chars*/ -#ifndef LV_TXT_BREAK_CHARS -#define LV_TXT_BREAK_CHARS " ,.;:-_" -#endif - -/* If a word is at least this long, will break wherever "prettiest" - * To disable, set to a value <= 0 */ -#ifndef LV_TXT_LINE_BREAK_LONG_LEN -#define LV_TXT_LINE_BREAK_LONG_LEN 12 -#endif - -/* Minimum number of characters in a long word to put on a line before a break. - * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ -#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN -#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 -#endif - -/* Minimum number of characters in a long word to put on a line after a break. - * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ -#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN -#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 -#endif - -/* The control character to use for signalling text recoloring. */ -#ifndef LV_TXT_COLOR_CMD -#define LV_TXT_COLOR_CMD "#" -#endif - -/* Support bidirectional texts. - * Allows mixing Left-to-Right and Right-to-Left texts. - * The direction will be processed according to the Unicode Bidirectioanl Algorithm: - * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ -#ifndef LV_USE_BIDI -#define LV_USE_BIDI 0 -#endif -#if LV_USE_BIDI -/* Set the default direction. Supported values: - * `LV_BIDI_DIR_LTR` Left-to-Right - * `LV_BIDI_DIR_RTL` Right-to-Left - * `LV_BIDI_DIR_AUTO` detect texts base direction */ -#ifndef LV_BIDI_BASE_DIR_DEF -#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO -#endif -#endif - -/*Change the built in (v)snprintf functions*/ -#ifndef LV_SPRINTF_CUSTOM -#define LV_SPRINTF_CUSTOM 0 -#endif -#if LV_SPRINTF_CUSTOM -#ifndef LV_SPRINTF_INCLUDE -# define LV_SPRINTF_INCLUDE -#endif -#ifndef lv_snprintf -# define lv_snprintf snprintf -#endif -#ifndef lv_vsnprintf -# define lv_vsnprintf vsnprintf -#endif -#endif /*LV_SPRINTF_CUSTOM*/ - -/*=================== - * LV_OBJ SETTINGS - *==================*/ - -/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ - -/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ -#ifndef LV_USE_OBJ_REALIGN -#define LV_USE_OBJ_REALIGN 1 -#endif - -/* Enable to make the object clickable on a larger area. - * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature - * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) - * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) - */ -#ifndef LV_USE_EXT_CLICK_AREA -#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF -#endif - -/*================== - * LV OBJ X USAGE - *================*/ -/* - * Documentation of the object types: https://docs.littlevgl.com/#Object-types - */ - -/*Arc (dependencies: -)*/ -#ifndef LV_USE_ARC -#define LV_USE_ARC 1 -#endif - -/*Bar (dependencies: -)*/ -#ifndef LV_USE_BAR -#define LV_USE_BAR 1 -#endif - -/*Button (dependencies: lv_cont*/ -#ifndef LV_USE_BTN -#define LV_USE_BTN 1 -#endif -#if LV_USE_BTN != 0 -/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/ -#ifndef LV_BTN_INK_EFFECT -# define LV_BTN_INK_EFFECT 0 -#endif -#endif - -/*Button matrix (dependencies: -)*/ -#ifndef LV_USE_BTNM -#define LV_USE_BTNM 1 -#endif - -/*Calendar (dependencies: -)*/ -#ifndef LV_USE_CALENDAR -#define LV_USE_CALENDAR 1 -#endif - -/*Canvas (dependencies: lv_img)*/ -#ifndef LV_USE_CANVAS -#define LV_USE_CANVAS 1 -#endif - -/*Check box (dependencies: lv_btn, lv_label)*/ -#ifndef LV_USE_CB -#define LV_USE_CB 1 -#endif - -/*Chart (dependencies: -)*/ -#ifndef LV_USE_CHART -#define LV_USE_CHART 1 -#endif -#if LV_USE_CHART -#ifndef LV_CHART_AXIS_TICK_LABEL_MAX_LEN -# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20 -#endif -#endif - -/*Container (dependencies: -*/ -#ifndef LV_USE_CONT -#define LV_USE_CONT 1 -#endif - -/*Color picker (dependencies: -*/ -#ifndef LV_USE_CPICKER -#define LV_USE_CPICKER 1 -#endif - -/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ -#ifndef LV_USE_DDLIST -#define LV_USE_DDLIST 1 -#endif -#if LV_USE_DDLIST != 0 -/*Open and close default animation time [ms] (0: no animation)*/ -#ifndef LV_DDLIST_DEF_ANIM_TIME -# define LV_DDLIST_DEF_ANIM_TIME 200 -#endif -#endif - -/*Gauge (dependencies:lv_bar, lv_lmeter)*/ -#ifndef LV_USE_GAUGE -#define LV_USE_GAUGE 1 -#endif - -/*Image (dependencies: lv_label*/ -#ifndef LV_USE_IMG -#define LV_USE_IMG 1 -#endif - -/*Image Button (dependencies: lv_btn*/ -#ifndef LV_USE_IMGBTN -#define LV_USE_IMGBTN 1 -#endif -#if LV_USE_IMGBTN -/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ -#ifndef LV_IMGBTN_TILED -# define LV_IMGBTN_TILED 0 -#endif -#endif - -/*Keyboard (dependencies: lv_btnm)*/ -#ifndef LV_USE_KB -#define LV_USE_KB 1 -#endif - -/*Label (dependencies: -*/ -#ifndef LV_USE_LABEL -#define LV_USE_LABEL 1 -#endif -#if LV_USE_LABEL != 0 -/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ -#ifndef LV_LABEL_DEF_SCROLL_SPEED -# define LV_LABEL_DEF_SCROLL_SPEED 25 -#endif - -/* Waiting period at beginning/end of animation cycle */ -#ifndef LV_LABEL_WAIT_CHAR_COUNT -# define LV_LABEL_WAIT_CHAR_COUNT 3 -#endif - -/*Enable selecting text of the label */ -#ifndef LV_LABEL_TEXT_SEL -# define LV_LABEL_TEXT_SEL 0 -#endif - -/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/ -#ifndef LV_LABEL_LONG_TXT_HINT -# define LV_LABEL_LONG_TXT_HINT 0 -#endif -#endif - -/*LED (dependencies: -)*/ -#ifndef LV_USE_LED -#define LV_USE_LED 1 -#endif - -/*Line (dependencies: -*/ -#ifndef LV_USE_LINE -#define LV_USE_LINE 1 -#endif - -/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ -#ifndef LV_USE_LIST -#define LV_USE_LIST 1 -#endif -#if LV_USE_LIST != 0 -/*Default animation time of focusing to a list element [ms] (0: no animation) */ -#ifndef LV_LIST_DEF_ANIM_TIME -# define LV_LIST_DEF_ANIM_TIME 100 -#endif -#endif - -/*Line meter (dependencies: *;)*/ -#ifndef LV_USE_LMETER -#define LV_USE_LMETER 1 -#endif - -/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ -#ifndef LV_USE_MBOX -#define LV_USE_MBOX 1 -#endif - -/*Page (dependencies: lv_cont)*/ -#ifndef LV_USE_PAGE -#define LV_USE_PAGE 1 -#endif -#if LV_USE_PAGE != 0 -/*Focus default animation time [ms] (0: no animation)*/ -#ifndef LV_PAGE_DEF_ANIM_TIME -# define LV_PAGE_DEF_ANIM_TIME 400 -#endif -#endif - -/*Preload (dependencies: lv_arc, lv_anim)*/ -#ifndef LV_USE_PRELOAD -#define LV_USE_PRELOAD 1 -#endif -#if LV_USE_PRELOAD != 0 -#ifndef LV_PRELOAD_DEF_ARC_LENGTH -# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/ -#endif -#ifndef LV_PRELOAD_DEF_SPIN_TIME -# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/ -#endif -#ifndef LV_PRELOAD_DEF_ANIM -# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC -#endif -#endif - -/*Roller (dependencies: lv_ddlist)*/ -#ifndef LV_USE_ROLLER -#define LV_USE_ROLLER 1 -#endif -#if LV_USE_ROLLER != 0 -/*Focus animation time [ms] (0: no animation)*/ -#ifndef LV_ROLLER_DEF_ANIM_TIME -# define LV_ROLLER_DEF_ANIM_TIME 200 -#endif - -/*Number of extra "pages" when the roller is infinite*/ -#ifndef LV_ROLLER_INF_PAGES -# define LV_ROLLER_INF_PAGES 7 -#endif -#endif - -/*Slider (dependencies: lv_bar)*/ -#ifndef LV_USE_SLIDER -#define LV_USE_SLIDER 1 -#endif - -/*Spinbox (dependencies: lv_ta)*/ -#ifndef LV_USE_SPINBOX -#define LV_USE_SPINBOX 1 -#endif - -/*Switch (dependencies: lv_slider)*/ -#ifndef LV_USE_SW -#define LV_USE_SW 1 -#endif - -/*Text area (dependencies: lv_label, lv_page)*/ -#ifndef LV_USE_TA -#define LV_USE_TA 1 -#endif -#if LV_USE_TA != 0 -#ifndef LV_TA_DEF_CURSOR_BLINK_TIME -# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ -#endif -#ifndef LV_TA_DEF_PWD_SHOW_TIME -# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif -#endif - -/*Table (dependencies: lv_label)*/ -#ifndef LV_USE_TABLE -#define LV_USE_TABLE 1 -#endif -#if LV_USE_TABLE -#ifndef LV_TABLE_COL_MAX -# define LV_TABLE_COL_MAX 12 -#endif -#endif - -/*Tab (dependencies: lv_page, lv_btnm)*/ -#ifndef LV_USE_TABVIEW -#define LV_USE_TABVIEW 1 -#endif -# if LV_USE_TABVIEW != 0 -/*Time of slide animation [ms] (0: no animation)*/ -#ifndef LV_TABVIEW_DEF_ANIM_TIME -# define LV_TABVIEW_DEF_ANIM_TIME 300 -#endif -#endif - -/*Tileview (dependencies: lv_page) */ -#ifndef LV_USE_TILEVIEW -#define LV_USE_TILEVIEW 1 -#endif -#if LV_USE_TILEVIEW -/*Time of slide animation [ms] (0: no animation)*/ -#ifndef LV_TILEVIEW_DEF_ANIM_TIME -# define LV_TILEVIEW_DEF_ANIM_TIME 300 -#endif -#endif - -/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ -#ifndef LV_USE_WIN -#define LV_USE_WIN 1 -#endif - -/*================== - * Non-user section - *==================*/ - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ -#ifndef _CRT_SECURE_NO_WARNINGS -# define _CRT_SECURE_NO_WARNINGS -#endif -#endif - - -#endif /*LV_CONF_CHECKER_H*/ diff --git a/src/libs/lvgl/src/lv_conf_internal.h b/src/libs/lvgl/src/lv_conf_internal.h new file mode 100644 index 00000000..e3ccef33 --- /dev/null +++ b/src/libs/lvgl/src/lv_conf_internal.h @@ -0,0 +1,2028 @@ +/** + * GENERATED FILE, DO NOT EDIT IT! + * @file lv_conf_internal.h + * Make sure all the defines of lv_conf.h have a default value +**/ + +#ifndef LV_CONF_INTERNAL_H +#define LV_CONF_INTERNAL_H +/* clang-format off */ + +#include + +/* Handle special Kconfig options */ +#include "lv_conf_kconfig.h" + +#ifdef CONFIG_LV_CONF_SKIP +#define LV_CONF_SKIP +#endif + +/* If "lv_conf.h" is available from here try to use it later.*/ +#if defined __has_include +# if __has_include("lv_conf.h") +# ifndef LV_CONF_INCLUDE_SIMPLE +# define LV_CONF_INCLUDE_SIMPLE +# endif +# endif +#endif + +/*If lv_conf.h is not skipped include it*/ +#if !defined(LV_CONF_SKIP) +# if defined(LV_CONF_PATH) /*If there is a path defined for lv_conf.h use it*/ +# define __LV_TO_STR_AUX(x) #x +# define __LV_TO_STR(x) __LV_TO_STR_AUX(x) +# include __LV_TO_STR(LV_CONF_PATH) +# undef __LV_TO_STR_AUX +# undef __LV_TO_STR +# elif defined(LV_CONF_INCLUDE_SIMPLE) /*Or simply include lv_conf.h is enabled*/ +# include "lv_conf.h" +# else +# include "../../lv_conf.h" /*Else assume lv_conf.h is next to the lvgl folder */ +# endif +#endif + +/* clang-format off */ + +#include + +/*==================== + Graphical settings + *====================*/ + +/* Maximal horizontal and vertical resolution to support by the library.*/ +#ifndef LV_HOR_RES_MAX +# ifdef CONFIG_LV_HOR_RES_MAX +# define LV_HOR_RES_MAX CONFIG_LV_HOR_RES_MAX +# else +# define LV_HOR_RES_MAX (480) +# endif +#endif +#ifndef LV_VER_RES_MAX +# ifdef CONFIG_LV_VER_RES_MAX +# define LV_VER_RES_MAX CONFIG_LV_VER_RES_MAX +# else +# define LV_VER_RES_MAX (320) +# endif +#endif + +/* Color depth: + * - 1: 1 byte per pixel + * - 8: RGB332 + * - 16: RGB565 + * - 32: ARGB8888 + */ +#ifndef LV_COLOR_DEPTH +# ifdef CONFIG_LV_COLOR_DEPTH +# define LV_COLOR_DEPTH CONFIG_LV_COLOR_DEPTH +# else +# define LV_COLOR_DEPTH 16 +# endif +#endif + +/* Swap the 2 bytes of RGB565 color. + * Useful if the display has a 8 bit interface (e.g. SPI)*/ +#ifndef LV_COLOR_16_SWAP +# ifdef CONFIG_LV_COLOR_16_SWAP +# define LV_COLOR_16_SWAP CONFIG_LV_COLOR_16_SWAP +# else +# define LV_COLOR_16_SWAP 0 +# endif +#endif + +/* 1: Enable screen transparency. + * Useful for OSD or other overlapping GUIs. + * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/ +#ifndef LV_COLOR_SCREEN_TRANSP +# ifdef CONFIG_LV_COLOR_SCREEN_TRANSP +# define LV_COLOR_SCREEN_TRANSP CONFIG_LV_COLOR_SCREEN_TRANSP +# else +# define LV_COLOR_SCREEN_TRANSP 0 +# endif +#endif + +/*Images pixels with this color will not be drawn (with chroma keying)*/ +#ifndef LV_COLOR_TRANSP +# ifdef CONFIG_LV_COLOR_TRANSP +# define LV_COLOR_TRANSP CONFIG_LV_COLOR_TRANSP +# else +# define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ +# endif +#endif + +/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ +#ifndef LV_ANTIALIAS +# ifdef CONFIG_LV_ANTIALIAS +# define LV_ANTIALIAS CONFIG_LV_ANTIALIAS +# else +# define LV_ANTIALIAS 1 +# endif +#endif + +/* Default display refresh period. + * Can be changed in the display driver (`lv_disp_drv_t`).*/ +#ifndef LV_DISP_DEF_REFR_PERIOD +# ifdef CONFIG_LV_DISP_DEF_REFR_PERIOD +# define LV_DISP_DEF_REFR_PERIOD CONFIG_LV_DISP_DEF_REFR_PERIOD +# else +# define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ +# endif +#endif + +/* Dot Per Inch: used to initialize default sizes. + * E.g. a button with width = LV_DPI / 2 -> half inch wide + * (Not so important, you can adjust it to modify default sizes and spaces)*/ +#ifndef LV_DPI +# ifdef CONFIG_LV_DPI +# define LV_DPI CONFIG_LV_DPI +# else +# define LV_DPI 130 /*[px]*/ +# endif +#endif + +/* The the real width of the display changes some default values: + * default object sizes, layout of examples, etc. + * According to the width of the display (hor. res. / dpi) + * the displays fall in 4 categories. + * The 4th is extra large which has no upper limit so not listed here + * The upper limit of the categories are set below in 0.1 inch unit. + */ +#ifndef LV_DISP_SMALL_LIMIT +# ifdef CONFIG_LV_DISP_SMALL_LIMIT +# define LV_DISP_SMALL_LIMIT CONFIG_LV_DISP_SMALL_LIMIT +# else +# define LV_DISP_SMALL_LIMIT 30 +# endif +#endif +#ifndef LV_DISP_MEDIUM_LIMIT +# ifdef CONFIG_LV_DISP_MEDIUM_LIMIT +# define LV_DISP_MEDIUM_LIMIT CONFIG_LV_DISP_MEDIUM_LIMIT +# else +# define LV_DISP_MEDIUM_LIMIT 50 +# endif +#endif +#ifndef LV_DISP_LARGE_LIMIT +# ifdef CONFIG_LV_DISP_LARGE_LIMIT +# define LV_DISP_LARGE_LIMIT CONFIG_LV_DISP_LARGE_LIMIT +# else +# define LV_DISP_LARGE_LIMIT 70 +# endif +#endif + +/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ + +/* Maximum buffer size to allocate for rotation. Only used if software rotation is enabled. */ +#ifndef LV_DISP_ROT_MAX_BUF +# ifdef CONFIG_LV_DISP_ROT_MAX_BUF +# define LV_DISP_ROT_MAX_BUF CONFIG_LV_DISP_ROT_MAX_BUF +# else +# define LV_DISP_ROT_MAX_BUF (10U * 1024U) +# endif +#endif + +/*========================= + Memory manager settings + *=========================*/ + +/* LittelvGL's internal memory manager's settings. + * The graphical objects and other related data are stored here. */ + +/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */ +#ifndef LV_MEM_CUSTOM +# ifdef CONFIG_LV_MEM_CUSTOM +# define LV_MEM_CUSTOM CONFIG_LV_MEM_CUSTOM +# else +# define LV_MEM_CUSTOM 0 +# endif +#endif +#if LV_MEM_CUSTOM == 0 +/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ +#ifndef LV_MEM_SIZE +# ifdef CONFIG_LV_MEM_SIZE +# define LV_MEM_SIZE CONFIG_LV_MEM_SIZE +# else +# define LV_MEM_SIZE (32U * 1024U) +# endif +#endif + +/* Compiler prefix for a big array declaration */ +#ifndef LV_MEM_ATTR +# ifdef CONFIG_LV_MEM_ATTR +# define LV_MEM_ATTR CONFIG_LV_MEM_ATTR +# else +# define LV_MEM_ATTR +# endif +#endif + +/* Set an address for the memory pool instead of allocating it as an array. + * Can be in external SRAM too. */ +#ifndef LV_MEM_ADR +# ifdef CONFIG_LV_MEM_ADR +# define LV_MEM_ADR CONFIG_LV_MEM_ADR +# else +# define LV_MEM_ADR 0 +# endif +#endif + +/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */ +#ifndef LV_MEM_AUTO_DEFRAG +# ifdef CONFIG_LV_MEM_AUTO_DEFRAG +# define LV_MEM_AUTO_DEFRAG CONFIG_LV_MEM_AUTO_DEFRAG +# else +# define LV_MEM_AUTO_DEFRAG 1 +# endif +#endif +#else /*LV_MEM_CUSTOM*/ +#ifndef LV_MEM_CUSTOM_INCLUDE +# ifdef CONFIG_LV_MEM_CUSTOM_INCLUDE +# define LV_MEM_CUSTOM_INCLUDE CONFIG_LV_MEM_CUSTOM_INCLUDE +# else +# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ +# endif +#endif +#ifndef LV_MEM_CUSTOM_ALLOC +# ifdef CONFIG_LV_MEM_CUSTOM_ALLOC +# define LV_MEM_CUSTOM_ALLOC CONFIG_LV_MEM_CUSTOM_ALLOC +# else +# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ +# endif +#endif +#ifndef LV_MEM_CUSTOM_FREE +# ifdef CONFIG_LV_MEM_CUSTOM_FREE +# define LV_MEM_CUSTOM_FREE CONFIG_LV_MEM_CUSTOM_FREE +# else +# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ +# endif +#endif +#endif /*LV_MEM_CUSTOM*/ + +/* Use the standard memcpy and memset instead of LVGL's own functions. + * The standard functions might or might not be faster depending on their implementation. */ +#ifndef LV_MEMCPY_MEMSET_STD +# ifdef CONFIG_LV_MEMCPY_MEMSET_STD +# define LV_MEMCPY_MEMSET_STD CONFIG_LV_MEMCPY_MEMSET_STD +# else +# define LV_MEMCPY_MEMSET_STD 0 +# endif +#endif + +/* Garbage Collector settings + * Used if lvgl is binded to higher level language and the memory is managed by that language */ +#ifndef LV_ENABLE_GC +# ifdef CONFIG_LV_ENABLE_GC +# define LV_ENABLE_GC CONFIG_LV_ENABLE_GC +# else +# define LV_ENABLE_GC 0 +# endif +#endif +#if LV_ENABLE_GC != 0 +#ifndef LV_GC_INCLUDE +# ifdef CONFIG_LV_GC_INCLUDE +# define LV_GC_INCLUDE CONFIG_LV_GC_INCLUDE +# else +# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +# endif +#endif +#ifndef LV_MEM_CUSTOM_REALLOC +# ifdef CONFIG_LV_MEM_CUSTOM_REALLOC +# define LV_MEM_CUSTOM_REALLOC CONFIG_LV_MEM_CUSTOM_REALLOC +# else +# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ +# endif +#endif +#ifndef LV_MEM_CUSTOM_GET_SIZE +# ifdef CONFIG_LV_MEM_CUSTOM_GET_SIZE +# define LV_MEM_CUSTOM_GET_SIZE CONFIG_LV_MEM_CUSTOM_GET_SIZE +# else +# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ +# endif +#endif +#endif /* LV_ENABLE_GC */ + +/*======================= + Input device settings + *=======================*/ + +/* Input device default settings. + * Can be changed in the Input device driver (`lv_indev_drv_t`)*/ + +/* Input device read period in milliseconds */ +#ifndef LV_INDEV_DEF_READ_PERIOD +# ifdef CONFIG_LV_INDEV_DEF_READ_PERIOD +# define LV_INDEV_DEF_READ_PERIOD CONFIG_LV_INDEV_DEF_READ_PERIOD +# else +# define LV_INDEV_DEF_READ_PERIOD 30 +# endif +#endif + +/* Drag threshold in pixels */ +#ifndef LV_INDEV_DEF_DRAG_LIMIT +# ifdef CONFIG_LV_INDEV_DEF_DRAG_LIMIT +# define LV_INDEV_DEF_DRAG_LIMIT CONFIG_LV_INDEV_DEF_DRAG_LIMIT +# else +# define LV_INDEV_DEF_DRAG_LIMIT 10 +# endif +#endif + +/* Drag throw slow-down in [%]. Greater value -> faster slow-down */ +#ifndef LV_INDEV_DEF_DRAG_THROW +# ifdef CONFIG_LV_INDEV_DEF_DRAG_THROW +# define LV_INDEV_DEF_DRAG_THROW CONFIG_LV_INDEV_DEF_DRAG_THROW +# else +# define LV_INDEV_DEF_DRAG_THROW 10 +# endif +#endif + +/* Long press time in milliseconds. + * Time to send `LV_EVENT_LONG_PRESSED`) */ +#ifndef LV_INDEV_DEF_LONG_PRESS_TIME +# ifdef CONFIG_LV_INDEV_DEF_LONG_PRESS_TIME +# define LV_INDEV_DEF_LONG_PRESS_TIME CONFIG_LV_INDEV_DEF_LONG_PRESS_TIME +# else +# define LV_INDEV_DEF_LONG_PRESS_TIME 400 +# endif +#endif + +/* Repeated trigger period in long press [ms] + * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ +#ifndef LV_INDEV_DEF_LONG_PRESS_REP_TIME +# ifdef CONFIG_LV_INDEV_DEF_LONG_PRESS_REP_TIME +# define LV_INDEV_DEF_LONG_PRESS_REP_TIME CONFIG_LV_INDEV_DEF_LONG_PRESS_REP_TIME +# else +# define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 +# endif +#endif + +/* Gesture threshold in pixels */ +#ifndef LV_INDEV_DEF_GESTURE_LIMIT +# ifdef CONFIG_LV_INDEV_DEF_GESTURE_LIMIT +# define LV_INDEV_DEF_GESTURE_LIMIT CONFIG_LV_INDEV_DEF_GESTURE_LIMIT +# else +# define LV_INDEV_DEF_GESTURE_LIMIT 50 +# endif +#endif + +/* Gesture min velocity at release before swipe (pixels)*/ +#ifndef LV_INDEV_DEF_GESTURE_MIN_VELOCITY +# ifdef CONFIG_LV_INDEV_DEF_GESTURE_MIN_VELOCITY +# define LV_INDEV_DEF_GESTURE_MIN_VELOCITY CONFIG_LV_INDEV_DEF_GESTURE_MIN_VELOCITY +# else +# define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3 +# endif +#endif + +/*================== + * Feature usage + *==================*/ + +/*1: Enable the Animations */ +#ifndef LV_USE_ANIMATION +# ifdef CONFIG_LV_USE_ANIMATION +# define LV_USE_ANIMATION CONFIG_LV_USE_ANIMATION +# else +# define LV_USE_ANIMATION 1 +# endif +#endif +#if LV_USE_ANIMATION + +/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ + +#endif + +/* 1: Enable shadow drawing on rectangles*/ +#ifndef LV_USE_SHADOW +# ifdef CONFIG_LV_USE_SHADOW +# define LV_USE_SHADOW CONFIG_LV_USE_SHADOW +# else +# define LV_USE_SHADOW 1 +# endif +#endif +#if LV_USE_SHADOW +/* Allow buffering some shadow calculation + * LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, + * where shadow size is `shadow_width + radius` + * Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ +#ifndef LV_SHADOW_CACHE_SIZE +# ifdef CONFIG_LV_SHADOW_CACHE_SIZE +# define LV_SHADOW_CACHE_SIZE CONFIG_LV_SHADOW_CACHE_SIZE +# else +# define LV_SHADOW_CACHE_SIZE 0 +# endif +#endif +#endif + +/*1: enable outline drawing on rectangles*/ +#ifndef LV_USE_OUTLINE +# ifdef CONFIG_LV_USE_OUTLINE +# define LV_USE_OUTLINE CONFIG_LV_USE_OUTLINE +# else +# define LV_USE_OUTLINE 1 +# endif +#endif + +/*1: enable pattern drawing on rectangles*/ +#ifndef LV_USE_PATTERN +# ifdef CONFIG_LV_USE_PATTERN +# define LV_USE_PATTERN CONFIG_LV_USE_PATTERN +# else +# define LV_USE_PATTERN 1 +# endif +#endif + +/*1: enable value string drawing on rectangles*/ +#ifndef LV_USE_VALUE_STR +# ifdef CONFIG_LV_USE_VALUE_STR +# define LV_USE_VALUE_STR CONFIG_LV_USE_VALUE_STR +# else +# define LV_USE_VALUE_STR 1 +# endif +#endif + +/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/ +#ifndef LV_USE_BLEND_MODES +# ifdef CONFIG_LV_USE_BLEND_MODES +# define LV_USE_BLEND_MODES CONFIG_LV_USE_BLEND_MODES +# else +# define LV_USE_BLEND_MODES 1 +# endif +#endif + +/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/ +#ifndef LV_USE_OPA_SCALE +# ifdef CONFIG_LV_USE_OPA_SCALE +# define LV_USE_OPA_SCALE CONFIG_LV_USE_OPA_SCALE +# else +# define LV_USE_OPA_SCALE 1 +# endif +#endif + +/* 1: Use image zoom and rotation*/ +#ifndef LV_USE_IMG_TRANSFORM +# ifdef CONFIG_LV_USE_IMG_TRANSFORM +# define LV_USE_IMG_TRANSFORM CONFIG_LV_USE_IMG_TRANSFORM +# else +# define LV_USE_IMG_TRANSFORM 1 +# endif +#endif + +/* 1: Enable object groups (for keyboard/encoder navigation) */ +#ifndef LV_USE_GROUP +# ifdef CONFIG_LV_USE_GROUP +# define LV_USE_GROUP CONFIG_LV_USE_GROUP +# else +# define LV_USE_GROUP 1 +# endif +#endif +#if LV_USE_GROUP +#endif /*LV_USE_GROUP*/ + +/* 1: Enable GPU interface*/ +#ifndef LV_USE_GPU +# ifdef CONFIG_LV_USE_GPU +# define LV_USE_GPU CONFIG_LV_USE_GPU +# else +# define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */ +# endif +#endif +#ifndef LV_USE_GPU_STM32_DMA2D +# ifdef CONFIG_LV_USE_GPU_STM32_DMA2D +# define LV_USE_GPU_STM32_DMA2D CONFIG_LV_USE_GPU_STM32_DMA2D +# else +# define LV_USE_GPU_STM32_DMA2D 0 +# endif +#endif +/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor +e.g. "stm32f769xx.h" or "stm32f429xx.h" */ +#ifndef LV_GPU_DMA2D_CMSIS_INCLUDE +# ifdef CONFIG_LV_GPU_DMA2D_CMSIS_INCLUDE +# define LV_GPU_DMA2D_CMSIS_INCLUDE CONFIG_LV_GPU_DMA2D_CMSIS_INCLUDE +# else +# define LV_GPU_DMA2D_CMSIS_INCLUDE +# endif +#endif + +/*1: Use PXP for CPU off-load on NXP RTxxx platforms */ +#ifndef LV_USE_GPU_NXP_PXP +# ifdef CONFIG_LV_USE_GPU_NXP_PXP +# define LV_USE_GPU_NXP_PXP CONFIG_LV_USE_GPU_NXP_PXP +# else +# define LV_USE_GPU_NXP_PXP 0 +# endif +#endif + +/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) + * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS + * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. + *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() + * */ +#ifndef LV_USE_GPU_NXP_PXP_AUTO_INIT +# ifdef CONFIG_LV_USE_GPU_NXP_PXP_AUTO_INIT +# define LV_USE_GPU_NXP_PXP_AUTO_INIT CONFIG_LV_USE_GPU_NXP_PXP_AUTO_INIT +# else +# define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 +# endif +#endif + +/*1: Use VG-Lite for CPU offload on NXP RTxxx platforms */ +#ifndef LV_USE_GPU_NXP_VG_LITE +# ifdef CONFIG_LV_USE_GPU_NXP_VG_LITE +# define LV_USE_GPU_NXP_VG_LITE CONFIG_LV_USE_GPU_NXP_VG_LITE +# else +# define LV_USE_GPU_NXP_VG_LITE 0 +# endif +#endif + +/* 1: Enable file system (might be required for images */ +#ifndef LV_USE_FILESYSTEM +# ifdef CONFIG_LV_USE_FILESYSTEM +# define LV_USE_FILESYSTEM CONFIG_LV_USE_FILESYSTEM +# else +# define LV_USE_FILESYSTEM 1 +# endif +#endif +#if LV_USE_FILESYSTEM +/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/ +#endif + +/*1: Add a `user_data` to drivers and objects*/ +#ifndef LV_USE_USER_DATA +# ifdef CONFIG_LV_USE_USER_DATA +# define LV_USE_USER_DATA CONFIG_LV_USE_USER_DATA +# else +# define LV_USE_USER_DATA 0 +# endif +#endif + +/*1: Show CPU usage and FPS count in the right bottom corner*/ +#ifndef LV_USE_PERF_MONITOR +# ifdef CONFIG_LV_USE_PERF_MONITOR +# define LV_USE_PERF_MONITOR CONFIG_LV_USE_PERF_MONITOR +# else +# define LV_USE_PERF_MONITOR 0 +# endif +#endif + +/*1: Use the functions and types from the older API if possible */ +#ifndef LV_USE_API_EXTENSION_V6 +# ifdef CONFIG_LV_USE_API_EXTENSION_V6 +# define LV_USE_API_EXTENSION_V6 CONFIG_LV_USE_API_EXTENSION_V6 +# else +# define LV_USE_API_EXTENSION_V6 1 +# endif +#endif +#ifndef LV_USE_API_EXTENSION_V7 +# ifdef CONFIG_LV_USE_API_EXTENSION_V7 +# define LV_USE_API_EXTENSION_V7 CONFIG_LV_USE_API_EXTENSION_V7 +# else +# define LV_USE_API_EXTENSION_V7 1 +# endif +#endif + +/*======================== + * Image decoder and cache + *========================*/ + +/* 1: Enable indexed (palette) images */ +#ifndef LV_IMG_CF_INDEXED +# ifdef CONFIG_LV_IMG_CF_INDEXED +# define LV_IMG_CF_INDEXED CONFIG_LV_IMG_CF_INDEXED +# else +# define LV_IMG_CF_INDEXED 1 +# endif +#endif + +/* 1: Enable alpha indexed images */ +#ifndef LV_IMG_CF_ALPHA +# ifdef CONFIG_LV_IMG_CF_ALPHA +# define LV_IMG_CF_ALPHA CONFIG_LV_IMG_CF_ALPHA +# else +# define LV_IMG_CF_ALPHA 1 +# endif +#endif + +/* Default image cache size. Image caching keeps the images opened. + * If only the built-in image formats are used there is no real advantage of caching. + * (I.e. no new image decoder is added) + * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. + * However the opened images might consume additional RAM. + * Set it to 0 to disable caching */ +#ifndef LV_IMG_CACHE_DEF_SIZE +# ifdef CONFIG_LV_IMG_CACHE_DEF_SIZE +# define LV_IMG_CACHE_DEF_SIZE CONFIG_LV_IMG_CACHE_DEF_SIZE +# else +# define LV_IMG_CACHE_DEF_SIZE 1 +# endif +#endif + +/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ + +/*===================== + * Compiler settings + *====================*/ + +/* For big endian systems set to 1 */ +#ifndef LV_BIG_ENDIAN_SYSTEM +# ifdef CONFIG_LV_BIG_ENDIAN_SYSTEM +# define LV_BIG_ENDIAN_SYSTEM CONFIG_LV_BIG_ENDIAN_SYSTEM +# else +# define LV_BIG_ENDIAN_SYSTEM 0 +# endif +#endif + +/* Define a custom attribute to `lv_tick_inc` function */ +#ifndef LV_ATTRIBUTE_TICK_INC +# ifdef CONFIG_LV_ATTRIBUTE_TICK_INC +# define LV_ATTRIBUTE_TICK_INC CONFIG_LV_ATTRIBUTE_TICK_INC +# else +# define LV_ATTRIBUTE_TICK_INC +# endif +#endif + +/* Define a custom attribute to `lv_task_handler` function */ +#ifndef LV_ATTRIBUTE_TASK_HANDLER +# ifdef CONFIG_LV_ATTRIBUTE_TASK_HANDLER +# define LV_ATTRIBUTE_TASK_HANDLER CONFIG_LV_ATTRIBUTE_TASK_HANDLER +# else +# define LV_ATTRIBUTE_TASK_HANDLER +# endif +#endif + +/* Define a custom attribute to `lv_disp_flush_ready` function */ +#ifndef LV_ATTRIBUTE_FLUSH_READY +# ifdef CONFIG_LV_ATTRIBUTE_FLUSH_READY +# define LV_ATTRIBUTE_FLUSH_READY CONFIG_LV_ATTRIBUTE_FLUSH_READY +# else +# define LV_ATTRIBUTE_FLUSH_READY +# endif +#endif + +/* Required alignment size for buffers */ +#ifndef LV_ATTRIBUTE_MEM_ALIGN_SIZE +# ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE +# define LV_ATTRIBUTE_MEM_ALIGN_SIZE CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE +# else +# define LV_ATTRIBUTE_MEM_ALIGN_SIZE +# endif +#endif + +/* With size optimization (-Os) the compiler might not align data to + * 4 or 8 byte boundary. Some HW may need even 32 or 64 bytes. + * This alignment will be explicitly applied where needed. + * LV_ATTRIBUTE_MEM_ALIGN_SIZE should be used to specify required align size. + * E.g. __attribute__((aligned(LV_ATTRIBUTE_MEM_ALIGN_SIZE))) */ +#ifndef LV_ATTRIBUTE_MEM_ALIGN +# ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN +# define LV_ATTRIBUTE_MEM_ALIGN CONFIG_LV_ATTRIBUTE_MEM_ALIGN +# else +# define LV_ATTRIBUTE_MEM_ALIGN +# endif +#endif + +/* Attribute to mark large constant arrays for example + * font's bitmaps */ +#ifndef LV_ATTRIBUTE_LARGE_CONST +# ifdef CONFIG_LV_ATTRIBUTE_LARGE_CONST +# define LV_ATTRIBUTE_LARGE_CONST CONFIG_LV_ATTRIBUTE_LARGE_CONST +# else +# define LV_ATTRIBUTE_LARGE_CONST +# endif +#endif + +/* Prefix performance critical functions to place them into a faster memory (e.g RAM) + * Uses 15-20 kB extra memory */ +#ifndef LV_ATTRIBUTE_FAST_MEM +# ifdef CONFIG_LV_ATTRIBUTE_FAST_MEM +# define LV_ATTRIBUTE_FAST_MEM CONFIG_LV_ATTRIBUTE_FAST_MEM +# else +# define LV_ATTRIBUTE_FAST_MEM +# endif +#endif + +/* Export integer constant to binding. + * This macro is used with constants in the form of LV_ that + * should also appear on lvgl binding API such as Micropython + * + * The default value just prevents a GCC warning. + */ +#ifndef LV_EXPORT_CONST_INT +# ifdef CONFIG_LV_EXPORT_CONST_INT +# define LV_EXPORT_CONST_INT CONFIG_LV_EXPORT_CONST_INT +# else +# define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning +# endif +#endif + +/* Prefix variables that are used in GPU accelerated operations, often these need to be + * placed in RAM sections that are DMA accessible */ +#ifndef LV_ATTRIBUTE_DMA +# ifdef CONFIG_LV_ATTRIBUTE_DMA +# define LV_ATTRIBUTE_DMA CONFIG_LV_ATTRIBUTE_DMA +# else +# define LV_ATTRIBUTE_DMA +# endif +#endif + +/*=================== + * HAL settings + *==================*/ + +/* 1: use a custom tick source. + * It removes the need to manually update the tick with `lv_tick_inc`) */ +#ifndef LV_TICK_CUSTOM +# ifdef CONFIG_LV_TICK_CUSTOM +# define LV_TICK_CUSTOM CONFIG_LV_TICK_CUSTOM +# else +# define LV_TICK_CUSTOM 0 +# endif +#endif +#if LV_TICK_CUSTOM == 1 +#ifndef LV_TICK_CUSTOM_INCLUDE +# ifdef CONFIG_LV_TICK_CUSTOM_INCLUDE +# define LV_TICK_CUSTOM_INCLUDE CONFIG_LV_TICK_CUSTOM_INCLUDE +# else +# define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +# endif +#endif +#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR +# ifdef CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR +# define LV_TICK_CUSTOM_SYS_TIME_EXPR CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR +# else +# define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ +# endif +#endif +#endif /*LV_TICK_CUSTOM*/ + + +/*================ + * Log settings + *===============*/ + +/*1: Enable the log module*/ +#ifndef LV_USE_LOG +# ifdef CONFIG_LV_USE_LOG +# define LV_USE_LOG CONFIG_LV_USE_LOG +# else +# define LV_USE_LOG 0 +# endif +#endif +#if LV_USE_LOG +/* How important log should be added: + * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + * LV_LOG_LEVEL_INFO Log important events + * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + * LV_LOG_LEVEL_NONE Do not log anything + */ +#ifndef LV_LOG_LEVEL +# ifdef CONFIG_LV_LOG_LEVEL +# define LV_LOG_LEVEL CONFIG_LV_LOG_LEVEL +# else +# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN +# endif +#endif + +/* 1: Print the log with 'printf'; + * 0: user need to register a callback with `lv_log_register_print_cb`*/ +#ifndef LV_LOG_PRINTF +# ifdef CONFIG_LV_LOG_PRINTF +# define LV_LOG_PRINTF CONFIG_LV_LOG_PRINTF +# else +# define LV_LOG_PRINTF 0 +# endif +#endif +#endif /*LV_USE_LOG*/ + +/*================= + * Debug settings + *================*/ + +/* If Debug is enabled LittelvGL validates the parameters of the functions. + * If an invalid parameter is found an error log message is printed and + * the MCU halts at the error. (`LV_USE_LOG` should be enabled) + * If you are debugging the MCU you can pause + * the debugger to see exactly where the issue is. + * + * The behavior of asserts can be overwritten by redefining them here. + * E.g. #define LV_ASSERT_MEM(p) + */ +#ifndef LV_USE_DEBUG +# ifdef CONFIG_LV_USE_DEBUG +# define LV_USE_DEBUG CONFIG_LV_USE_DEBUG +# else +# define LV_USE_DEBUG 1 +# endif +#endif +#if LV_USE_DEBUG + +/*Check if the parameter is NULL. (Quite fast) */ +#ifndef LV_USE_ASSERT_NULL +# ifdef CONFIG_LV_USE_ASSERT_NULL +# define LV_USE_ASSERT_NULL CONFIG_LV_USE_ASSERT_NULL +# else +# define LV_USE_ASSERT_NULL 1 +# endif +#endif + +/*Checks is the memory is successfully allocated or no. (Quite fast)*/ +#ifndef LV_USE_ASSERT_MEM +# ifdef CONFIG_LV_USE_ASSERT_MEM +# define LV_USE_ASSERT_MEM CONFIG_LV_USE_ASSERT_MEM +# else +# define LV_USE_ASSERT_MEM 1 +# endif +#endif + +/*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#ifndef LV_USE_ASSERT_MEM_INTEGRITY +# ifdef CONFIG_LV_USE_ASSERT_MEM_INTEGRITY +# define LV_USE_ASSERT_MEM_INTEGRITY CONFIG_LV_USE_ASSERT_MEM_INTEGRITY +# else +# define LV_USE_ASSERT_MEM_INTEGRITY 0 +# endif +#endif + +/* Check the strings. + * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) + * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ +#ifndef LV_USE_ASSERT_STR +# ifdef CONFIG_LV_USE_ASSERT_STR +# define LV_USE_ASSERT_STR CONFIG_LV_USE_ASSERT_STR +# else +# define LV_USE_ASSERT_STR 0 +# endif +#endif + +/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow) + * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ +#ifndef LV_USE_ASSERT_OBJ +# ifdef CONFIG_LV_USE_ASSERT_OBJ +# define LV_USE_ASSERT_OBJ CONFIG_LV_USE_ASSERT_OBJ +# else +# define LV_USE_ASSERT_OBJ 0 +# endif +#endif + +/*Check if the styles are properly initialized. (Fast)*/ +#ifndef LV_USE_ASSERT_STYLE +# ifdef CONFIG_LV_USE_ASSERT_STYLE +# define LV_USE_ASSERT_STYLE CONFIG_LV_USE_ASSERT_STYLE +# else +# define LV_USE_ASSERT_STYLE 0 +# endif +#endif + +#endif /*LV_USE_DEBUG*/ + +/*================== + * FONT USAGE + *===================*/ + +/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. + * The symbols are available via `LV_SYMBOL_...` defines + * More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html + * To create a new font go to: https://lvgl.com/ttf-font-to-c-array + */ + +/* Montserrat fonts with bpp = 4 + * https://fonts.google.com/specimen/Montserrat */ +#ifndef LV_FONT_MONTSERRAT_8 +# ifdef CONFIG_LV_FONT_MONTSERRAT_8 +# define LV_FONT_MONTSERRAT_8 CONFIG_LV_FONT_MONTSERRAT_8 +# else +# define LV_FONT_MONTSERRAT_8 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_10 +# ifdef CONFIG_LV_FONT_MONTSERRAT_10 +# define LV_FONT_MONTSERRAT_10 CONFIG_LV_FONT_MONTSERRAT_10 +# else +# define LV_FONT_MONTSERRAT_10 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_12 +# ifdef CONFIG_LV_FONT_MONTSERRAT_12 +# define LV_FONT_MONTSERRAT_12 CONFIG_LV_FONT_MONTSERRAT_12 +# else +# define LV_FONT_MONTSERRAT_12 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_14 +# ifdef CONFIG_LV_FONT_MONTSERRAT_14 +# define LV_FONT_MONTSERRAT_14 CONFIG_LV_FONT_MONTSERRAT_14 +# else +# define LV_FONT_MONTSERRAT_14 1 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_16 +# ifdef CONFIG_LV_FONT_MONTSERRAT_16 +# define LV_FONT_MONTSERRAT_16 CONFIG_LV_FONT_MONTSERRAT_16 +# else +# define LV_FONT_MONTSERRAT_16 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_18 +# ifdef CONFIG_LV_FONT_MONTSERRAT_18 +# define LV_FONT_MONTSERRAT_18 CONFIG_LV_FONT_MONTSERRAT_18 +# else +# define LV_FONT_MONTSERRAT_18 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_20 +# ifdef CONFIG_LV_FONT_MONTSERRAT_20 +# define LV_FONT_MONTSERRAT_20 CONFIG_LV_FONT_MONTSERRAT_20 +# else +# define LV_FONT_MONTSERRAT_20 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_22 +# ifdef CONFIG_LV_FONT_MONTSERRAT_22 +# define LV_FONT_MONTSERRAT_22 CONFIG_LV_FONT_MONTSERRAT_22 +# else +# define LV_FONT_MONTSERRAT_22 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_24 +# ifdef CONFIG_LV_FONT_MONTSERRAT_24 +# define LV_FONT_MONTSERRAT_24 CONFIG_LV_FONT_MONTSERRAT_24 +# else +# define LV_FONT_MONTSERRAT_24 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_26 +# ifdef CONFIG_LV_FONT_MONTSERRAT_26 +# define LV_FONT_MONTSERRAT_26 CONFIG_LV_FONT_MONTSERRAT_26 +# else +# define LV_FONT_MONTSERRAT_26 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_28 +# ifdef CONFIG_LV_FONT_MONTSERRAT_28 +# define LV_FONT_MONTSERRAT_28 CONFIG_LV_FONT_MONTSERRAT_28 +# else +# define LV_FONT_MONTSERRAT_28 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_30 +# ifdef CONFIG_LV_FONT_MONTSERRAT_30 +# define LV_FONT_MONTSERRAT_30 CONFIG_LV_FONT_MONTSERRAT_30 +# else +# define LV_FONT_MONTSERRAT_30 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_32 +# ifdef CONFIG_LV_FONT_MONTSERRAT_32 +# define LV_FONT_MONTSERRAT_32 CONFIG_LV_FONT_MONTSERRAT_32 +# else +# define LV_FONT_MONTSERRAT_32 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_34 +# ifdef CONFIG_LV_FONT_MONTSERRAT_34 +# define LV_FONT_MONTSERRAT_34 CONFIG_LV_FONT_MONTSERRAT_34 +# else +# define LV_FONT_MONTSERRAT_34 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_36 +# ifdef CONFIG_LV_FONT_MONTSERRAT_36 +# define LV_FONT_MONTSERRAT_36 CONFIG_LV_FONT_MONTSERRAT_36 +# else +# define LV_FONT_MONTSERRAT_36 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_38 +# ifdef CONFIG_LV_FONT_MONTSERRAT_38 +# define LV_FONT_MONTSERRAT_38 CONFIG_LV_FONT_MONTSERRAT_38 +# else +# define LV_FONT_MONTSERRAT_38 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_40 +# ifdef CONFIG_LV_FONT_MONTSERRAT_40 +# define LV_FONT_MONTSERRAT_40 CONFIG_LV_FONT_MONTSERRAT_40 +# else +# define LV_FONT_MONTSERRAT_40 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_42 +# ifdef CONFIG_LV_FONT_MONTSERRAT_42 +# define LV_FONT_MONTSERRAT_42 CONFIG_LV_FONT_MONTSERRAT_42 +# else +# define LV_FONT_MONTSERRAT_42 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_44 +# ifdef CONFIG_LV_FONT_MONTSERRAT_44 +# define LV_FONT_MONTSERRAT_44 CONFIG_LV_FONT_MONTSERRAT_44 +# else +# define LV_FONT_MONTSERRAT_44 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_46 +# ifdef CONFIG_LV_FONT_MONTSERRAT_46 +# define LV_FONT_MONTSERRAT_46 CONFIG_LV_FONT_MONTSERRAT_46 +# else +# define LV_FONT_MONTSERRAT_46 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_48 +# ifdef CONFIG_LV_FONT_MONTSERRAT_48 +# define LV_FONT_MONTSERRAT_48 CONFIG_LV_FONT_MONTSERRAT_48 +# else +# define LV_FONT_MONTSERRAT_48 0 +# endif +#endif + +/* Demonstrate special features */ +#ifndef LV_FONT_MONTSERRAT_12_SUBPX +# ifdef CONFIG_LV_FONT_MONTSERRAT_12_SUBPX +# define LV_FONT_MONTSERRAT_12_SUBPX CONFIG_LV_FONT_MONTSERRAT_12_SUBPX +# else +# define LV_FONT_MONTSERRAT_12_SUBPX 0 +# endif +#endif +#ifndef LV_FONT_MONTSERRAT_28_COMPRESSED +# ifdef CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED +# define LV_FONT_MONTSERRAT_28_COMPRESSED CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED +# else +# define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +# endif +#endif +#ifndef LV_FONT_DEJAVU_16_PERSIAN_HEBREW +# ifdef CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW +# define LV_FONT_DEJAVU_16_PERSIAN_HEBREW CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW +# else +# define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/ +# endif +#endif +#ifndef LV_FONT_SIMSUN_16_CJK +# ifdef CONFIG_LV_FONT_SIMSUN_16_CJK +# define LV_FONT_SIMSUN_16_CJK CONFIG_LV_FONT_SIMSUN_16_CJK +# else +# define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ +# endif +#endif + +/*Pixel perfect monospace font + * http://pelulamu.net/unscii/ */ +#ifndef LV_FONT_UNSCII_8 +# ifdef CONFIG_LV_FONT_UNSCII_8 +# define LV_FONT_UNSCII_8 CONFIG_LV_FONT_UNSCII_8 +# else +# define LV_FONT_UNSCII_8 0 +# endif +#endif +#ifndef LV_FONT_UNSCII_16 +# ifdef CONFIG_LV_FONT_UNSCII_16 +# define LV_FONT_UNSCII_16 CONFIG_LV_FONT_UNSCII_16 +# else +# define LV_FONT_UNSCII_16 0 +# endif +#endif + +/* Optionally declare your custom fonts here. + * You can use these fonts as default font too + * and they will be available globally. E.g. + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ + * LV_FONT_DECLARE(my_font_2) + */ +#ifndef LV_FONT_CUSTOM_DECLARE +# ifdef CONFIG_LV_FONT_CUSTOM_DECLARE +# define LV_FONT_CUSTOM_DECLARE CONFIG_LV_FONT_CUSTOM_DECLARE +# else +# define LV_FONT_CUSTOM_DECLARE +# endif +#endif + +/* Enable it if you have fonts with a lot of characters. + * The limit depends on the font size, font face and bpp + * but with > 10,000 characters if you see issues probably you need to enable it.*/ +#ifndef LV_FONT_FMT_TXT_LARGE +# ifdef CONFIG_LV_FONT_FMT_TXT_LARGE +# define LV_FONT_FMT_TXT_LARGE CONFIG_LV_FONT_FMT_TXT_LARGE +# else +# define LV_FONT_FMT_TXT_LARGE 0 +# endif +#endif + +/* Enables/disables support for compressed fonts. If it's disabled, compressed + * glyphs cannot be processed by the library and won't be rendered. + */ +#ifndef LV_USE_FONT_COMPRESSED +# ifdef CONFIG_LV_USE_FONT_COMPRESSED +# define LV_USE_FONT_COMPRESSED CONFIG_LV_USE_FONT_COMPRESSED +# else +# define LV_USE_FONT_COMPRESSED 1 +# endif +#endif + +/* Enable subpixel rendering */ +#ifndef LV_USE_FONT_SUBPX +# ifdef CONFIG_LV_USE_FONT_SUBPX +# define LV_USE_FONT_SUBPX CONFIG_LV_USE_FONT_SUBPX +# else +# define LV_USE_FONT_SUBPX 1 +# endif +#endif +#if LV_USE_FONT_SUBPX +/* Set the pixel order of the display. + * Important only if "subpx fonts" are used. + * With "normal" font it doesn't matter. + */ +#ifndef LV_FONT_SUBPX_BGR +# ifdef CONFIG_LV_FONT_SUBPX_BGR +# define LV_FONT_SUBPX_BGR CONFIG_LV_FONT_SUBPX_BGR +# else +# define LV_FONT_SUBPX_BGR 0 +# endif +#endif +#endif + +/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ + +/*================ + * THEME USAGE + *================*/ + +/*Always enable at least on theme*/ + +/* No theme, you can apply your styles as you need + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ +#ifndef LV_USE_THEME_EMPTY +# ifdef CONFIG_LV_USE_THEME_EMPTY +# define LV_USE_THEME_EMPTY CONFIG_LV_USE_THEME_EMPTY +# else +# define LV_USE_THEME_EMPTY 1 +# endif +#endif + +/*Simple to the create your theme based on it + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ +#ifndef LV_USE_THEME_TEMPLATE +# ifdef CONFIG_LV_USE_THEME_TEMPLATE +# define LV_USE_THEME_TEMPLATE CONFIG_LV_USE_THEME_TEMPLATE +# else +# define LV_USE_THEME_TEMPLATE 1 +# endif +#endif + +/* A fast and impressive theme. + * Flags: + * LV_THEME_MATERIAL_FLAG_LIGHT: light theme + * LV_THEME_MATERIAL_FLAG_DARK: dark theme + * LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations) + * LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state) + * */ +#ifndef LV_USE_THEME_MATERIAL +# ifdef CONFIG_LV_USE_THEME_MATERIAL +# define LV_USE_THEME_MATERIAL CONFIG_LV_USE_THEME_MATERIAL +# else +# define LV_USE_THEME_MATERIAL 1 +# endif +#endif + +/* Mono-color theme for monochrome displays. + * If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the + * texts and borders will be black and the background will be + * white. Else the colors are inverted. + * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ +#ifndef LV_USE_THEME_MONO +# ifdef CONFIG_LV_USE_THEME_MONO +# define LV_USE_THEME_MONO CONFIG_LV_USE_THEME_MONO +# else +# define LV_USE_THEME_MONO 1 +# endif +#endif + +#ifndef LV_THEME_DEFAULT_INCLUDE +# ifdef CONFIG_LV_THEME_DEFAULT_INCLUDE +# define LV_THEME_DEFAULT_INCLUDE CONFIG_LV_THEME_DEFAULT_INCLUDE +# else +# define LV_THEME_DEFAULT_INCLUDE /*Include a header for the init. function*/ +# endif +#endif +#ifndef LV_THEME_DEFAULT_INIT +# ifdef CONFIG_LV_THEME_DEFAULT_INIT +# define LV_THEME_DEFAULT_INIT CONFIG_LV_THEME_DEFAULT_INIT +# else +# define LV_THEME_DEFAULT_INIT lv_theme_material_init +# endif +#endif +#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY +# ifdef CONFIG_LV_THEME_DEFAULT_COLOR_PRIMARY +# define LV_THEME_DEFAULT_COLOR_PRIMARY CONFIG_LV_THEME_DEFAULT_COLOR_PRIMARY +# else +# define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1) +# endif +#endif +#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY +# ifdef CONFIG_LV_THEME_DEFAULT_COLOR_SECONDARY +# define LV_THEME_DEFAULT_COLOR_SECONDARY CONFIG_LV_THEME_DEFAULT_COLOR_SECONDARY +# else +# define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6) +# endif +#endif +#ifndef LV_THEME_DEFAULT_FLAG +# ifdef CONFIG_LV_THEME_DEFAULT_FLAG +# define LV_THEME_DEFAULT_FLAG CONFIG_LV_THEME_DEFAULT_FLAG +# else +# define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT +# endif +#endif +#ifndef LV_THEME_DEFAULT_FONT_SMALL +# ifdef CONFIG_LV_THEME_DEFAULT_FONT_SMALL +# define LV_THEME_DEFAULT_FONT_SMALL CONFIG_LV_THEME_DEFAULT_FONT_SMALL +# else +# define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14 +# endif +#endif +#ifndef LV_THEME_DEFAULT_FONT_NORMAL +# ifdef CONFIG_LV_THEME_DEFAULT_FONT_NORMAL +# define LV_THEME_DEFAULT_FONT_NORMAL CONFIG_LV_THEME_DEFAULT_FONT_NORMAL +# else +# define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14 +# endif +#endif +#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE +# ifdef CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE +# define LV_THEME_DEFAULT_FONT_SUBTITLE CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE +# else +# define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14 +# endif +#endif +#ifndef LV_THEME_DEFAULT_FONT_TITLE +# ifdef CONFIG_LV_THEME_DEFAULT_FONT_TITLE +# define LV_THEME_DEFAULT_FONT_TITLE CONFIG_LV_THEME_DEFAULT_FONT_TITLE +# else +# define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14 +# endif +#endif + +/*================= + * Text settings + *=================*/ + +/* Select a character encoding for strings. + * Your IDE or editor should have the same character encoding + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + * */ +#ifndef LV_TXT_ENC +# ifdef CONFIG_LV_TXT_ENC +# define LV_TXT_ENC CONFIG_LV_TXT_ENC +# else +# define LV_TXT_ENC LV_TXT_ENC_UTF8 +# endif +#endif + + /*Can break (wrap) texts on these chars*/ +#ifndef LV_TXT_BREAK_CHARS +# ifdef CONFIG_LV_TXT_BREAK_CHARS +# define LV_TXT_BREAK_CHARS CONFIG_LV_TXT_BREAK_CHARS +# else +# define LV_TXT_BREAK_CHARS " ,.;:-_" +# endif +#endif + +/* If a word is at least this long, will break wherever "prettiest" + * To disable, set to a value <= 0 */ +#ifndef LV_TXT_LINE_BREAK_LONG_LEN +# ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_LEN +# define LV_TXT_LINE_BREAK_LONG_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_LEN +# else +# define LV_TXT_LINE_BREAK_LONG_LEN 0 +# endif +#endif + +/* Minimum number of characters in a long word to put on a line before a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN +# ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN +# define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN +# else +# define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 +# endif +#endif + +/* Minimum number of characters in a long word to put on a line after a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN +# ifdef CONFIG_LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN +# define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN CONFIG_LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN +# else +# define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 +# endif +#endif + +/* The control character to use for signalling text recoloring. */ +#ifndef LV_TXT_COLOR_CMD +# ifdef CONFIG_LV_TXT_COLOR_CMD +# define LV_TXT_COLOR_CMD CONFIG_LV_TXT_COLOR_CMD +# else +# define LV_TXT_COLOR_CMD "#" +# endif +#endif + +/* Support bidirectional texts. + * Allows mixing Left-to-Right and Right-to-Left texts. + * The direction will be processed according to the Unicode Bidirectional Algorithm: + * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#ifndef LV_USE_BIDI +# ifdef CONFIG_LV_USE_BIDI +# define LV_USE_BIDI CONFIG_LV_USE_BIDI +# else +# define LV_USE_BIDI 0 +# endif +#endif +#if LV_USE_BIDI +/* Set the default direction. Supported values: + * `LV_BIDI_DIR_LTR` Left-to-Right + * `LV_BIDI_DIR_RTL` Right-to-Left + * `LV_BIDI_DIR_AUTO` detect texts base direction */ +#ifndef LV_BIDI_BASE_DIR_DEF +# ifdef CONFIG_LV_BIDI_BASE_DIR_DEF +# define LV_BIDI_BASE_DIR_DEF CONFIG_LV_BIDI_BASE_DIR_DEF +# else +# define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO +# endif +#endif +#endif + +/* Enable Arabic/Persian processing + * In these languages characters should be replaced with + * an other form based on their position in the text */ +#ifndef LV_USE_ARABIC_PERSIAN_CHARS +# ifdef CONFIG_LV_USE_ARABIC_PERSIAN_CHARS +# define LV_USE_ARABIC_PERSIAN_CHARS CONFIG_LV_USE_ARABIC_PERSIAN_CHARS +# else +# define LV_USE_ARABIC_PERSIAN_CHARS 0 +# endif +#endif + +/*Change the built in (v)snprintf functions*/ +#ifndef LV_SPRINTF_CUSTOM +# ifdef CONFIG_LV_SPRINTF_CUSTOM +# define LV_SPRINTF_CUSTOM CONFIG_LV_SPRINTF_CUSTOM +# else +# define LV_SPRINTF_CUSTOM 0 +# endif +#endif +#if LV_SPRINTF_CUSTOM +#ifndef LV_SPRINTF_INCLUDE +# ifdef CONFIG_LV_SPRINTF_INCLUDE +# define LV_SPRINTF_INCLUDE CONFIG_LV_SPRINTF_INCLUDE +# else +# define LV_SPRINTF_INCLUDE +# endif +#endif +#ifndef lv_snprintf +# ifdef CONFIG_LV_SNPRINTF +# define lv_snprintf CONFIG_LV_SNPRINTF +# else +# define lv_snprintf snprintf +# endif +#endif +#ifndef lv_vsnprintf +# ifdef CONFIG_LV_VSNPRINTF +# define lv_vsnprintf CONFIG_LV_VSNPRINTF +# else +# define lv_vsnprintf vsnprintf +# endif +#endif +#else /*!LV_SPRINTF_CUSTOM*/ +#ifndef LV_SPRINTF_DISABLE_FLOAT +# ifdef CONFIG_LV_SPRINTF_DISABLE_FLOAT +# define LV_SPRINTF_DISABLE_FLOAT CONFIG_LV_SPRINTF_DISABLE_FLOAT +# else +# define LV_SPRINTF_DISABLE_FLOAT 1 +# endif +#endif +#endif /*LV_SPRINTF_CUSTOM*/ + +/*=================== + * LV_OBJ SETTINGS + *==================*/ + +#if LV_USE_USER_DATA +/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ +/*Provide a function to free user data*/ +#ifndef LV_USE_USER_DATA_FREE +# ifdef CONFIG_LV_USE_USER_DATA_FREE +# define LV_USE_USER_DATA_FREE CONFIG_LV_USE_USER_DATA_FREE +# else +# define LV_USE_USER_DATA_FREE 0 +# endif +#endif +#if LV_USE_USER_DATA_FREE +#ifndef LV_USER_DATA_FREE_INCLUDE +# ifdef CONFIG_LV_USER_DATA_FREE_INCLUDE +# define LV_USER_DATA_FREE_INCLUDE CONFIG_LV_USER_DATA_FREE_INCLUDE +# else +# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/ +# endif +#endif +/* Function prototype : void user_data_free(lv_obj_t * obj); */ +#ifndef LV_USER_DATA_FREE +# ifdef CONFIG_LV_USER_DATA_FREE +# define LV_USER_DATA_FREE CONFIG_LV_USER_DATA_FREE +# else +# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/ +# endif +#endif +#endif +#endif + +/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/ +#ifndef LV_USE_OBJ_REALIGN +# ifdef CONFIG_LV_USE_OBJ_REALIGN +# define LV_USE_OBJ_REALIGN CONFIG_LV_USE_OBJ_REALIGN +# else +# define LV_USE_OBJ_REALIGN 1 +# endif +#endif + +/* Enable to make the object clickable on a larger area. + * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature + * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) + * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) + */ +#ifndef LV_USE_EXT_CLICK_AREA +# ifdef CONFIG_LV_USE_EXT_CLICK_AREA +# define LV_USE_EXT_CLICK_AREA CONFIG_LV_USE_EXT_CLICK_AREA +# else +# define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY +# endif +#endif + +/*================== + * LV OBJ X USAGE + *================*/ +/* + * Documentation of the object types: https://docs.lvgl.com/#Object-types + */ + +/*Arc (dependencies: -)*/ +#ifndef LV_USE_ARC +# ifdef CONFIG_LV_USE_ARC +# define LV_USE_ARC CONFIG_LV_USE_ARC +# else +# define LV_USE_ARC 1 +# endif +#endif + +/*Bar (dependencies: -)*/ +#ifndef LV_USE_BAR +# ifdef CONFIG_LV_USE_BAR +# define LV_USE_BAR CONFIG_LV_USE_BAR +# else +# define LV_USE_BAR 1 +# endif +#endif + +/*Button (dependencies: lv_cont*/ +#ifndef LV_USE_BTN +# ifdef CONFIG_LV_USE_BTN +# define LV_USE_BTN CONFIG_LV_USE_BTN +# else +# define LV_USE_BTN 1 +# endif +#endif + +/*Button matrix (dependencies: -)*/ +#ifndef LV_USE_BTNMATRIX +# ifdef CONFIG_LV_USE_BTNMATRIX +# define LV_USE_BTNMATRIX CONFIG_LV_USE_BTNMATRIX +# else +# define LV_USE_BTNMATRIX 1 +# endif +#endif + +/*Calendar (dependencies: -)*/ +#ifndef LV_USE_CALENDAR +# ifdef CONFIG_LV_USE_CALENDAR +# define LV_USE_CALENDAR CONFIG_LV_USE_CALENDAR +# else +# define LV_USE_CALENDAR 1 +# endif +#endif +#if LV_USE_CALENDAR +#ifndef LV_CALENDAR_WEEK_STARTS_MONDAY +# ifdef CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY +# define LV_CALENDAR_WEEK_STARTS_MONDAY CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY +# else +# define LV_CALENDAR_WEEK_STARTS_MONDAY 0 +# endif +#endif +#endif + +/*Canvas (dependencies: lv_img)*/ +#ifndef LV_USE_CANVAS +# ifdef CONFIG_LV_USE_CANVAS +# define LV_USE_CANVAS CONFIG_LV_USE_CANVAS +# else +# define LV_USE_CANVAS 1 +# endif +#endif + +/*Check box (dependencies: lv_btn, lv_label)*/ +#ifndef LV_USE_CHECKBOX +# ifdef CONFIG_LV_USE_CHECKBOX +# define LV_USE_CHECKBOX CONFIG_LV_USE_CHECKBOX +# else +# define LV_USE_CHECKBOX 1 +# endif +#endif + +/*Chart (dependencies: -)*/ +#ifndef LV_USE_CHART +# ifdef CONFIG_LV_USE_CHART +# define LV_USE_CHART CONFIG_LV_USE_CHART +# else +# define LV_USE_CHART 1 +# endif +#endif +#if LV_USE_CHART +#ifndef LV_CHART_AXIS_TICK_LABEL_MAX_LEN +# ifdef CONFIG_LV_CHART_AXIS_TICK_LABEL_MAX_LEN +# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN CONFIG_LV_CHART_AXIS_TICK_LABEL_MAX_LEN +# else +# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256 +# endif +#endif +#endif + +/*Container (dependencies: -*/ +#ifndef LV_USE_CONT +# ifdef CONFIG_LV_USE_CONT +# define LV_USE_CONT CONFIG_LV_USE_CONT +# else +# define LV_USE_CONT 1 +# endif +#endif + +/*Color picker (dependencies: -*/ +#ifndef LV_USE_CPICKER +# ifdef CONFIG_LV_USE_CPICKER +# define LV_USE_CPICKER CONFIG_LV_USE_CPICKER +# else +# define LV_USE_CPICKER 1 +# endif +#endif + +/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ +#ifndef LV_USE_DROPDOWN +# ifdef CONFIG_LV_USE_DROPDOWN +# define LV_USE_DROPDOWN CONFIG_LV_USE_DROPDOWN +# else +# define LV_USE_DROPDOWN 1 +# endif +#endif +#if LV_USE_DROPDOWN != 0 +/*Open and close default animation time [ms] (0: no animation)*/ +#ifndef LV_DROPDOWN_DEF_ANIM_TIME +# ifdef CONFIG_LV_DROPDOWN_DEF_ANIM_TIME +# define LV_DROPDOWN_DEF_ANIM_TIME CONFIG_LV_DROPDOWN_DEF_ANIM_TIME +# else +# define LV_DROPDOWN_DEF_ANIM_TIME 200 +# endif +#endif +#endif + +/*Gauge (dependencies:lv_bar, lv_linemeter)*/ +#ifndef LV_USE_GAUGE +# ifdef CONFIG_LV_USE_GAUGE +# define LV_USE_GAUGE CONFIG_LV_USE_GAUGE +# else +# define LV_USE_GAUGE 1 +# endif +#endif + +/*Image (dependencies: lv_label*/ +#ifndef LV_USE_IMG +# ifdef CONFIG_LV_USE_IMG +# define LV_USE_IMG CONFIG_LV_USE_IMG +# else +# define LV_USE_IMG 1 +# endif +#endif + +/*Image Button (dependencies: lv_btn*/ +#ifndef LV_USE_IMGBTN +# ifdef CONFIG_LV_USE_IMGBTN +# define LV_USE_IMGBTN CONFIG_LV_USE_IMGBTN +# else +# define LV_USE_IMGBTN 1 +# endif +#endif +#if LV_USE_IMGBTN +/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ +#ifndef LV_IMGBTN_TILED +# ifdef CONFIG_LV_IMGBTN_TILED +# define LV_IMGBTN_TILED CONFIG_LV_IMGBTN_TILED +# else +# define LV_IMGBTN_TILED 0 +# endif +#endif +#endif + +/*Keyboard (dependencies: lv_btnm)*/ +#ifndef LV_USE_KEYBOARD +# ifdef CONFIG_LV_USE_KEYBOARD +# define LV_USE_KEYBOARD CONFIG_LV_USE_KEYBOARD +# else +# define LV_USE_KEYBOARD 1 +# endif +#endif + +/*Label (dependencies: -*/ +#ifndef LV_USE_LABEL +# ifdef CONFIG_LV_USE_LABEL +# define LV_USE_LABEL CONFIG_LV_USE_LABEL +# else +# define LV_USE_LABEL 1 +# endif +#endif +#if LV_USE_LABEL != 0 +/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ +#ifndef LV_LABEL_DEF_SCROLL_SPEED +# ifdef CONFIG_LV_LABEL_DEF_SCROLL_SPEED +# define LV_LABEL_DEF_SCROLL_SPEED CONFIG_LV_LABEL_DEF_SCROLL_SPEED +# else +# define LV_LABEL_DEF_SCROLL_SPEED 25 +# endif +#endif + +/* Waiting period at beginning/end of animation cycle */ +#ifndef LV_LABEL_WAIT_CHAR_COUNT +# ifdef CONFIG_LV_LABEL_WAIT_CHAR_COUNT +# define LV_LABEL_WAIT_CHAR_COUNT CONFIG_LV_LABEL_WAIT_CHAR_COUNT +# else +# define LV_LABEL_WAIT_CHAR_COUNT 3 +# endif +#endif + +/*Enable selecting text of the label */ +#ifndef LV_LABEL_TEXT_SEL +# ifdef CONFIG_LV_LABEL_TEXT_SEL +# define LV_LABEL_TEXT_SEL CONFIG_LV_LABEL_TEXT_SEL +# else +# define LV_LABEL_TEXT_SEL 0 +# endif +#endif + +/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/ +#ifndef LV_LABEL_LONG_TXT_HINT +# ifdef CONFIG_LV_LABEL_LONG_TXT_HINT +# define LV_LABEL_LONG_TXT_HINT CONFIG_LV_LABEL_LONG_TXT_HINT +# else +# define LV_LABEL_LONG_TXT_HINT 0 +# endif +#endif +#endif + +/*LED (dependencies: -)*/ +#ifndef LV_USE_LED +# ifdef CONFIG_LV_USE_LED +# define LV_USE_LED CONFIG_LV_USE_LED +# else +# define LV_USE_LED 1 +# endif +#endif +#if LV_USE_LED +#ifndef LV_LED_BRIGHT_MIN +# ifdef CONFIG_LV_LED_BRIGHT_MIN +# define LV_LED_BRIGHT_MIN CONFIG_LV_LED_BRIGHT_MIN +# else +# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/ +# endif +#endif +#ifndef LV_LED_BRIGHT_MAX +# ifdef CONFIG_LV_LED_BRIGHT_MAX +# define LV_LED_BRIGHT_MAX CONFIG_LV_LED_BRIGHT_MAX +# else +# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/ +# endif +#endif +#endif + +/*Line (dependencies: -*/ +#ifndef LV_USE_LINE +# ifdef CONFIG_LV_USE_LINE +# define LV_USE_LINE CONFIG_LV_USE_LINE +# else +# define LV_USE_LINE 1 +# endif +#endif + +/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ +#ifndef LV_USE_LIST +# ifdef CONFIG_LV_USE_LIST +# define LV_USE_LIST CONFIG_LV_USE_LIST +# else +# define LV_USE_LIST 1 +# endif +#endif +#if LV_USE_LIST != 0 +/*Default animation time of focusing to a list element [ms] (0: no animation) */ +#ifndef LV_LIST_DEF_ANIM_TIME +# ifdef CONFIG_LV_LIST_DEF_ANIM_TIME +# define LV_LIST_DEF_ANIM_TIME CONFIG_LV_LIST_DEF_ANIM_TIME +# else +# define LV_LIST_DEF_ANIM_TIME 100 +# endif +#endif +#endif + +/*Line meter (dependencies: *;)*/ +#ifndef LV_USE_LINEMETER +# ifdef CONFIG_LV_USE_LINEMETER +# define LV_USE_LINEMETER CONFIG_LV_USE_LINEMETER +# else +# define LV_USE_LINEMETER 1 +# endif +#endif +#if LV_USE_LINEMETER +/* Draw line more precisely at cost of performance. + * Useful if there are lot of lines any minor are visible + * 0: No extra precision + * 1: Some extra precision + * 2: Best precision + */ +#ifndef LV_LINEMETER_PRECISE +# ifdef CONFIG_LV_LINEMETER_PRECISE +# define LV_LINEMETER_PRECISE CONFIG_LV_LINEMETER_PRECISE +# else +# define LV_LINEMETER_PRECISE 1 +# endif +#endif +#endif + +/*Mask (dependencies: -)*/ +#ifndef LV_USE_OBJMASK +# ifdef CONFIG_LV_USE_OBJMASK +# define LV_USE_OBJMASK CONFIG_LV_USE_OBJMASK +# else +# define LV_USE_OBJMASK 1 +# endif +#endif + +/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ +#ifndef LV_USE_MSGBOX +# ifdef CONFIG_LV_USE_MSGBOX +# define LV_USE_MSGBOX CONFIG_LV_USE_MSGBOX +# else +# define LV_USE_MSGBOX 1 +# endif +#endif + +/*Page (dependencies: lv_cont)*/ +#ifndef LV_USE_PAGE +# ifdef CONFIG_LV_USE_PAGE +# define LV_USE_PAGE CONFIG_LV_USE_PAGE +# else +# define LV_USE_PAGE 1 +# endif +#endif +#if LV_USE_PAGE != 0 +/*Focus default animation time [ms] (0: no animation)*/ +#ifndef LV_PAGE_DEF_ANIM_TIME +# ifdef CONFIG_LV_PAGE_DEF_ANIM_TIME +# define LV_PAGE_DEF_ANIM_TIME CONFIG_LV_PAGE_DEF_ANIM_TIME +# else +# define LV_PAGE_DEF_ANIM_TIME 400 +# endif +#endif +#endif + +/*Preload (dependencies: lv_arc, lv_anim)*/ +#ifndef LV_USE_SPINNER +# ifdef CONFIG_LV_USE_SPINNER +# define LV_USE_SPINNER CONFIG_LV_USE_SPINNER +# else +# define LV_USE_SPINNER 1 +# endif +#endif +#if LV_USE_SPINNER != 0 +#ifndef LV_SPINNER_DEF_ARC_LENGTH +# ifdef CONFIG_LV_SPINNER_DEF_ARC_LENGTH +# define LV_SPINNER_DEF_ARC_LENGTH CONFIG_LV_SPINNER_DEF_ARC_LENGTH +# else +# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/ +# endif +#endif +#ifndef LV_SPINNER_DEF_SPIN_TIME +# ifdef CONFIG_LV_SPINNER_DEF_SPIN_TIME +# define LV_SPINNER_DEF_SPIN_TIME CONFIG_LV_SPINNER_DEF_SPIN_TIME +# else +# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/ +# endif +#endif +#ifndef LV_SPINNER_DEF_ANIM +# ifdef CONFIG_LV_SPINNER_DEF_ANIM +# define LV_SPINNER_DEF_ANIM CONFIG_LV_SPINNER_DEF_ANIM +# else +# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC +# endif +#endif +#endif + +/*Roller (dependencies: lv_ddlist)*/ +#ifndef LV_USE_ROLLER +# ifdef CONFIG_LV_USE_ROLLER +# define LV_USE_ROLLER CONFIG_LV_USE_ROLLER +# else +# define LV_USE_ROLLER 1 +# endif +#endif +#if LV_USE_ROLLER != 0 +/*Focus animation time [ms] (0: no animation)*/ +#ifndef LV_ROLLER_DEF_ANIM_TIME +# ifdef CONFIG_LV_ROLLER_DEF_ANIM_TIME +# define LV_ROLLER_DEF_ANIM_TIME CONFIG_LV_ROLLER_DEF_ANIM_TIME +# else +# define LV_ROLLER_DEF_ANIM_TIME 200 +# endif +#endif + +/*Number of extra "pages" when the roller is infinite*/ +#ifndef LV_ROLLER_INF_PAGES +# ifdef CONFIG_LV_ROLLER_INF_PAGES +# define LV_ROLLER_INF_PAGES CONFIG_LV_ROLLER_INF_PAGES +# else +# define LV_ROLLER_INF_PAGES 7 +# endif +#endif +#endif + +/*Slider (dependencies: lv_bar)*/ +#ifndef LV_USE_SLIDER +# ifdef CONFIG_LV_USE_SLIDER +# define LV_USE_SLIDER CONFIG_LV_USE_SLIDER +# else +# define LV_USE_SLIDER 1 +# endif +#endif + +/*Spinbox (dependencies: lv_ta)*/ +#ifndef LV_USE_SPINBOX +# ifdef CONFIG_LV_USE_SPINBOX +# define LV_USE_SPINBOX CONFIG_LV_USE_SPINBOX +# else +# define LV_USE_SPINBOX 1 +# endif +#endif + +/*Switch (dependencies: lv_slider)*/ +#ifndef LV_USE_SWITCH +# ifdef CONFIG_LV_USE_SWITCH +# define LV_USE_SWITCH CONFIG_LV_USE_SWITCH +# else +# define LV_USE_SWITCH 1 +# endif +#endif + +/*Text area (dependencies: lv_label, lv_page)*/ +#ifndef LV_USE_TEXTAREA +# ifdef CONFIG_LV_USE_TEXTAREA +# define LV_USE_TEXTAREA CONFIG_LV_USE_TEXTAREA +# else +# define LV_USE_TEXTAREA 1 +# endif +#endif +#if LV_USE_TEXTAREA != 0 +#ifndef LV_TEXTAREA_DEF_CURSOR_BLINK_TIME +# ifdef CONFIG_LV_TEXTAREA_DEF_CURSOR_BLINK_TIME +# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME CONFIG_LV_TEXTAREA_DEF_CURSOR_BLINK_TIME +# else +# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ +# endif +#endif +#ifndef LV_TEXTAREA_DEF_PWD_SHOW_TIME +# ifdef CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME +# define LV_TEXTAREA_DEF_PWD_SHOW_TIME CONFIG_LV_TEXTAREA_DEF_PWD_SHOW_TIME +# else +# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +# endif +#endif +#endif + +/*Table (dependencies: lv_label)*/ +#ifndef LV_USE_TABLE +# ifdef CONFIG_LV_USE_TABLE +# define LV_USE_TABLE CONFIG_LV_USE_TABLE +# else +# define LV_USE_TABLE 1 +# endif +#endif +#if LV_USE_TABLE +#ifndef LV_TABLE_COL_MAX +# ifdef CONFIG_LV_TABLE_COL_MAX +# define LV_TABLE_COL_MAX CONFIG_LV_TABLE_COL_MAX +# else +# define LV_TABLE_COL_MAX 12 +# endif +#endif +#ifndef LV_TABLE_CELL_STYLE_CNT +# ifdef CONFIG_LV_TABLE_CELL_STYLE_CNT +# define LV_TABLE_CELL_STYLE_CNT CONFIG_LV_TABLE_CELL_STYLE_CNT +# else +# define LV_TABLE_CELL_STYLE_CNT 4 +# endif +#endif +#endif + +/*Tab (dependencies: lv_page, lv_btnm)*/ +#ifndef LV_USE_TABVIEW +# ifdef CONFIG_LV_USE_TABVIEW +# define LV_USE_TABVIEW CONFIG_LV_USE_TABVIEW +# else +# define LV_USE_TABVIEW 1 +# endif +#endif +# if LV_USE_TABVIEW != 0 +/*Time of slide animation [ms] (0: no animation)*/ +#ifndef LV_TABVIEW_DEF_ANIM_TIME +# ifdef CONFIG_LV_TABVIEW_DEF_ANIM_TIME +# define LV_TABVIEW_DEF_ANIM_TIME CONFIG_LV_TABVIEW_DEF_ANIM_TIME +# else +# define LV_TABVIEW_DEF_ANIM_TIME 300 +# endif +#endif +#endif + +/*Tileview (dependencies: lv_page) */ +#ifndef LV_USE_TILEVIEW +# ifdef CONFIG_LV_USE_TILEVIEW +# define LV_USE_TILEVIEW CONFIG_LV_USE_TILEVIEW +# else +# define LV_USE_TILEVIEW 1 +# endif +#endif +#if LV_USE_TILEVIEW +/*Time of slide animation [ms] (0: no animation)*/ +#ifndef LV_TILEVIEW_DEF_ANIM_TIME +# ifdef CONFIG_LV_TILEVIEW_DEF_ANIM_TIME +# define LV_TILEVIEW_DEF_ANIM_TIME CONFIG_LV_TILEVIEW_DEF_ANIM_TIME +# else +# define LV_TILEVIEW_DEF_ANIM_TIME 300 +# endif +#endif +#endif + +/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ +#ifndef LV_USE_WIN +# ifdef CONFIG_LV_USE_WIN +# define LV_USE_WIN CONFIG_LV_USE_WIN +# else +# define LV_USE_WIN 1 +# endif +#endif + +/*================== + * Non-user section + *==================*/ + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ +#ifndef _CRT_SECURE_NO_WARNINGS +# ifdef CONFIG__CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS CONFIG__CRT_SECURE_NO_WARNINGS +# else +# define _CRT_SECURE_NO_WARNINGS +# endif +#endif +#endif + + + +/*If running without lv_conf.h add typdesf with default value*/ +#if defined(LV_CONF_SKIP) + + /* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ + typedef int16_t lv_coord_t; + +# if LV_USE_ANIMATION + /*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ + typedef void * lv_anim_user_data_t; +# endif + +# if LV_USE_GROUP + typedef void * lv_group_user_data_t; +# endif + +# if LV_USE_FILESYSTEM + typedef void * lv_fs_drv_user_data_t; +# endif + + typedef void * lv_img_decoder_user_data_t; + + typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ + typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/ + + typedef void * lv_font_user_data_t; + +# if LV_USE_USER_DATA + typedef void * lv_obj_user_data_t; +# endif + +#endif + +#endif /*LV_CONF_INTERNAL_H*/ diff --git a/src/libs/lvgl/src/lv_conf_kconfig.h b/src/libs/lvgl/src/lv_conf_kconfig.h new file mode 100644 index 00000000..6225ed02 --- /dev/null +++ b/src/libs/lvgl/src/lv_conf_kconfig.h @@ -0,0 +1,420 @@ +/** + * @file lv_conf_kconfig.h + * Configs that needs special handling when LVGL is used with Kconfig + */ + +#ifndef LV_CONF_KCONFIG_H +#define LV_CONF_KCONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef LV_CONF_KCONFIG_EXTERNAL_INCLUDE +# include LV_CONF_KCONFIG_EXTERNAL_INCLUDE +#else + +# if defined ESP_PLATFORM +# include "sdkconfig.h" +# include "esp_attr.h" +# endif + +# ifdef __NuttX__ +# include +# endif + +#endif /*LV_CONF_KCONFIG_EXTERNAL_INCLUDE*/ + +/******************* + * LV_MEM_SIZE + *******************/ + +#ifndef LV_MEM_SIZE +#if defined (CONFIG_LV_MEM_SIZE_KILOBYTES) +#define CONFIG_LV_MEM_SIZE (CONFIG_LV_MEM_SIZE_KILOBYTES * 1024U) +#endif +#endif + +/******************* + * LV COLOR TRANSP + *******************/ + +#ifndef LV_COLOR_TRANSP +#if defined (CONFIG_LV_COLOR_TRANSP_HEX) +#define CONFIG_LV_COLOR_TRANSP lv_color_hex(CONFIG_LV_COLOR_TRANSP_HEX) +#else +#define CONFIG_LV_COLOR_TRANSP LV_COLOR_LIME +#endif +#endif + +/******************* + * THEME SELECTION + *******************/ + +#ifndef LV_THEME_DEFAULT_INIT +#if defined (CONFIG_LV_THEME_DEFAULT_INIT_EMPTY) +#define CONFIG_LV_THEME_DEFAULT_INIT lv_theme_empty_init +#elif defined (CONFIG_LV_THEME_DEFAULT_INIT_TEMPLATE) +#define CONFIG_LV_THEME_DEFAULT_INIT lv_theme_template_init +#elif defined (CONFIG_LV_THEME_DEFAULT_INIT_MATERIAL) +#define CONFIG_LV_THEME_DEFAULT_INIT lv_theme_material_init +#elif defined (CONFIG_LV_THEME_DEFAULT_INIT_MONO) +#define LV_THEME_DEFAULT_INIT lv_theme_mono_init +#endif +#endif + +/******************* + * COLOR SELECTION + *******************/ + +#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY +#ifdef CONFIG_LV_THEME_DEFAULT_COLOR_PRIMARY +#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(CONFIG_LV_THEME_DEFAULT_COLOR_PRIMARY) +#endif +#endif + +#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY +#ifdef CONFIG_LV_THEME_DEFAULT_COLOR_SECONDARY +#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(CONFIG_LV_THEME_DEFAULT_COLOR_SECONDARY) +#endif +#endif + +/******************** + * FONT SELECTION + *******************/ + +/* NOTE: In Kconfig instead of `LV_THEME_DEFAULT_FONT_SMALL` + * `CONFIG_LV_THEME_DEFAULT_FONT_SMALL_` is defined + * hence the large selection with if-s + */ + +/*------------------ + * SMALL FONT + *-----------------*/ +#ifndef LV_THEME_DEFAULT_FONT_SMALL +#if defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_8 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_10 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_10 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_12 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_14 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_16 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_18 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_18 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_20 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_20 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_22 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_22 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_24 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_24 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_26 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_26 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_28 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_28 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_30 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_30 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_32 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_32 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_34 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_34 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_36 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_36 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_38 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_38 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_40 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_40 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_42 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_42 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_44 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_44 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_46 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_46 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT_48 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_48 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_UNSCII_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_unscii_8 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_UNSCII_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_unscii_16 +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT12SUBPX +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12_subpx +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_MONTSERRAT28COMPRESSED +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_28_compressed +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_DEJAVU_16_PERSIAN_HEBREW +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_dejavu_16_persian_hebrew +#elif defined CONFIG_LV_FONT_DEFAULT_SMALL_SIMSUN_16_CJK +#define CONFIG_LV_THEME_DEFAULT_FONT_SMALL &lv_font_simsun_16_cjk +#endif +#endif + +/*------------------ + * NORMAL FONT + *-----------------*/ +#ifndef LV_THEME_DEFAULT_FONT_NORMAL +#if defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_8 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_10 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_10 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_12 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_12 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_14 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_18 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_18 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_20 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_20 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_22 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_22 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_24 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_24 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_26 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_26 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_28 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_28 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_30 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_30 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_32 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_32 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_34 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_34 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_36 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_36 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_38 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_38 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_40 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_40 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_42 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_42 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_44 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_44 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_46 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_46 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT_48 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_48 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_UNSCII_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_unscii_8 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_UNSCII_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_unscii_16 +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT12SUBPX +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_12_subpx +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_MONTSERRAT28COMPRESSED +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_28_compressed +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_DEJAVU_16_PERSIAN_HEBREW +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_dejavu_16_persian_hebrew +#elif defined CONFIG_LV_FONT_DEFAULT_NORMAL_SIMSUN_16_CJK +#define CONFIG_LV_THEME_DEFAULT_FONT_NORMAL &lv_font_simsun_16_cjk +#endif +#endif + +/*------------------ + * SUBTITLE FONT + *-----------------*/ +#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE +#if defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_8 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_10 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_10 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_12 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_12 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_14 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_16 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_18 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_18 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_20 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_20 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_22 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_22 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_24 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_24 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_26 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_26 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_28 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_28 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_30 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_30 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_32 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_32 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_34 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_34 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_36 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_36 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_38 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_38 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_40 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_40 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_42 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_42 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_44 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_44 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_46 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_46 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_48 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_48 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_UNSCII_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_unscii_8 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_UNSCII_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_unscii_16 +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT12SUBPX +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_12_subpx +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT28COMPRESSED +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_28_compressed +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_DEJAVU_16_PERSIAN_HEBREW +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_dejavu_16_persian_hebrew +#elif defined CONFIG_LV_FONT_DEFAULT_SUBTITLE_SIMSUN_16_CJK +#define CONFIG_LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_simsun_16_cjk +#endif +#endif + +/*------------------ + * TITLE FONT + *-----------------*/ +#ifndef LV_THEME_DEFAULT_FONT_TITLE +#if defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_8 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_10 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_10 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_12 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_12 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_14 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_16 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_18 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_18 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_20 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_20 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_22 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_22 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_24 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_24 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_26 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_26 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_28 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_28 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_30 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_30 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_32 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_32 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_34 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_34 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_36 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_36 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_38 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_38 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_40 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_40 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_42 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_42 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_44 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_44 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_46 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_46 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT_48 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_48 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_UNSCII_8 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_unscii_8 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_UNSCII_16 +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_unscii_16 +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT12SUBPX +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_12_subpx +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_MONTSERRAT28COMPRESSED +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_28_compressed +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_DEJAVU_16_PERSIAN_HEBREW +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_dejavu_16_persian_hebrew +#elif defined CONFIG_LV_FONT_DEFAULT_TITLE_SIMSUN_16_CJK +#define CONFIG_LV_THEME_DEFAULT_FONT_TITLE &lv_font_simsun_16_cjk +#endif +#endif + +/*------------------ + * TEXT ENCODING + *-----------------*/ +#ifndef LV_TEXT_ENC +#ifdef CONFIG_LV_TXT_ENC_UTF8 +#define CONFIG_LV_TXT_ENC LV_TXT_ENC_UTF8 +#elif defined CONFIG_LV_TXT_ENC_ASCII +#define CONFIG_LV_TXT_ENC LV_TXT_ENC_ASCII +#endif +#endif + +/*------------------ + * BIDI DIRECTION + *-----------------*/ + +#ifndef LV_BIDI_BASE_DIR_DEF +#ifdef CONFIG_LV_BIDI_DIR_LTR +#define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_LTR +#elif defined CONFIG_LV_BIDI_DIR_RTL +#define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_RTL +#elif defined CONFIG_LV_BIDI_DIR_AUTO +#define CONFIG_LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO +#endif +#endif + +/*------------------ + * EXT CLICK AREA + *-----------------*/ + +#ifndef LV_USE_EXT_CLICK_AREA +#ifdef CONFIG_LV_USE_EXT_CLICK_AREA_OFF +#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF +#elif defined CONFIG_LV_USE_EXT_CLICK_AREA_TINY +#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY +#elif defined CONFIG_LV_USE_EXT_CLICK_AREA_FULL +#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_FULL +#endif +#endif + +/*------------------ + * LINEMETER PRECISE + *-----------------*/ + +#ifndef LV_LINEMETER_PRECISE +#ifdef CONFIG_LV_LINEMETER_PRECISE_NO_EXTRA_PRECISION +#define CONFIG_LV_LINEMETER_PRECISE 0 +#elif defined CONFIG_LV_LINEMETER_PRECISE_SOME_EXTRA_PRECISION +#define CONFIG_LV_LINEMETER_PRECISE 1 +#elif defined CONFIG_LV_LINEMETER_PRECISE_BEST_PRECISION +#define CONFIG_LV_LINEMETER_PRECISE 2 +#endif +#endif + +/*------------------ + * SPINNER DEF ANIM + *-----------------*/ + +#ifndef LV_SPINNER_DEF_ANIM +#ifdef CONFIG_LV_SPINNER_TYPE_SPINNING_ARC +#define CONFIG_LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC +#elif defined CONFIG_LV_SPINNER_TYPE_FILLSPIN_ARC +#define CONFIG_LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_FILLSPIN_ARC +#elif defined CONFIG_LV_SPINNER_TYPE_CONSTANT_ARC +#define CONFIG_LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_CONSTANT_ARC +#endif +#endif + +/*------------------ + * SPRINTF DISABLE FLOAT + *-----------------*/ + +#if defined(CONFIG_LV_CONF_SKIP) || defined(LV_CONF_SKIP) +# ifndef LV_SPRINTF_DISABLE_FLOAT +# ifndef CONFIG_LV_SPRINTF_DISABLE_FLOAT +# define LV_SPRINTF_DISABLE_FLOAT 0 +# else +# define LV_SPRINTF_DISABLE_FLOAT 1 +# endif +# endif +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_CONF_KCONFIG_H*/ diff --git a/src/libs/lvgl/src/lv_conf_zephyr.h b/src/libs/lvgl/src/lv_conf_zephyr.h new file mode 100644 index 00000000..e4e338f2 --- /dev/null +++ b/src/libs/lvgl/src/lv_conf_zephyr.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Jan Van Winkel + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifdef __ZEPHYR__ + + #include + + #define LV_MEM_CUSTOM 1 + + #define LV_MEMCPY_MEMSET_STD 1 + + #ifdef CONFIG_LVGL_MEM_POOL_HEAP_KERNEL + + #define LV_MEM_CUSTOM_INCLUDE "kernel.h" + #define LV_MEM_CUSTOM_ALLOC k_malloc + #define LV_MEM_CUTOM_FREE k_free + + #elif defined(CONFIG_LVGL_MEM_POOL_HEAP_LIB_C) + + #define LV_MEM_CUSTOM_INCLUDE "stdlib.h" + #define LV_MEM_CUSTOM_ALLOC malloc + #define LV_MEM_CUTOM_FREE free + + #else + + #define LV_MEM_CUSTOM_INCLUDE "lvgl_mem.h" + #define LV_MEM_CUSTOM_ALLOC lvgl_malloc + #define LV_MEM_CUTOM_FREE lvgl_free + + #endif + + #define LV_ENABLE_GC 0 + + #define LV_TICK_CUSTOM 1 + #define LV_TICK_CUSTOM_INCLUDE "kernel.h" + #define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32()) + + #define LV_SPRINTF_CUSTOM 1 + + #if LV_SPRINTF_CUSTOM + #define LV_SPRINTF_INCLUDE "stdio.h" + #define lv_snprintf snprintf + #define lv_vsnprintf vsnprintf + #endif + +#endif diff --git a/src/libs/lvgl/src/lv_core/lv_core.mk b/src/libs/lvgl/src/lv_core/lv_core.mk index eb1c5e0c..b46c0162 100644 --- a/src/libs/lvgl/src/lv_core/lv_core.mk +++ b/src/libs/lvgl/src/lv_core/lv_core.mk @@ -4,9 +4,8 @@ CSRCS += lv_disp.c CSRCS += lv_obj.c CSRCS += lv_refr.c CSRCS += lv_style.c -CSRCS += lv_debug.c -DEPPATH += --dep-path $(LVGL_DIR)/lvgl/src/lv_core -VPATH += :$(LVGL_DIR)/lvgl/src/lv_core +DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core +VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core -CFLAGS += "-I$(LVGL_DIR)/lvgl/src/lv_core" +CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core" diff --git a/src/libs/lvgl/src/lv_core/lv_debug.c b/src/libs/lvgl/src/lv_core/lv_debug.c deleted file mode 100644 index 83071af5..00000000 --- a/src/libs/lvgl/src/lv_core/lv_debug.c +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @file lv_debug.c - * - */ - -/********************* - * INCLUDES - *********************/ -#include "lv_obj.h" -#include "lv_debug.h" - -#if LV_USE_DEBUG - -/********************* - * DEFINES - *********************/ -#ifndef LV_DEBUG_STR_MAX_LENGTH -#define LV_DEBUG_STR_MAX_LENGTH (1024 * 8) -#endif - -#ifndef LV_DEBUG_STR_MAX_REPEAT -#define LV_DEBUG_STR_MAX_REPEAT 8 -#endif -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ -static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find); - -/********************** - * STATIC VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -bool lv_debug_check_null(const void * p) -{ - if(p) return true; - - return false; -} - -bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type) -{ - if(obj_type[0] == '\0') return true; - - lv_obj_type_t types; - lv_obj_get_type((lv_obj_t *)obj, &types); - - uint8_t i; - for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) { - if(strcmp(types.type[i], obj_type) == 0) return true; - } - - return false; -} - -bool lv_debug_check_obj_valid(const lv_obj_t * obj) -{ - lv_disp_t * disp = lv_disp_get_next(NULL); - while(disp) { - lv_obj_t * scr; - LV_LL_READ(disp->scr_ll, scr) { - - if(scr == obj) return true; - bool found = obj_valid_child(scr, obj); - if(found) return true; - } - - disp = lv_disp_get_next(disp); - } - - return false; -} - -bool lv_debug_check_style(const lv_style_t * style) -{ - if(style == NULL) return true; /*NULL style is still valid*/ - -#if LV_USE_ASSERT_STYLE - if(style->debug_sentinel != LV_STYLE_DEGUG_SENTINEL_VALUE) { - LV_LOG_WARN("Invalid style (local variable or not initialized?)"); - return false; - } -#endif - - return true; -} - -bool lv_debug_check_str(const void * str) -{ - const uint8_t * s = (const uint8_t *)str; - uint8_t last_byte = 0; - uint32_t rep = 0; - uint32_t i; - - for(i = 0; s[i] != '\0' && i < LV_DEBUG_STR_MAX_LENGTH; i++) { - if(s[i] != last_byte) { - last_byte = s[i]; - rep = 1; - } else if(s[i] > 0x7F){ - rep++; - if(rep > LV_DEBUG_STR_MAX_REPEAT) { - LV_LOG_WARN("lv_debug_check_str: a non-ASCII char has repeated more than LV_DEBUG_STR_MAX_REPEAT times)"); - return false; - } - } - - if(s[i] < 10) { - LV_LOG_WARN("lv_debug_check_str: invalid char in the string (< 10 value)"); - return false; /*Shouldn't occur in strings*/ - } - } - - if(s[i] == '\0') return true; - - LV_LOG_WARN("lv_debug_check_str: string is longer than LV_DEBUG_STR_MAX_LENGTH"); - return false; -} - -void lv_debug_log_error(const char * msg, uint64_t value) -{ - static const char hex[] = "0123456789ABCDEF"; - - size_t msg_len = strlen(msg); - uint32_t value_len = sizeof(unsigned long int); - - if(msg_len < 230) { - char buf[255]; - char * bufp = buf; - - /*Add the function name*/ - memcpy(bufp, msg, msg_len); - bufp += msg_len; - - /*Add value in hey*/ - *bufp = ' '; - bufp ++; - *bufp = '('; - bufp ++; - *bufp = '0'; - bufp ++; - *bufp = 'x'; - bufp ++; - - int8_t i; - for(i = value_len * 2 - 1; i >= 0; i--) { - uint8_t x = (unsigned long int)((unsigned long int)value >> (i * 4)) & 0xF; - - *bufp = hex[x]; - bufp++; - } - - *bufp = ')'; - bufp ++; - - *bufp = '\0'; - LV_LOG_ERROR(buf); - } else { - LV_LOG_ERROR(msg); - } -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find) -{ - /*Check all children of `parent`*/ - lv_obj_t * child; - LV_LL_READ(parent->child_ll, child) { - if(child == obj_to_find) return true; - - /*Check the children*/ - bool found = obj_valid_child(child, obj_to_find); - if(found) return true; - } - - return false; -} - -#endif /*LV_USE_DEBUG*/ - diff --git a/src/libs/lvgl/src/lv_core/lv_debug.h b/src/libs/lvgl/src/lv_core/lv_debug.h deleted file mode 100644 index a932004e..00000000 --- a/src/libs/lvgl/src/lv_core/lv_debug.h +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @file lv_debug.h - * - */ - -#ifndef LV_DEBUG_H -#define LV_DEBUG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "lv_obj.h" - -#if LV_USE_DEBUG - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -bool lv_debug_check_null(const void * p); - -bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type); - -bool lv_debug_check_obj_valid(const lv_obj_t * obj); - -bool lv_debug_check_style(const lv_style_t * style); - -bool lv_debug_check_str(const void * str); - -void lv_debug_log_error(const char * msg, uint64_t value); - -/********************** - * MACROS - **********************/ - -#ifndef LV_DEBUG_ASSERT -#define LV_DEBUG_ASSERT(expr, msg, value) \ -{ \ - if(!(expr)) { \ - LV_LOG_ERROR(__func__); \ - lv_debug_log_error(msg, (uint64_t)((uintptr_t)value)); \ - while(1); \ - } \ -} -#endif - -/*---------------- - * CHECKS - *----------------*/ - -#ifndef LV_DEBUG_IS_NULL -#define LV_DEBUG_IS_NULL(p) (lv_debug_check_null(p)) -#endif - -#ifndef LV_DEBUG_IS_STR -#define LV_DEBUG_IS_STR(str) (lv_debug_check_null(str) && \ - lv_debug_check_str(str)) -#endif - -#ifndef LV_DEBUG_IS_OBJ -#define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \ - lv_debug_check_obj_valid(obj_p) && \ - lv_debug_check_obj_type(obj_p, obj_type)) -#endif - -#ifndef LV_DEBUG_IS_STYLE -#define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p)) -#endif - -/*----------------- - * ASSERTS - *-----------------*/ - -/*clang-format off*/ - -#if LV_USE_ASSERT_NULL -# ifndef LV_ASSERT_NULL -# define LV_ASSERT_NULL(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "NULL pointer", p); -# endif -#else -# define LV_ASSERT_NULL(p) true -#endif - -#if LV_USE_ASSERT_MEM -# ifndef LV_ASSERT_MEM -# define LV_ASSERT_MEM(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "Out of memory", p); -# endif -#else -# define LV_ASSERT_MEM(p) true -#endif - -#if LV_USE_ASSERT_STR -# ifndef LV_ASSERT_STR -# define LV_ASSERT_STR(str) LV_DEBUG_ASSERT(LV_DEBUG_IS_STR(str), "Strange or invalid string", str); -# endif -#else /* LV_USE_ASSERT_OBJ == 0 */ -# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/ -# define LV_ASSERT_STR(str) LV_ASSERT_NULL(str) -# else -# define LV_ASSERT_STR(str) true -# endif -#endif - - -#if LV_USE_ASSERT_OBJ -# ifndef LV_ASSERT_OBJ -# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p); -# endif -#else /* LV_USE_ASSERT_OBJ == 0 */ -# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/ -# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p) -# else -# define LV_ASSERT_OBJ(obj_p, obj_type) true -# endif -#endif - - -#if LV_USE_ASSERT_STYLE -# ifndef LV_ASSERT_STYLE -# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p); -# endif -#else -# define LV_ASSERT_STYLE(style) true -#endif - -#else /* LV_USE_DEBUG == 0 */ - -#define LV_DEBUG_ASSERT(expr, msg, value) do{}while(0) - -#define LV_ASSERT_NULL(p) true -#define LV_ASSERT_MEM(p) true -#define LV_ASSERT_STR(p) true -#define LV_ASSERT_OBJ(obj, obj_type) true -#define LV_ASSERT_STYLE(p) true - -#endif /* LV_USE_DEBUG */ -/*clang-format on*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_DEBUG_H*/ diff --git a/src/libs/lvgl/src/lv_core/lv_disp.c b/src/libs/lvgl/src/lv_core/lv_disp.c index bcb73829..c88cc9af 100644 --- a/src/libs/lvgl/src/lv_core/lv_disp.c +++ b/src/libs/lvgl/src/lv_core/lv_disp.c @@ -8,6 +8,7 @@ *********************/ #include "lv_disp.h" #include "../lv_misc/lv_math.h" +#include "../lv_core/lv_refr.h" /********************* * DEFINES @@ -21,6 +22,12 @@ * STATIC PROTOTYPES **********************/ +#if LV_USE_ANIMATION + static void scr_load_anim_start(lv_anim_t * a); + static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v); + static void scr_anim_ready(lv_anim_t * a); +#endif + /********************** * STATIC VARIABLES **********************/ @@ -43,13 +50,30 @@ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp) { if(!disp) disp = lv_disp_get_default(); if(!disp) { - LV_LOG_WARN("lv_scr_act: no display registered to get its top layer"); + LV_LOG_WARN("no display registered to get its active screen"); return NULL; } return disp->act_scr; } +/** + * Return with a pointer to the previous screen. Only used during screen transitions. + * @param disp pointer to display which previous screen should be get. (NULL to use the default + * screen) + * @return pointer to the previous screen object or NULL if not used now + */ +lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp) +{ + if(!disp) disp = lv_disp_get_default(); + if(!disp) { + LV_LOG_WARN("no display registered to get its previous screen"); + return NULL; + } + + return disp->prev_scr; +} + /** * Make a screen active * @param scr pointer to a screen @@ -57,7 +81,7 @@ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp) void lv_disp_load_scr(lv_obj_t * scr) { lv_disp_t * d = lv_obj_get_disp(scr); - + if(!d) return; /*Shouldn't happen, just to be sure*/ d->act_scr = scr; lv_obj_invalidate(scr); @@ -82,14 +106,14 @@ lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp) /** * Return with the sys. layer. (Same on every screen and it is above the normal screen and the top * layer) - * @param disp pointer to display which sys. layer should be get. (NULL to use the default screen) + * @param disp pointer to display which sys. layer should be get. (NULL to use the default screen) * @return pointer to the sys layer object (transparent screen sized lv_obj) */ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp) { if(!disp) disp = lv_disp_get_default(); if(!disp) { - LV_LOG_WARN("lv_layer_sys: no display registered to get its top layer"); + LV_LOG_WARN("lv_layer_sys: no display registered to get its sys. layer"); return NULL; } @@ -112,46 +136,206 @@ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr) if(old_disp == disp) return; - lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true); + _lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true); } /** - * Get a pointer to the screen refresher task to - * modify its parameters with `lv_task_...` functions. + * Set the background color of a display * @param disp pointer to a display - * @return pointer to the display refresher task. (NULL on error) + * @param color color of the background */ -lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp) +void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color) { if(!disp) disp = lv_disp_get_default(); if(!disp) { - LV_LOG_WARN("lv_disp_get_refr_task: no display registered"); - return NULL; + LV_LOG_WARN("no display registered"); + return; } - return disp->refr_task; + disp->bg_color = color; + + lv_area_t a; + lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1); + _lv_inv_area(disp, &a); + } /** - * Get elapsed time since last user activity on a display (e.g. click) - * @param disp pointer to an display (NULL to get the overall smallest inactivity) - * @return elapsed ticks (milliseconds) since the last activity + * Set the background image of a display + * @param disp pointer to a display + * @param img_src path to file or pointer to an `lv_img_dsc_t` variable */ -uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp) +void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src) { if(!disp) disp = lv_disp_get_default(); if(!disp) { - LV_LOG_WARN("lv_disp_get_inactive_time: no display registered"); - return 0; + LV_LOG_WARN("no display registered"); + return; + } + + disp->bg_img = img_src; + + lv_area_t a; + lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1); + _lv_inv_area(disp, &a); +} + +/** + * Opacity of the background + * @param disp pointer to a display + * @param opa opacity (0..255) + */ +void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa) +{ + if(!disp) disp = lv_disp_get_default(); + if(!disp) { + LV_LOG_WARN("no display registered"); + return; + } + + disp->bg_opa = opa; + + lv_area_t a; + lv_area_set(&a, 0, 0, lv_disp_get_hor_res(disp) - 1, lv_disp_get_ver_res(disp) - 1); + _lv_inv_area(disp, &a); +} + +#if LV_USE_ANIMATION + +/** + * Switch screen with animation + * @param scr pointer to the new screen to load + * @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT` + * @param time time of the animation + * @param delay delay before the transition + * @param auto_del true: automatically delete the old screen + */ +void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del) +{ + lv_disp_t * d = lv_obj_get_disp(new_scr); + lv_obj_t * act_scr = lv_scr_act(); + + if(d->del_prev && act_scr != d->scr_to_load && d->scr_to_load) { + lv_obj_del(act_scr); + lv_disp_load_scr(d->scr_to_load); + lv_anim_del(d->scr_to_load, NULL); + lv_obj_set_pos(d->scr_to_load, 0, 0); + lv_style_remove_prop(lv_obj_get_local_style(d->scr_to_load, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE); + + act_scr = d->scr_to_load; + } + + d->scr_to_load = new_scr; + + if(d->prev_scr && d->del_prev) { + lv_obj_del(d->prev_scr); + d->prev_scr = NULL; + } + + d->del_prev = auto_del; + + /*Be sure there is no other animation on the screens*/ + lv_anim_del(new_scr, NULL); + lv_anim_del(lv_scr_act(), NULL); + + /*Be sure both screens are in a normal position*/ + lv_obj_set_pos(new_scr, 0, 0); + lv_obj_set_pos(lv_scr_act(), 0, 0); + lv_style_remove_prop(lv_obj_get_local_style(new_scr, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE); + lv_style_remove_prop(lv_obj_get_local_style(lv_scr_act(), LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE); + + lv_anim_t a_new; + lv_anim_init(&a_new); + lv_anim_set_var(&a_new, new_scr); + lv_anim_set_start_cb(&a_new, scr_load_anim_start); + lv_anim_set_ready_cb(&a_new, scr_anim_ready); + lv_anim_set_time(&a_new, time); + lv_anim_set_delay(&a_new, delay); + + lv_anim_t a_old; + lv_anim_init(&a_old); + lv_anim_set_var(&a_old, d->act_scr); + lv_anim_set_time(&a_old, time); + lv_anim_set_delay(&a_old, delay); + + switch(anim_type) { + case LV_SCR_LOAD_ANIM_NONE: + /* Create a dummy animation to apply the delay*/ + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_new, 0, 0); + break; + case LV_SCR_LOAD_ANIM_OVER_LEFT: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0); + break; + case LV_SCR_LOAD_ANIM_OVER_RIGHT: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0); + break; + case LV_SCR_LOAD_ANIM_OVER_TOP: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y); + lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0); + break; + case LV_SCR_LOAD_ANIM_OVER_BOTTOM: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y); + lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0); + break; + case LV_SCR_LOAD_ANIM_MOVE_LEFT: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0); + + lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d)); + break; + case LV_SCR_LOAD_ANIM_MOVE_RIGHT: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0); + + lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_x); + lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d)); + break; + case LV_SCR_LOAD_ANIM_MOVE_TOP: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y); + lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0); + + lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y); + lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d)); + break; + case LV_SCR_LOAD_ANIM_MOVE_BOTTOM: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) lv_obj_set_y); + lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0); + + lv_anim_set_exec_cb(&a_old, (lv_anim_exec_xcb_t) lv_obj_set_y); + lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d)); + break; + + case LV_SCR_LOAD_ANIM_FADE_ON: + lv_anim_set_exec_cb(&a_new, (lv_anim_exec_xcb_t) opa_scale_anim); + lv_anim_set_values(&a_new, LV_OPA_TRANSP, LV_OPA_COVER); + break; } + lv_anim_start(&a_new); + lv_anim_start(&a_old); +} + +#endif + +/** + * Get elapsed time since last user activity on a display (e.g. click) + * @param disp pointer to an display (NULL to get the overall smallest inactivity) + * @return elapsed ticks (milliseconds) since the last activity + */ +uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp) +{ if(disp) return lv_tick_elaps(disp->last_activity_time); lv_disp_t * d; uint32_t t = UINT32_MAX; d = lv_disp_get_next(NULL); while(d) { - t = LV_MATH_MIN(t, lv_tick_elaps(d->last_activity_time)); + uint32_t elaps = lv_tick_elaps(d->last_activity_time); + t = LV_MATH_MIN(t, elaps); d = lv_disp_get_next(d); } @@ -173,6 +357,64 @@ void lv_disp_trig_activity(lv_disp_t * disp) disp->last_activity_time = lv_tick_get(); } +/** + * Clean any CPU cache that is related to the display. + * @param disp pointer to an display (NULL to use the default display) + */ +void lv_disp_clean_dcache(lv_disp_t * disp) +{ + if(!disp) disp = lv_disp_get_default(); + if(!disp) { + LV_LOG_WARN("lv_disp_clean_dcache: no display registered"); + return; + } + + if(disp->driver.clean_dcache_cb) + disp->driver.clean_dcache_cb(&disp->driver); +} + +/** + * Get a pointer to the screen refresher task to + * modify its parameters with `lv_task_...` functions. + * @param disp pointer to a display + * @return pointer to the display refresher task. (NULL on error) + */ +lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp) +{ + if(!disp) disp = lv_disp_get_default(); + if(!disp) { + LV_LOG_WARN("lv_disp_get_refr_task: no display registered"); + return NULL; + } + + return disp->refr_task; +} + /********************** * STATIC FUNCTIONS **********************/ + +#if LV_USE_ANIMATION +static void scr_load_anim_start(lv_anim_t * a) +{ + lv_disp_t * d = lv_obj_get_disp(a->var); + d->prev_scr = lv_scr_act(); + + lv_disp_load_scr(a->var); +} + +static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v) +{ + lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v); +} + +static void scr_anim_ready(lv_anim_t * a) +{ + lv_disp_t * d = lv_obj_get_disp(a->var); + + if(d->prev_scr && d->del_prev) lv_obj_del(d->prev_scr); + d->prev_scr = NULL; + d->scr_to_load = NULL; + lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE); +} +#endif diff --git a/src/libs/lvgl/src/lv_core/lv_disp.h b/src/libs/lvgl/src/lv_core/lv_disp.h index 30471543..d733ad75 100644 --- a/src/libs/lvgl/src/lv_core/lv_disp.h +++ b/src/libs/lvgl/src/lv_core/lv_disp.h @@ -24,6 +24,19 @@ extern "C" { * TYPEDEFS **********************/ +typedef enum { + LV_SCR_LOAD_ANIM_NONE, + LV_SCR_LOAD_ANIM_OVER_LEFT, + LV_SCR_LOAD_ANIM_OVER_RIGHT, + LV_SCR_LOAD_ANIM_OVER_TOP, + LV_SCR_LOAD_ANIM_OVER_BOTTOM, + LV_SCR_LOAD_ANIM_MOVE_LEFT, + LV_SCR_LOAD_ANIM_MOVE_RIGHT, + LV_SCR_LOAD_ANIM_MOVE_TOP, + LV_SCR_LOAD_ANIM_MOVE_BOTTOM, + LV_SCR_LOAD_ANIM_FADE_ON, +} lv_scr_load_anim_t; + /********************** * GLOBAL PROTOTYPES **********************/ @@ -36,6 +49,14 @@ extern "C" { */ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp); +/** + * Return with a pointer to the previous screen. Only used during screen transitions. + * @param disp pointer to display which previous screen should be get. (NULL to use the default + * screen) + * @return pointer to the previous screen object or NULL if not used now + */ +lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp); + /** * Make a screen active * @param scr pointer to a screen @@ -64,14 +85,41 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp); */ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr); + /** - * Get a pointer to the screen refresher task to - * modify its parameters with `lv_task_...` functions. + * Set the background color of a display * @param disp pointer to a display - * @return pointer to the display refresher task. (NULL on error) + * @param color color of the background + */ +void lv_disp_set_bg_color(lv_disp_t * disp, lv_color_t color); + +/** + * Set the background image of a display + * @param disp pointer to a display + * @param img_src path to file or pointer to an `lv_img_dsc_t` variable + */ +void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src); + +/** + * Opacity of the background + * @param disp pointer to a display + * @param opa opacity (0..255) + */ +void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa); + +#if LV_USE_ANIMATION + +/** + * Switch screen with animation + * @param scr pointer to the new screen to load + * @param anim_type type of the animation from `lv_scr_load_anim_t`. E.g. `LV_SCR_LOAD_ANIM_MOVE_LEFT` + * @param time time of the animation + * @param delay delay before the transition + * @param auto_del true: automatically delete the old screen */ -lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp); +void lv_scr_load_anim(lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del); +#endif /** * Get elapsed time since last user activity on a display (e.g. click) * @param disp pointer to an display (NULL to get the overall smallest inactivity) @@ -85,6 +133,20 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp); */ void lv_disp_trig_activity(lv_disp_t * disp); +/** + * Clean any CPU cache that is related to the display. + * @param disp pointer to an display (NULL to use the default display) + */ +void lv_disp_clean_dcache(lv_disp_t * disp); + +/** + * Get a pointer to the screen refresher task to + * modify its parameters with `lv_task_...` functions. + * @param disp pointer to a display + * @return pointer to the display refresher task. (NULL on error) + */ +lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp); + /*------------------------------------------------ * To improve backward compatibility * Recommended only if you have one display @@ -145,8 +207,22 @@ static inline void lv_scr_load(lv_obj_t * scr) #define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) #endif + +/** + * Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP) + * 1 dip is 1 px on a 160 DPI screen + * 1 dip is 2 px on a 320 DPI screen + * https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp + */ +#define LV_DPX(n) (n == 0 ? 0 :LV_MATH_MAX((( lv_disp_get_dpi(NULL) * (n) + 80) / 160), 1)) /*+80 for rounding*/ + +static inline lv_coord_t lv_dpx(lv_coord_t n) +{ + return LV_DPX(n); +} + #ifdef __cplusplus } /* extern "C" */ #endif -#endif /*LV_TEMPL_H*/ +#endif /*LV_DISP_H*/ diff --git a/src/libs/lvgl/src/lv_core/lv_group.c b/src/libs/lvgl/src/lv_core/lv_group.c index b26de56e..f47494ce 100644 --- a/src/libs/lvgl/src/lv_core/lv_group.c +++ b/src/libs/lvgl/src/lv_core/lv_group.c @@ -9,14 +9,10 @@ #include "lv_group.h" #if LV_USE_GROUP != 0 #include -#include "../lv_core/lv_debug.h" +#include "../lv_misc/lv_debug.h" #include "../lv_themes/lv_theme.h" #include "../lv_misc/lv_gc.h" -#if defined(LV_GC_INCLUDE) -#include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -28,9 +24,6 @@ /********************** * STATIC PROTOTYPES **********************/ -static void style_mod_def(lv_group_t * group, lv_style_t * style); -static void style_mod_edit_def(lv_group_t * group, lv_style_t * style); -static void refresh_theme(lv_group_t * g, lv_theme_t * th); static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *), void * (*move)(const lv_ll_t *, const void *)); static void lv_group_refocus(lv_group_t * g); @@ -51,9 +44,9 @@ static void obj_to_foreground(lv_obj_t * obj); /** * Init. the group module */ -void lv_group_init(void) +void _lv_group_init(void) { - lv_ll_init(&LV_GC_ROOT(_lv_group_ll), sizeof(lv_group_t)); + _lv_ll_init(&LV_GC_ROOT(_lv_group_ll), sizeof(lv_group_t)); } /** @@ -62,10 +55,10 @@ void lv_group_init(void) */ lv_group_t * lv_group_create(void) { - lv_group_t * group = lv_ll_ins_head(&LV_GC_ROOT(_lv_group_ll)); + lv_group_t * group = _lv_ll_ins_head(&LV_GC_ROOT(_lv_group_ll)); LV_ASSERT_MEM(group); if(group == NULL) return NULL; - lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *)); + _lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *)); group->obj_focus = NULL; group->frozen = 0; @@ -76,12 +69,9 @@ lv_group_t * lv_group_create(void) group->wrap = 1; #if LV_USE_USER_DATA - memset(&group->user_data, 0, sizeof(lv_group_user_data_t)); + _lv_memset_00(&group->user_data, sizeof(lv_group_user_data_t)); #endif - /*Initialize style modification callbacks from current theme*/ - refresh_theme(group, lv_theme_get_current()); - return group; } @@ -91,7 +81,7 @@ lv_group_t * lv_group_create(void) */ void lv_group_del(lv_group_t * group) { - /*Defocus the the currently focused object*/ + /*Defocus the currently focused object*/ if(group->obj_focus != NULL) { (*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); lv_obj_invalidate(*group->obj_focus); @@ -99,13 +89,12 @@ void lv_group_del(lv_group_t * group) /*Remove the objects from the group*/ lv_obj_t ** obj; - LV_LL_READ(group->obj_ll, obj) - { + _LV_LL_READ(group->obj_ll, obj) { (*obj)->group_p = NULL; } - lv_ll_clear(&(group->obj_ll)); - lv_ll_rem(&LV_GC_ROOT(_lv_group_ll), group); + _lv_ll_clear(&(group->obj_ll)); + _lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group); lv_mem_free(group); } @@ -117,11 +106,9 @@ void lv_group_del(lv_group_t * group) void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj) { if(group == NULL) return; - /*Do not add the object twice*/ lv_obj_t ** obj_i; - LV_LL_READ(group->obj_ll, obj_i) - { + _LV_LL_READ(group->obj_ll, obj_i) { if((*obj_i) == obj) { LV_LOG_INFO("lv_group_add_obj: the object is already added to this group"); return; @@ -138,14 +125,14 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj) } obj->group_p = group; - lv_obj_t ** next = lv_ll_ins_tail(&group->obj_ll); + lv_obj_t ** next = _lv_ll_ins_tail(&group->obj_ll); LV_ASSERT_MEM(next); if(next == NULL) return; *next = obj; /* If the head and the tail is equal then there is only one object in the linked list. * In this case automatically activate it*/ - if(lv_ll_get_head(&group->obj_ll) == next) { + if(_lv_ll_get_head(&group->obj_ll) == next) { lv_group_refocus(group); } } @@ -158,12 +145,13 @@ void lv_group_remove_obj(lv_obj_t * obj) { lv_group_t * g = obj->group_p; if(g == NULL) return; - if(g->obj_focus == NULL) return; /*Just to be sure (Not possible if there is at least one object in the group)*/ /*Focus on the next object*/ if(*g->obj_focus == obj) { + if(g->frozen) g->frozen = 0; + /*If this is the only object in the group then focus to nothing.*/ - if(lv_ll_get_head(&g->obj_ll) == g->obj_focus && lv_ll_get_tail(&g->obj_ll) == g->obj_focus) { + if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) { (*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL); } /*If there more objects in the group then focus to the next/prev object*/ @@ -181,10 +169,9 @@ void lv_group_remove_obj(lv_obj_t * obj) /*Search the object and remove it from its group */ lv_obj_t ** i; - LV_LL_READ(g->obj_ll, i) - { + _LV_LL_READ(g->obj_ll, i) { if(*i == obj) { - lv_ll_rem(&g->obj_ll, i); + _lv_ll_remove(&g->obj_ll, i); lv_mem_free(i); obj->group_p = NULL; break; @@ -198,7 +185,7 @@ void lv_group_remove_obj(lv_obj_t * obj) */ void lv_group_remove_all_objs(lv_group_t * group) { - /*Defocus the the currently focused object*/ + /*Defocus the currently focused object*/ if(group->obj_focus != NULL) { (*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); lv_obj_invalidate(*group->obj_focus); @@ -207,12 +194,11 @@ void lv_group_remove_all_objs(lv_group_t * group) /*Remove the objects from the group*/ lv_obj_t ** obj; - LV_LL_READ(group->obj_ll, obj) - { + _LV_LL_READ(group->obj_ll, obj) { (*obj)->group_p = NULL; } - lv_ll_clear(&(group->obj_ll)); + _lv_ll_clear(&(group->obj_ll)); } /** @@ -227,12 +213,13 @@ void lv_group_focus_obj(lv_obj_t * obj) if(g->frozen != 0) return; + if(g->obj_focus != NULL && obj == *g->obj_focus) return; + /*On defocus edit mode must be leaved*/ lv_group_set_editing(g, false); lv_obj_t ** i; - LV_LL_READ(g->obj_ll, i) - { + _LV_LL_READ(g->obj_ll, i) { if(*i == obj) { if(g->obj_focus != NULL) { (*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL); @@ -250,7 +237,7 @@ void lv_group_focus_obj(lv_obj_t * obj) if(res != LV_RES_OK) return; lv_obj_invalidate(*g->obj_focus); - /*If the object or its parent has `top == true` bring it to the foregorund*/ + /*If the object or its parent has `top == true` bring it to the foreground*/ obj_to_foreground(*g->obj_focus); } break; @@ -264,7 +251,7 @@ void lv_group_focus_obj(lv_obj_t * obj) */ void lv_group_focus_next(lv_group_t * group) { - focus_next_core(group, lv_ll_get_head, lv_ll_get_next); + focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next); } /** @@ -273,7 +260,7 @@ void lv_group_focus_next(lv_group_t * group) */ void lv_group_focus_prev(lv_group_t * group) { - focus_next_core(group, lv_ll_get_tail, lv_ll_get_prev); + focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev); } /** @@ -311,28 +298,6 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c) return res; } -/** - * Set a function for a group which will modify the object's style if it is in focus - * @param group pointer to a group - * @param style_mod_cb the style modifier function pointer - */ -void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb) -{ - group->style_mod_cb = style_mod_cb; - if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus); -} - -/** - * Set a function for a group which will modify the object's style if it is in focus in edit mode - * @param group pointer to a group - * @param style_mod_func the style modifier function pointer - */ -void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb) -{ - group->style_mod_edit_cb = style_mod_edit_cb; - if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus); -} - /** * Set a function for a group which will be called when a new object is focused * @param group pointer to a group @@ -350,6 +315,7 @@ void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb) */ void lv_group_set_editing(lv_group_t * group, bool edit) { + if(group == NULL) return; uint8_t en_val = edit ? 1 : 0; if(en_val == group->editing) return; /*Do not set the same mode again*/ @@ -361,9 +327,9 @@ void lv_group_set_editing(lv_group_t * group, bool edit) focused->signal_cb(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again to properly leave/open edit/navigate mode*/ lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL); if(res != LV_RES_OK) return; - } - lv_obj_invalidate(focused); + lv_obj_invalidate(focused); + } } /** @@ -391,25 +357,6 @@ void lv_group_set_wrap(lv_group_t * group, bool en) group->wrap = en ? 1 : 0; } -/** - * Modify a style with the set 'style_mod' function. The input style remains unchanged. - * @param group pointer to group - * @param style pointer to a style to modify - * @return a copy of the input style but modified with the 'style_mod' function - */ -lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style) -{ - /*Load the current style. It will be modified by the callback*/ - lv_style_copy(&group->style_tmp, style); - - if(group->editing) { - if(group->style_mod_edit_cb) group->style_mod_edit_cb(group, &group->style_tmp); - } else { - if(group->style_mod_cb) group->style_mod_cb(group, &group->style_tmp); - } - return &group->style_tmp; -} - /** * Get the focused object or NULL if there isn't one * @param group pointer to a group @@ -435,28 +382,6 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group) } #endif -/** - * Get a the style modifier function of a group - * @param group pointer to a group - * @return pointer to the style modifier function - */ -lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group) -{ - if(!group) return false; - return group->style_mod_cb; -} - -/** - * Get a the style modifier function of a group in edit mode - * @param group pointer to a group - * @return pointer to the style modifier function - */ -lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group) -{ - if(!group) return false; - return group->style_mod_edit_cb; -} - /** * Get the focus callback function of a group * @param group pointer to a group @@ -464,7 +389,7 @@ lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group) */ lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group) { - if(!group) return false; + if(!group) return NULL; return group->focus_cb; } @@ -501,27 +426,6 @@ bool lv_group_get_wrap(lv_group_t * group) return group->wrap ? true : false; } -/** - * Notify the group that current theme changed and style modification callbacks need to be - * refreshed. - * @param group pointer to group. If NULL then all groups are notified. - */ -void lv_group_report_style_mod(lv_group_t * group) -{ - lv_theme_t * th = lv_theme_get_current(); - - if(group != NULL) { - refresh_theme(group, th); - return; - } - - lv_group_t * i; - LV_LL_READ(LV_GC_ROOT(_lv_group_ll), i) - { - refresh_theme(i, th); - } -} - /********************** * STATIC FUNCTIONS **********************/ @@ -540,89 +444,6 @@ static void lv_group_refocus(lv_group_t * g) g->wrap = temp_wrap; } -/** - * Default style modifier function - * @param group pointer to the caller group - * @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN. - */ -static void style_mod_def(lv_group_t * group, lv_style_t * style) -{ - (void)group; /*Unused*/ -#if LV_COLOR_DEPTH != 1 - - /*Make the style to be a little bit orange*/ - style->body.border.opa = LV_OPA_COVER; - style->body.border.color = LV_COLOR_ORANGE; - - /*If not transparent or has border then emphasis the border*/ - if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20; - - style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_ORANGE, LV_OPA_70); - style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_ORANGE, LV_OPA_70); - style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_ORANGE, LV_OPA_60); - - style->text.color = lv_color_mix(style->text.color, LV_COLOR_ORANGE, LV_OPA_70); - - /*Add some recolor to the images*/ - if(style->image.intense < LV_OPA_MIN) { - style->image.color = LV_COLOR_ORANGE; - style->image.intense = LV_OPA_40; - } -#else - style->body.border.opa = LV_OPA_COVER; - style->body.border.color = LV_COLOR_BLACK; - style->body.border.width = 2; - -#endif -} - -/** - * Default style modifier function - * @param group pointer to the caller group - * @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN. - */ -static void style_mod_edit_def(lv_group_t * group, lv_style_t * style) -{ - (void)group; /*Unused*/ -#if LV_COLOR_DEPTH != 1 - - /*Make the style to be a little bit orange*/ - style->body.border.opa = LV_OPA_COVER; - style->body.border.color = LV_COLOR_GREEN; - - /*If not empty or has border then emphasis the border*/ - if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20; - - style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_GREEN, LV_OPA_70); - style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_GREEN, LV_OPA_70); - style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60); - - style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70); - - /*Add some recolor to the images*/ - if(style->image.intense < LV_OPA_MIN) { - style->image.color = LV_COLOR_GREEN; - style->image.intense = LV_OPA_40; - } - -#else - style->body.border.opa = LV_OPA_COVER; - style->body.border.color = LV_COLOR_BLACK; - style->body.border.width = 3; - -#endif -} - -static void refresh_theme(lv_group_t * g, lv_theme_t * th) -{ - g->style_mod_cb = style_mod_def; - g->style_mod_edit_cb = style_mod_edit_def; - if(th) { - if(th->group.style_mod_xcb) g->style_mod_cb = th->group.style_mod_xcb; - if(th->group.style_mod_edit_xcb) g->style_mod_edit_cb = th->group.style_mod_edit_xcb; - } -} - static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *), void * (*move)(const lv_ll_t *, const void *)) { @@ -640,7 +461,8 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *) obj_next = begin(&group->obj_ll); can_move = false; can_begin = false; - } else { + } + else { /*Currently focused object is the last/first in the group, keep it that way*/ return; } @@ -661,8 +483,9 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *) can_move = true; if(obj_next == NULL) continue; + if(lv_obj_get_state(*obj_next, LV_OBJ_PART_MAIN) & LV_STATE_DISABLED) continue; - /*Hidden objects don't receive focus*/ + /*Hidden and disabled objects don't receive focus*/ if(!lv_obj_get_hidden(*obj_next)) break; } @@ -681,7 +504,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *) lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL); if(res != LV_RES_OK) return; - /*If the object or its parent has `top == true` bring it to the foregorund*/ + /*If the object or its parent has `top == true` bring it to the foreground*/ obj_to_foreground(*group->obj_focus); lv_obj_invalidate(*group->obj_focus); diff --git a/src/libs/lvgl/src/lv_core/lv_group.h b/src/libs/lvgl/src/lv_core/lv_group.h index c27f7693..43dc99e3 100644 --- a/src/libs/lvgl/src/lv_core/lv_group.h +++ b/src/libs/lvgl/src/lv_core/lv_group.h @@ -13,11 +13,6 @@ extern "C" { /********************* * INCLUDES *********************/ -#ifdef LV_CONF_INCLUDE_SIMPLE -#include "lv_conf.h" -#else -#include "../../../lv_conf.h" -#endif #include "lv_obj.h" @@ -56,15 +51,11 @@ typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *); * Groups can be used to logically hold objects so that they can be individually focused. * They are NOT for laying out objects on a screen (try `lv_cont` for that). */ -typedef struct _lv_group_t -{ +typedef struct _lv_group_t { lv_ll_t obj_ll; /**< Linked list to store the objects in the group */ lv_obj_t ** obj_focus; /**< The object in focus*/ - lv_group_style_mod_cb_t style_mod_cb; /**< A function to modifies the style of the focused object*/ - lv_group_style_mod_cb_t style_mod_edit_cb; /**< A function which modifies the style of the edited object*/ lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/ - lv_style_t style_tmp; /**< Stores the modified style of the focused object */ #if LV_USE_USER_DATA lv_group_user_data_t user_data; #endif @@ -90,7 +81,7 @@ typedef uint8_t lv_group_refocus_policy_t; * Init. the group module * @remarks Internal function, do not call directly. */ -void lv_group_init(void); +void _lv_group_init(void); /** * Create a new object group @@ -156,20 +147,6 @@ void lv_group_focus_freeze(lv_group_t * group, bool en); */ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c); -/** - * Set a function for a group which will modify the object's style if it is in focus - * @param group pointer to a group - * @param style_mod_cb the style modifier function pointer - */ -void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb); - -/** - * Set a function for a group which will modify the object's style if it is in focus in edit mode - * @param group pointer to a group - * @param style_mod_edit_cb the style modifier function pointer - */ -void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb); - /** * Set a function for a group which will be called when a new object is focused * @param group pointer to a group @@ -178,7 +155,7 @@ void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb); /** - * Set whether the next or previous item in a group is focused if the currently focussed obj is + * Set whether the next or previous item in a group is focused if the currently focused obj is * deleted. * @param group pointer to a group * @param new refocus policy enum @@ -206,14 +183,6 @@ void lv_group_set_click_focus(lv_group_t * group, bool en); */ void lv_group_set_wrap(lv_group_t * group, bool en); -/** - * Modify a style with the set 'style_mod' function. The input style remains unchanged. - * @param group pointer to group - * @param style pointer to a style to modify - * @return a copy of the input style but modified with the 'style_mod' function - */ -lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style); - /** * Get the focused object or NULL if there isn't one * @param group pointer to a group @@ -231,20 +200,6 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group); #endif -/** - * Get a the style modifier function of a group - * @param group pointer to a group - * @return pointer to the style modifier function - */ -lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group); - -/** - * Get a the style modifier function of a group in edit mode - * @param group pointer to a group - * @return pointer to the style modifier function - */ -lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group); - /** * Get the focus callback function of a group * @param group pointer to a group @@ -273,13 +228,6 @@ bool lv_group_get_click_focus(const lv_group_t * group); */ bool lv_group_get_wrap(lv_group_t * group); -/** - * Notify the group that current theme changed and style modification callbacks need to be - * refreshed. - * @param group pointer to group. If NULL then all groups are notified. - */ -void lv_group_report_style_mod(lv_group_t * group); - /********************** * MACROS **********************/ diff --git a/src/libs/lvgl/src/lv_core/lv_indev.c b/src/libs/lvgl/src/lv_core/lv_indev.c index 6ec59bda..30afaa04 100644 --- a/src/libs/lvgl/src/lv_core/lv_indev.c +++ b/src/libs/lvgl/src/lv_core/lv_indev.c @@ -21,7 +21,7 @@ *********************/ #if LV_INDEV_DEF_DRAG_THROW <= 0 -#warning "LV_INDEV_DRAG_THROW must be greater than 0" + #warning "LV_INDEV_DRAG_THROW must be greater than 0" #endif /********************** @@ -39,9 +39,11 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data); static void indev_proc_press(lv_indev_proc_t * proc); static void indev_proc_release(lv_indev_proc_t * proc); static void indev_proc_reset_query_handler(lv_indev_t * indev); -static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj); -static void indev_drag(lv_indev_proc_t * state); +static void indev_click_focus(lv_indev_proc_t * proc); +static void indev_drag(lv_indev_proc_t * proc); static void indev_drag_throw(lv_indev_proc_t * proc); +static lv_obj_t * get_dragged_obj(lv_obj_t * obj); +static void indev_gesture(lv_indev_proc_t * proc); static bool indev_reset_check(lv_indev_proc_t * proc); /********************** @@ -61,16 +63,16 @@ static lv_obj_t * indev_obj_act = NULL; /** * Initialize the display input device subsystem */ -void lv_indev_init(void) +void _lv_indev_init(void) { - lv_indev_reset(NULL); /*Reset all input devices*/ + lv_indev_reset(NULL, NULL); /*Reset all input devices*/ } /** * Called periodically to read the input devices * @param param pointer to and input device to read */ -void lv_indev_read_task(lv_task_t * task) +void _lv_indev_read_task(lv_task_t * task) { LV_LOG_TRACE("indev read task started"); @@ -88,7 +90,7 @@ void lv_indev_read_task(lv_task_t * task) bool more_to_read; do { /*Read the data*/ - more_to_read = lv_indev_read(indev_act, &data); + more_to_read = _lv_indev_read(indev_act, &data); /*The active object might deleted even in the read function*/ indev_proc_reset_query_handler(indev_act); @@ -99,17 +101,21 @@ void lv_indev_read_task(lv_task_t * task) /*Save the last activity time*/ if(indev_act->proc.state == LV_INDEV_STATE_PR) { indev_act->driver.disp->last_activity_time = lv_tick_get(); - } else if(indev_act->driver.type == LV_INDEV_TYPE_ENCODER && data.enc_diff) { + } + else if(indev_act->driver.type == LV_INDEV_TYPE_ENCODER && data.enc_diff) { indev_act->driver.disp->last_activity_time = lv_tick_get(); } if(indev_act->driver.type == LV_INDEV_TYPE_POINTER) { indev_pointer_proc(indev_act, &data); - } else if(indev_act->driver.type == LV_INDEV_TYPE_KEYPAD) { + } + else if(indev_act->driver.type == LV_INDEV_TYPE_KEYPAD) { indev_keypad_proc(indev_act, &data); - } else if(indev_act->driver.type == LV_INDEV_TYPE_ENCODER) { + } + else if(indev_act->driver.type == LV_INDEV_TYPE_ENCODER) { indev_encoder_proc(indev_act, &data); - } else if(indev_act->driver.type == LV_INDEV_TYPE_BUTTON) { + } + else if(indev_act->driver.type == LV_INDEV_TYPE_BUTTON) { indev_button_proc(indev_act, &data); } /*Handle reset query if it happened in during processing*/ @@ -144,19 +150,41 @@ lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev) return indev->driver.type; } + /** * Reset one or all input devices * @param indev pointer to an input device to reset or NULL to reset all of them + * @param obj pointer to an object which triggers the reset. */ -void lv_indev_reset(lv_indev_t * indev) +void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj) { - if(indev) + if(indev) { indev->proc.reset_query = 1; + if(indev_act == indev) indev_obj_act = NULL; + if(obj == NULL || indev->proc.types.pointer.last_pressed == obj) { + indev->proc.types.pointer.last_pressed = NULL; + } + if(obj == NULL || indev->proc.types.pointer.act_obj == obj) { + indev->proc.types.pointer.act_obj = NULL; + } + if(obj == NULL || indev->proc.types.pointer.last_obj == obj) { + indev->proc.types.pointer.last_obj = NULL; + } + } else { lv_indev_t * i = lv_indev_get_next(NULL); while(i) { i->proc.reset_query = 1; - + if(indev_act == i) indev_obj_act = NULL; + if(obj == NULL || i->proc.types.pointer.last_pressed == obj) { + i->proc.types.pointer.last_pressed = NULL; + } + if(obj == NULL || i->proc.types.pointer.act_obj == obj) { + i->proc.types.pointer.act_obj = NULL; + } + if(obj == NULL || i->proc.types.pointer.last_obj == obj) { + i->proc.types.pointer.last_obj = NULL; + } i = lv_indev_get_next(i); } } @@ -197,6 +225,7 @@ void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj) indev->cursor = cur_obj; lv_obj_set_parent(indev->cursor, lv_disp_get_layer_sys(indev->driver.disp)); lv_obj_set_pos(indev->cursor, indev->proc.types.pointer.act_point.x, indev->proc.types.pointer.act_point.y); + lv_obj_set_click(indev->cursor, false); } #if LV_USE_GROUP @@ -219,7 +248,7 @@ void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group) * @param indev pointer to an input device * @param group point to a group */ -void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points) +void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]) { if(indev->driver.type == LV_INDEV_TYPE_BUTTON) { indev->btn_points = points; @@ -233,15 +262,31 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points) */ void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point) { + if(indev == NULL) { + point->x = 0; + point->y = 0; + return; + } if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) { point->x = -1; point->y = -1; - } else { + } + else { point->x = indev->proc.types.pointer.act_point.x; point->y = indev->proc.types.pointer.act_point.y; } } +/** +* Get the current gesture direct +* @param indev pointer to an input device +* @return current gesture direct +*/ +lv_gesture_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev) +{ + return indev->proc.types.pointer.gesture_dir; +} + /** * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) * @param indev pointer to an input device @@ -285,21 +330,62 @@ void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point) if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) { point->x = 0; point->y = 0; - } else { + } + else { point->x = indev->proc.types.pointer.vect.x; point->y = indev->proc.types.pointer.vect.y; } } +/** + * Manually finish dragging. + * `LV_SIGNAL_DRAG_END` and `LV_EVENT_DRAG_END` will be sent. + * @param indev pointer to an input device + * @return `LV_RES_INV` if the object being dragged was deleted. Else `LV_RES_OK`. + */ +lv_res_t lv_indev_finish_drag(lv_indev_t * indev) +{ + if(indev == NULL) return LV_RES_OK; + if(indev->driver.type != LV_INDEV_TYPE_POINTER) return LV_RES_OK; + if(indev->proc.types.pointer.drag_in_prog == 0) return LV_RES_OK; + + indev->proc.types.pointer.drag_in_prog = 0; + indev->proc.types.pointer.drag_throw_vect.x = 0; + indev->proc.types.pointer.drag_throw_vect.y = 0; + + lv_obj_t * drag_obj; + drag_obj = get_dragged_obj(indev->proc.types.pointer.act_obj); + if(drag_obj == NULL) return LV_RES_OK; + + lv_res_t res; + res = drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, NULL); + if(res != LV_RES_OK) return res; + + res = lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); + if(res != LV_RES_OK) return res; + + return res; +} + /** * Do nothing until the next release * @param indev pointer to an input device */ void lv_indev_wait_release(lv_indev_t * indev) { + if(indev == NULL)return; indev->proc.wait_until_release = 1; } +/** + * Gets a pointer to the currently active object in the currently processed input device. + * @return pointer to currently active object or NULL if no active object + */ +lv_obj_t * lv_indev_get_obj_act(void) +{ + return indev_obj_act; +} + /** * Get a pointer to the indev read task to * modify its parameters with `lv_task_...` functions. @@ -316,15 +402,6 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev) return indev->refr_task; } -/** - * Gets a pointer to the currently active object in the currently processed input device. - * @return pointer to currently active object or NULL if no active object - */ -lv_obj_t * lv_indev_get_obj_act(void) -{ - return indev_obj_act; -} - /********************** * STATIC FUNCTIONS **********************/ @@ -336,6 +413,16 @@ lv_obj_t * lv_indev_get_obj_act(void) */ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) { + lv_disp_t *disp = i->driver.disp; + if(disp->driver.rotated == LV_DISP_ROT_180 || disp->driver.rotated == LV_DISP_ROT_270) { + data->point.x = disp->driver.hor_res - data->point.x - 1; + data->point.y = disp->driver.ver_res - data->point.y - 1; + } + if(disp->driver.rotated == LV_DISP_ROT_90 || disp->driver.rotated == LV_DISP_ROT_270) { + lv_coord_t tmp = data->point.y; + data->point.y = data->point.x; + data->point.x = disp->driver.ver_res - tmp - 1; + } /*Move the cursor if set and moved*/ if(i->cursor != NULL && (i->proc.types.pointer.last_point.x != data->point.x || i->proc.types.pointer.last_point.y != data->point.y)) { @@ -347,7 +434,8 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) if(i->proc.state == LV_INDEV_STATE_PR) { indev_proc_press(&i->proc); - } else { + } + else { indev_proc_release(&i->proc); } @@ -404,7 +492,8 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) if(indev_reset_check(&i->proc)) return; lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL); if(indev_reset_check(&i->proc)) return; - } else if(data->key == LV_KEY_ESC) { + } + else if(data->key == LV_KEY_ESC) { /*Send the ESC as a normal KEY*/ lv_group_send_data(g, LV_KEY_ESC); @@ -430,6 +519,14 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) } /*Pressing*/ else if(data->state == LV_INDEV_STATE_PR && prev_state == LV_INDEV_STATE_PR) { + + if(data->key == LV_KEY_ENTER) { + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSING, NULL); + if(indev_reset_check(&i->proc)) return; + lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL); + if(indev_reset_check(&i->proc)) return; + } + /*Long press time has elapsed?*/ if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) { i->proc.long_pr_sent = 1; @@ -466,7 +563,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) lv_group_focus_prev(g); if(indev_reset_check(&i->proc)) return; } - /*Just send other keys again to the object (e.g. 'A' or `LV_GORUP_KEY_RIGHT)*/ + /*Just send other keys again to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT)*/ else { lv_group_send_data(g, data->key); if(indev_reset_check(&i->proc)) return; @@ -522,7 +619,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) } /* Save the last keys before anything else. - * They need to be already saved if the the function returns for any reason*/ + * They need to be already saved if the function returns for any reason*/ lv_indev_state_t last_state = i->proc.types.keypad.last_state; i->proc.types.keypad.last_state = data->state; i->proc.types.keypad.last_key = data->key; @@ -533,26 +630,9 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) indev_obj_act = lv_group_get_focused(g); if(indev_obj_act == NULL) return; - /*Process the steps first. They are valid only with released button*/ - if(data->state == LV_INDEV_STATE_REL) { - /*In edit mode send LEFT/RIGHT keys*/ - if(lv_group_get_editing(g)) { - int32_t s; - if(data->enc_diff < 0) { - for(s = 0; s < -data->enc_diff; s++) lv_group_send_data(g, LV_KEY_LEFT); - } else if(data->enc_diff > 0) { - for(s = 0; s < data->enc_diff; s++) lv_group_send_data(g, LV_KEY_RIGHT); - } - } - /*In navigate mode focus on the next/prev objects*/ - else { - int32_t s; - if(data->enc_diff < 0) { - for(s = 0; s < -data->enc_diff; s++) lv_group_focus_prev(g); - } else if(data->enc_diff > 0) { - for(s = 0; s < data->enc_diff; s++) lv_group_focus_next(g); - } - } + /*Process the steps they are valid only with released button*/ + if(data->state != LV_INDEV_STATE_REL) { + data->enc_diff = 0; } /*Refresh the focused object. It might change due to lv_group_focus_prev/next*/ @@ -561,69 +641,111 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) /*Button press happened*/ if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) { - bool editable = false; - indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable); i->proc.pr_timestamp = lv_tick_get(); - if(lv_group_get_editing(g) == true || editable == false) { - indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL); - if(indev_reset_check(&i->proc)) return; - lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL); + if(data->key == LV_KEY_ENTER) { + bool editable = false; + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable); + + if(lv_group_get_editing(g) == true || editable == false) { + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL); + if(indev_reset_check(&i->proc)) return; + + lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL); + if(indev_reset_check(&i->proc)) return; + } + } + else if(data->key == LV_KEY_LEFT) { + /*emulate encoder left*/ + data->enc_diff--; + } + else if(data->key == LV_KEY_RIGHT) { + /*emulate encoder right*/ + data->enc_diff++; + } + else if(data->key == LV_KEY_ESC) { + /*Send the ESC as a normal KEY*/ + lv_group_send_data(g, LV_KEY_ESC); + + lv_event_send(indev_obj_act, LV_EVENT_CANCEL, NULL); if(indev_reset_check(&i->proc)) return; } + /*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/ + else { + lv_group_send_data(g, data->key); + } } /*Pressing*/ else if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_PR) { + /* Long press*/ if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) { - bool editable = false; - indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable); - /*On enter long press toggle edit mode.*/ - if(editable) { - /*Don't leave edit mode if there is only one object (nowhere to navigate)*/ - if(lv_ll_is_empty(&g->obj_ll) == false) { - lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/ + i->proc.long_pr_sent = 1; + i->proc.longpr_rep_timestamp = lv_tick_get(); + + if(data->key == LV_KEY_ENTER) { + bool editable = false; + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable); + + /*On enter long press toggle edit mode.*/ + if(editable) { + /*Don't leave edit mode if there is only one object (nowhere to navigate)*/ + if(_lv_ll_get_len(&g->obj_ll) > 1) { + lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/ + } + } + /*If not editable then just send a long press signal*/ + else { + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL); + if(indev_reset_check(&i->proc)) return; + lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL); + if(indev_reset_check(&i->proc)) return; } } - /*If not editable then just send a long press signal*/ - else { - indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL); + + i->proc.long_pr_sent = 1; + } + /*Long press repeated time has elapsed?*/ + else if(i->proc.long_pr_sent != 0 && lv_tick_elaps(i->proc.longpr_rep_timestamp) > i->driver.long_press_rep_time) { + + i->proc.longpr_rep_timestamp = lv_tick_get(); + + if(data->key == LV_KEY_ENTER) { + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL); if(indev_reset_check(&i->proc)) return; - lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL); + lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL); if(indev_reset_check(&i->proc)) return; } - i->proc.long_pr_sent = 1; + else if(data->key == LV_KEY_LEFT) { + /*emulate encoder left*/ + data->enc_diff--; + } + else if(data->key == LV_KEY_RIGHT) { + /*emulate encoder right*/ + data->enc_diff++; + } + else { + lv_group_send_data(g, data->key); + if(indev_reset_check(&i->proc)) return; + } + } + } /*Release happened*/ else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) { - bool editable = false; - indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable); - - /*The button was released on a non-editable object. Just send enter*/ - if(editable == false) { - indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL); - if(indev_reset_check(&i->proc)) return; - - if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL); - if(indev_reset_check(&i->proc)) return; - - lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL); - if(indev_reset_check(&i->proc)) return; + if(data->key == LV_KEY_ENTER) { + bool editable = false; + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable); - lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL); - if(indev_reset_check(&i->proc)) return; - } - /*An object is being edited and the button is released. */ - else if(g->editing) { - /*Ignore long pressed enter release because it comes from mode switch*/ - if(!i->proc.long_pr_sent || lv_ll_is_empty(&g->obj_ll)) { + /*The button was released on a non-editable object. Just send enter*/ + if(editable == false) { indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL); if(indev_reset_check(&i->proc)) return; - lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL); + if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL); if(indev_reset_check(&i->proc)) return; lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL); @@ -631,20 +753,62 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL); if(indev_reset_check(&i->proc)) return; + } + /*An object is being edited and the button is released. */ + else if(g->editing) { + /*Ignore long pressed enter release because it comes from mode switch*/ + if(!i->proc.long_pr_sent || _lv_ll_get_len(&g->obj_ll) <= 1) { + indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL); + if(indev_reset_check(&i->proc)) return; + + lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL); + if(indev_reset_check(&i->proc)) return; + + lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL); + if(indev_reset_check(&i->proc)) return; - lv_group_send_data(g, LV_KEY_ENTER); + lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL); + if(indev_reset_check(&i->proc)) return; + + lv_group_send_data(g, LV_KEY_ENTER); + } + } + /*If the focused object is editable and now in navigate mode then on enter switch edit + mode*/ + else if(editable && !g->editing && !i->proc.long_pr_sent) { + lv_group_set_editing(g, true); /*Set edit mode*/ } - } - /*If the focused object is editable and now in navigate mode then on enter switch edit - mode*/ - else if(editable && !g->editing && !i->proc.long_pr_sent) { - lv_group_set_editing(g, true); /*Set edit mode*/ } i->proc.pr_timestamp = 0; i->proc.long_pr_sent = 0; } indev_obj_act = NULL; + + /*if encoder steps or simulated steps via left/right keys*/ + if(data->enc_diff != 0) { + /*In edit mode send LEFT/RIGHT keys*/ + if(lv_group_get_editing(g)) { + int32_t s; + if(data->enc_diff < 0) { + for(s = 0; s < -data->enc_diff; s++) lv_group_send_data(g, LV_KEY_LEFT); + } + else if(data->enc_diff > 0) { + for(s = 0; s < data->enc_diff; s++) lv_group_send_data(g, LV_KEY_RIGHT); + } + } + /*In navigate mode focus on the next/prev objects*/ + else { + int32_t s; + if(data->enc_diff < 0) { + for(s = 0; s < -data->enc_diff; s++) lv_group_focus_prev(g); + } + else if(data->enc_diff > 0) { + for(s = 0; s < data->enc_diff; s++) lv_group_focus_next(g); + } + } + } + #else (void)data; /*Unused*/ (void)i; /*Unused*/ @@ -659,24 +823,40 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) */ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data) { - i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x; - i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y; + /* Die gracefully if i->btn_points is NULL */ + if(i->btn_points == NULL) { + LV_LOG_WARN("indev_button_proc: btn_points was NULL"); + return; + } - /*Still the same point is pressed*/ - if(i->proc.types.pointer.last_point.x == i->proc.types.pointer.act_point.x && - i->proc.types.pointer.last_point.y == i->proc.types.pointer.act_point.y && data->state == LV_INDEV_STATE_PR) { - indev_proc_press(&i->proc); - } else { - /*If a new point comes always make a release*/ - indev_proc_release(&i->proc); + lv_coord_t x = i->btn_points[data->btn_id].x; + lv_coord_t y = i->btn_points[data->btn_id].y; + + /*If a new point comes always make a release*/ + if(data->state == LV_INDEV_STATE_PR) { + if(i->proc.types.pointer.last_point.x != x || + i->proc.types.pointer.last_point.y != y) { + indev_proc_release(&i->proc); + } } + if(indev_reset_check(&i->proc)) return; + + /*Save the new points*/ + i->proc.types.pointer.act_point.x = x; + i->proc.types.pointer.act_point.y = y; + + if(data->state == LV_INDEV_STATE_PR) indev_proc_press(&i->proc); + else indev_proc_release(&i->proc); + + if(indev_reset_check(&i->proc)) return; + i->proc.types.pointer.last_point.x = i->proc.types.pointer.act_point.x; i->proc.types.pointer.last_point.y = i->proc.types.pointer.act_point.y; } /** - * Process the pressed state of LV_INDEV_TYPE_POINER input devices + * Process the pressed state of LV_INDEV_TYPE_POINTER input devices * @param indev pointer to an input device 'proc' * @return LV_RES_OK: no indev reset required; LV_RES_INV: indev reset is required */ @@ -691,20 +871,24 @@ static void indev_proc_press(lv_indev_proc_t * proc) /*If there is no last object then search*/ if(indev_obj_act == NULL) { - indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp)); - if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp)); - if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp)); + indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_sys(disp), &proc->types.pointer.act_point); + if(indev_obj_act == NULL) indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_top(disp), + &proc->types.pointer.act_point); + if(indev_obj_act == NULL) indev_obj_act = lv_indev_search_obj(lv_disp_get_scr_act(disp), + &proc->types.pointer.act_point); new_obj_searched = true; } /*If there is last object but it is not dragged and not protected also search*/ else if(proc->types.pointer.drag_in_prog == 0 && lv_obj_is_protected(indev_obj_act, LV_PROTECT_PRESS_LOST) == false) { - indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_sys(disp)); - if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_layer_top(disp)); - if(indev_obj_act == NULL) indev_obj_act = indev_search_obj(proc, lv_disp_get_scr_act(disp)); + indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_sys(disp), &proc->types.pointer.act_point); + if(indev_obj_act == NULL) indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_top(disp), + &proc->types.pointer.act_point); + if(indev_obj_act == NULL) indev_obj_act = lv_indev_search_obj(lv_disp_get_scr_act(disp), + &proc->types.pointer.act_point); new_obj_searched = true; } - /*If a dragable or a protected object was the last then keep it*/ + /*If a draggable or a protected object was the last then keep it*/ else { } @@ -736,14 +920,17 @@ static void indev_proc_press(lv_indev_proc_t * proc) proc->types.pointer.last_obj = indev_obj_act; if(indev_obj_act != NULL) { - /* Save the time when the obj pressed. - * It is necessary to count the long press time.*/ + /* Save the time when the obj pressed to count long press time.*/ proc->pr_timestamp = lv_tick_get(); proc->long_pr_sent = 0; proc->types.pointer.drag_limit_out = 0; proc->types.pointer.drag_in_prog = 0; proc->types.pointer.drag_sum.x = 0; proc->types.pointer.drag_sum.y = 0; + proc->types.pointer.drag_dir = LV_DRAG_DIR_BOTH; + proc->types.pointer.gesture_sent = 0; + proc->types.pointer.gesture_sum.x = 0; + proc->types.pointer.gesture_sum.y = 0; proc->types.pointer.vect.x = 0; proc->types.pointer.vect.y = 0; @@ -766,6 +953,13 @@ static void indev_proc_press(lv_indev_proc_t * proc) lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL); if(indev_reset_check(proc)) return; + + if(indev_act->proc.wait_until_release) return; + + /*Handle focus*/ + indev_click_focus(&indev_act->proc); + if(indev_reset_check(proc)) return; + } } @@ -795,8 +989,10 @@ static void indev_proc_press(lv_indev_proc_t * proc) if(indev_reset_check(proc)) return; lv_event_send(indev_obj_act, LV_EVENT_PRESSING, NULL); if(indev_reset_check(proc)) return; + if(indev_act->proc.wait_until_release) return; indev_drag(proc); + indev_gesture(proc); if(indev_reset_check(proc)) return; /*If there is no drag then check for long press time*/ @@ -830,7 +1026,7 @@ static void indev_proc_press(lv_indev_proc_t * proc) } /** - * Process the released state of LV_INDEV_TYPE_POINER input devices + * Process the released state of LV_INDEV_TYPE_POINTER input devices * @param proc pointer to an input device 'proc' */ static void indev_proc_release(lv_indev_proc_t * proc) @@ -846,6 +1042,7 @@ static void indev_proc_release(lv_indev_proc_t * proc) /*Forget the act obj and send a released signal */ if(indev_obj_act) { + /* If the object was protected against press lost then it possible that * the object is already not pressed but still it is the `act_obj`. * In this case send the `LV_SIGNAL_RELEASED/CLICKED` instead of `LV_SIGNAL_PRESS_LOST` if @@ -887,64 +1084,14 @@ static void indev_proc_release(lv_indev_proc_t * proc) if(indev_reset_check(proc)) return; } - if(indev_reset_check(proc)) return; - - /*Handle click focus*/ - bool click_focus_sent = false; -#if LV_USE_GROUP - lv_group_t * g = lv_obj_get_group(indev_obj_act); - - /*Check, if the parent is in a group and focus on it.*/ - /*Respect the click focus protection*/ - if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false) { - lv_obj_t * parent = indev_obj_act; - - while(g == NULL) { - parent = lv_obj_get_parent(parent); - if(parent == NULL) break; - - /*Ignore is the protected against click focus*/ - if(lv_obj_is_protected(parent, LV_PROTECT_CLICK_FOCUS)) { - parent = NULL; - break; - } - g = lv_obj_get_group(parent); - } - - /* If a parent is in a group make it focused. - * `LV_EVENT_FOCUSED/DEFOCUSED` will be sent by `lv_group_focus_obj`*/ - if(g && parent) { - if(lv_group_get_click_focus(g)) { - click_focus_sent = true; - lv_group_focus_obj(parent); - } - } - } -#endif - - /* Send defocus to the lastly "active" object and foucus to the new one. - * DO not sent the events if they was sent by the click focus*/ - if(proc->types.pointer.last_pressed != indev_obj_act && click_focus_sent == false) { - lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL); - if(indev_reset_check(proc)) return; - - lv_event_send(proc->types.pointer.act_obj, LV_EVENT_FOCUSED, NULL); - if(indev_reset_check(proc)) return; - - proc->types.pointer.last_pressed = indev_obj_act; - } - - if(indev_reset_check(proc)) return; - /*Send LV_EVENT_DRAG_THROW_BEGIN if required */ /*If drag parent is active check recursively the drag_parent attribute*/ - lv_obj_t * drag_obj = indev_obj_act; - while(lv_obj_get_drag_parent(drag_obj) != false && drag_obj != NULL) { - drag_obj = lv_obj_get_parent(drag_obj); - } - + lv_obj_t * drag_obj = get_dragged_obj(indev_obj_act); if(drag_obj) { if(lv_obj_get_drag_throw(drag_obj) && proc->types.pointer.drag_in_prog) { + if(drag_obj->signal_cb) drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_THROW_BEGIN, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(drag_obj, LV_EVENT_DRAG_THROW_BEGIN, NULL); if(indev_reset_check(proc)) return; } @@ -975,7 +1122,6 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev) if(indev->proc.reset_query) { indev->proc.types.pointer.act_obj = NULL; indev->proc.types.pointer.last_obj = NULL; - indev->proc.types.pointer.last_pressed = NULL; indev->proc.types.pointer.drag_limit_out = 0; indev->proc.types.pointer.drag_in_prog = 0; indev->proc.long_pr_sent = 0; @@ -983,47 +1129,31 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev) indev->proc.longpr_rep_timestamp = 0; indev->proc.types.pointer.drag_sum.x = 0; indev->proc.types.pointer.drag_sum.y = 0; + indev->proc.types.pointer.drag_dir = LV_DRAG_DIR_BOTH; indev->proc.types.pointer.drag_throw_vect.x = 0; indev->proc.types.pointer.drag_throw_vect.y = 0; + indev->proc.types.pointer.gesture_sum.x = 0; + indev->proc.types.pointer.gesture_sum.y = 0; indev->proc.reset_query = 0; indev_obj_act = NULL; } } /** - * Search the most top, clickable object on the last point of an input device - * @param proc pointer to the `lv_indev_proc_t` part of the input device + * Search the most top, clickable object by a point * @param obj pointer to a start object, typically the screen + * @param point pointer to a point for searching the most top child * @return pointer to the found object or NULL if there was no suitable object */ -static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj) +lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point) { lv_obj_t * found_p = NULL; /*If the point is on this object check its children too*/ -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY - lv_area_t ext_area; - ext_area.x1 = obj->coords.x1 - obj->ext_click_pad_hor; - ext_area.x2 = obj->coords.x2 + obj->ext_click_pad_hor; - ext_area.y1 = obj->coords.y1 - obj->ext_click_pad_ver; - ext_area.y2 = obj->coords.y2 + obj->ext_click_pad_ver; - - if(lv_area_is_point_on(&ext_area, &proc->types.pointer.act_point)) { -#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL - lv_area_t ext_area; - ext_area.x1 = obj->coords.x1 - obj->ext_click_pad.x1; - ext_area.x2 = obj->coords.x2 + obj->ext_click_pad.x2; - ext_area.y1 = obj->coords.y1 - obj->ext_click_pad.y1; - ext_area.y2 = obj->coords.y2 + obj->ext_click_pad.y2; - - if(lv_area_is_point_on(&ext_area, &proc->types.pointer.act_point)) { -#else - if(lv_area_is_point_on(&obj->coords, &proc->types.pointer.act_point)) { -#endif + if(lv_obj_hittest(obj, point)) { lv_obj_t * i; - LV_LL_READ(obj->child_ll, i) - { - found_p = indev_search_obj(proc, i); + _LV_LL_READ(obj->child_ll, i) { + found_p = lv_indev_search_obj(i, point); /*If a child was found then break*/ if(found_p != NULL) { @@ -1040,27 +1170,122 @@ static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj) hidden_i = lv_obj_get_parent(hidden_i); } /*No parent found with hidden == true*/ - if(hidden_i == NULL) found_p = obj; + if(lv_obj_is_protected(obj, LV_PROTECT_EVENT_TO_DISABLED) == false) { + if(hidden_i == NULL && (lv_obj_get_state(obj, LV_OBJ_PART_MAIN) & LV_STATE_DISABLED) == false) found_p = obj; + } + else { + if(hidden_i == NULL) found_p = obj; + } } } return found_p; } +/** + * Handle focus/defocus on click for POINTER input devices + * @param proc pointer to the state of the indev + */ +static void indev_click_focus(lv_indev_proc_t * proc) +{ + /*Handle click focus*/ + lv_obj_t * obj_to_focus = lv_obj_get_focused_obj(indev_obj_act); + if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false && + proc->types.pointer.last_pressed != obj_to_focus) { +#if LV_USE_GROUP + lv_group_t * g_act = lv_obj_get_group(obj_to_focus); + lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL; + + /*If both the last and act. obj. are in the same group (or no group but it's also the same) */ + if(g_act == g_prev) { + /*The objects are in a group*/ + if(g_act) { + lv_group_focus_obj(obj_to_focus); + if(indev_reset_check(proc)) return; + } + /*The object are not in group*/ + else { + if(proc->types.pointer.last_pressed) { + lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL); + if(indev_reset_check(proc)) return; + } + + lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL); + if(indev_reset_check(proc)) return; + } + } + /*The object are not in the same group (in different group or one in not a group)*/ + else { + /*If the prev. obj. is not in a group then defocus it.*/ + if(g_prev == NULL && proc->types.pointer.last_pressed) { + lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL); + if(indev_reset_check(proc)) return; + } + /*Focus on a non-group object*/ + else { + if(proc->types.pointer.last_pressed) { + /*If the prev. object also wasn't in a group defocus it*/ + if(g_prev == NULL) { + lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL); + if(indev_reset_check(proc)) return; + } + /*If the prev. object also was in a group at least "LEAVE" it instead of defocus*/ + else { + lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_LEAVE, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_LEAVE, NULL); + if(indev_reset_check(proc)) return; + } + } + } + + /*Focus to the act. in its group*/ + if(g_act) { + lv_group_focus_obj(obj_to_focus); + if(indev_reset_check(proc)) return; + } + else { + lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL); + if(indev_reset_check(proc)) return; + } + } +#else + if(proc->types.pointer.last_pressed) { + lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(proc->types.pointer.last_pressed, LV_EVENT_DEFOCUSED, NULL); + if(indev_reset_check(proc)) return; + } + + lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL); + if(indev_reset_check(proc)) return; + lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL); + if(indev_reset_check(proc)) return; +#endif + proc->types.pointer.last_pressed = obj_to_focus; + } + +} + /** * Handle the dragging of indev_proc_p->types.pointer.act_obj * @param indev pointer to a input device state */ -static void indev_drag(lv_indev_proc_t * state) +static void indev_drag(lv_indev_proc_t * proc) { - lv_obj_t * drag_obj = state->types.pointer.act_obj; + lv_obj_t * drag_obj = get_dragged_obj(proc->types.pointer.act_obj); bool drag_just_started = false; - /*If drag parent is active check recursively the drag_parent attribute*/ - while(lv_obj_get_drag_parent(drag_obj) != false && drag_obj != NULL) { - drag_obj = lv_obj_get_parent(drag_obj); - } - if(drag_obj == NULL) return; if(lv_obj_get_drag(drag_obj) == false) return; @@ -1068,28 +1293,42 @@ static void indev_drag(lv_indev_proc_t * state) lv_drag_dir_t allowed_dirs = lv_obj_get_drag_dir(drag_obj); /*Count the movement by drag*/ - state->types.pointer.drag_sum.x += state->types.pointer.vect.x; - state->types.pointer.drag_sum.y += state->types.pointer.vect.y; + if(proc->types.pointer.drag_limit_out == 0) { + proc->types.pointer.drag_sum.x += proc->types.pointer.vect.x; + proc->types.pointer.drag_sum.y += proc->types.pointer.vect.y; + + /*Enough move?*/ + bool hor_en = false; + bool ver_en = false; + if(allowed_dirs == LV_DRAG_DIR_HOR || allowed_dirs == LV_DRAG_DIR_BOTH) { + hor_en = true; + } + + if(allowed_dirs == LV_DRAG_DIR_VER || allowed_dirs == LV_DRAG_DIR_BOTH) { + ver_en = true; + } + + if(allowed_dirs == LV_DRAG_DIR_ONE) { + if(LV_MATH_ABS(proc->types.pointer.drag_sum.x) > LV_MATH_ABS(proc->types.pointer.drag_sum.y)) { + hor_en = true; + } + else { + ver_en = true; + } + } - /*Enough move?*/ - if(state->types.pointer.drag_limit_out == 0) { /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ - if(((allowed_dirs & LV_DRAG_DIR_HOR) && - LV_MATH_ABS(state->types.pointer.drag_sum.x) >= indev_act->driver.drag_limit) || - ((allowed_dirs & LV_DRAG_DIR_VER) && - LV_MATH_ABS(state->types.pointer.drag_sum.y) >= indev_act->driver.drag_limit)) { - state->types.pointer.drag_limit_out = 1; + if((hor_en && LV_MATH_ABS(proc->types.pointer.drag_sum.x) >= indev_act->driver.drag_limit) || + (ver_en && LV_MATH_ABS(proc->types.pointer.drag_sum.y) >= indev_act->driver.drag_limit)) { + proc->types.pointer.drag_limit_out = 1; drag_just_started = true; } } /*If the drag limit is exceeded handle the dragging*/ - if(state->types.pointer.drag_limit_out != 0) { + if(proc->types.pointer.drag_limit_out != 0) { /*Set new position if the vector is not zero*/ - if(state->types.pointer.vect.x != 0 || state->types.pointer.vect.y != 0) { - - uint16_t inv_buf_size = - lv_disp_get_inv_buf_size(indev_act->driver.disp); /*Get the number of currently invalidated areas*/ + if(proc->types.pointer.vect.x != 0 || proc->types.pointer.vect.y != 0) { lv_coord_t prev_x = drag_obj->coords.x1; lv_coord_t prev_y = drag_obj->coords.y1; @@ -1100,27 +1339,64 @@ static void indev_drag(lv_indev_proc_t * state) lv_coord_t act_x = lv_obj_get_x(drag_obj); lv_coord_t act_y = lv_obj_get_y(drag_obj); - if(allowed_dirs == LV_DRAG_DIR_ALL) { + if(allowed_dirs == LV_DRAG_DIR_BOTH) { if(drag_just_started) { - act_x += state->types.pointer.drag_sum.x; - act_y += state->types.pointer.drag_sum.y; + proc->types.pointer.drag_dir = LV_DRAG_DIR_BOTH; + act_x += proc->types.pointer.drag_sum.x; + act_y += proc->types.pointer.drag_sum.y; } - lv_obj_set_pos(drag_obj, act_x + state->types.pointer.vect.x, act_y + state->types.pointer.vect.y); - } else if(allowed_dirs & LV_DRAG_DIR_HOR) { + } + else if(allowed_dirs == LV_DRAG_DIR_HOR) { + if(drag_just_started) { + proc->types.pointer.drag_dir = LV_DRAG_DIR_HOR; + proc->types.pointer.drag_sum.y = 0; + act_x += proc->types.pointer.drag_sum.x; + } + } + else if(allowed_dirs == LV_DRAG_DIR_VER) { if(drag_just_started) { - act_x += state->types.pointer.drag_sum.x; + proc->types.pointer.drag_dir = LV_DRAG_DIR_VER; + proc->types.pointer.drag_sum.x = 0; + act_y += proc->types.pointer.drag_sum.y; } - lv_obj_set_x(drag_obj, act_x + state->types.pointer.vect.x); - } else if(allowed_dirs & LV_DRAG_DIR_VER) { + } + else if(allowed_dirs == LV_DRAG_DIR_ONE) { if(drag_just_started) { - act_y += state->types.pointer.drag_sum.y; + if(LV_MATH_ABS(proc->types.pointer.drag_sum.x) > LV_MATH_ABS(proc->types.pointer.drag_sum.y)) { + proc->types.pointer.drag_dir = LV_DRAG_DIR_HOR; + proc->types.pointer.drag_sum.y = 0; + act_x += proc->types.pointer.drag_sum.x; + } + else { + proc->types.pointer.drag_dir = LV_DRAG_DIR_VER; + proc->types.pointer.drag_sum.x = 0; + act_y += proc->types.pointer.drag_sum.y; + } } - lv_obj_set_y(drag_obj, act_y + state->types.pointer.vect.y); } + /*Move the object*/ + if(allowed_dirs == LV_DRAG_DIR_HOR || + allowed_dirs == LV_DRAG_DIR_BOTH || + (allowed_dirs == LV_DRAG_DIR_ONE && + LV_MATH_ABS(proc->types.pointer.drag_sum.x) > LV_MATH_ABS(proc->types.pointer.drag_sum.y))) { + act_x += proc->types.pointer.vect.x; + } + if(allowed_dirs == LV_DRAG_DIR_VER || + allowed_dirs == LV_DRAG_DIR_BOTH || + (allowed_dirs == LV_DRAG_DIR_ONE && + LV_MATH_ABS(proc->types.pointer.drag_sum.x) < LV_MATH_ABS(proc->types.pointer.drag_sum.y))) { + act_y += proc->types.pointer.vect.y; + } + + uint16_t inv_buf_size = + lv_disp_get_inv_buf_size(indev_act->driver.disp); /*Get the number of currently invalidated areas*/ + + lv_obj_set_pos(drag_obj, act_x, act_y); + proc->types.pointer.drag_in_prog = 1; + /*If the object didn't moved then clear the invalidated areas*/ if(drag_obj->coords.x1 == prev_x && drag_obj->coords.y1 == prev_y) { -// state->types.pointer.drag_in_prog = 0; /*In a special case if the object is moved on a page and * the scrollable has fit == true and the object is dragged of the page then * while its coordinate is not changing only the parent's size is reduced */ @@ -1128,19 +1404,20 @@ static void indev_drag(lv_indev_proc_t * state) lv_coord_t act_par_h = lv_obj_get_height(lv_obj_get_parent(drag_obj)); if(act_par_w == prev_par_w && act_par_h == prev_par_h) { uint16_t new_inv_buf_size = lv_disp_get_inv_buf_size(indev_act->driver.disp); - lv_disp_pop_from_inv_buf(indev_act->driver.disp, new_inv_buf_size - inv_buf_size); - } - } else { - state->types.pointer.drag_in_prog = 1; - /*Set the drag in progress flag*/ - /*Send the drag begin signal on first move*/ - if(drag_just_started) { - drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act); - if(indev_reset_check(state)) return; - lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL); - if(indev_reset_check(state)) return; + _lv_disp_pop_from_inv_buf(indev_act->driver.disp, new_inv_buf_size - inv_buf_size); } } + + /*Set the drag in progress flag*/ + /*Send the drag begin signal on first move*/ + if(drag_just_started) { + drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act); + if(indev_reset_check(proc)) return; + + lv_event_send(drag_obj, LV_EVENT_DRAG_BEGIN, NULL); + if(indev_reset_check(proc)) return; + } + } } } @@ -1153,22 +1430,14 @@ static void indev_drag_throw(lv_indev_proc_t * proc) { if(proc->types.pointer.drag_in_prog == 0) return; - lv_obj_t * drag_obj = proc->types.pointer.last_obj; + lv_obj_t * drag_obj = get_dragged_obj(proc->types.pointer.last_obj); - /*If drag parent is active check recursively the drag_parent attribute*/ - while(lv_obj_get_drag_parent(drag_obj) != false && drag_obj != NULL) { - drag_obj = lv_obj_get_parent(drag_obj); - } - - if(drag_obj == NULL) { - return; - } + if(drag_obj == NULL) return; /*Return if the drag throw is not enabled*/ if(lv_obj_get_drag_throw(drag_obj) == false) { proc->types.pointer.drag_in_prog = 0; drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act); - lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); if(indev_reset_check(proc)) return; lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); @@ -1190,13 +1459,13 @@ static void indev_drag_throw(lv_indev_proc_t * proc) lv_coord_t act_x = lv_obj_get_x(drag_obj) + proc->types.pointer.drag_throw_vect.x; lv_coord_t act_y = lv_obj_get_y(drag_obj) + proc->types.pointer.drag_throw_vect.y; - if(allowed_dirs == LV_DRAG_DIR_ALL) - lv_obj_set_pos(drag_obj, act_x, act_y); - else if(allowed_dirs & LV_DRAG_DIR_HOR) - lv_obj_set_x(drag_obj, act_x); - else if(allowed_dirs & LV_DRAG_DIR_VER) - lv_obj_set_y(drag_obj, act_y); - + if(allowed_dirs == LV_DRAG_DIR_BOTH) lv_obj_set_pos(drag_obj, act_x, act_y); + else if(allowed_dirs == LV_DRAG_DIR_HOR) lv_obj_set_x(drag_obj, act_x); + else if(allowed_dirs == LV_DRAG_DIR_VER) lv_obj_set_y(drag_obj, act_y); + else if(allowed_dirs == LV_DRAG_DIR_ONE) { + if(proc->types.pointer.drag_sum.x) lv_obj_set_x(drag_obj, act_x); + else lv_obj_set_y(drag_obj, act_y); + } lv_area_t coord_new; lv_obj_get_coords(drag_obj, &coord_new); @@ -1210,6 +1479,7 @@ static void indev_drag_throw(lv_indev_proc_t * proc) proc->types.pointer.drag_throw_vect.y = 0; drag_obj->signal_cb(drag_obj, LV_SIGNAL_DRAG_END, indev_act); if(indev_reset_check(proc)) return; + lv_event_send(drag_obj, LV_EVENT_DRAG_END, NULL); if(indev_reset_check(proc)) return; } @@ -1225,10 +1495,79 @@ static void indev_drag_throw(lv_indev_proc_t * proc) } } +/** + * Get the really dragged object by taking `drag_parent` into account. + * @param obj the start object + * @return the object to really drag + */ +static lv_obj_t * get_dragged_obj(lv_obj_t * obj) +{ + if(obj == NULL) return NULL; + lv_obj_t * drag_obj = obj; + while(lv_obj_get_drag_parent(drag_obj) != false && drag_obj != NULL) { + drag_obj = lv_obj_get_parent(drag_obj); + } + + return drag_obj; +} + +/** +* Handle the gesture of indev_proc_p->types.pointer.act_obj +* @param indev pointer to a input device state +*/ +static void indev_gesture(lv_indev_proc_t * proc) +{ + + if(proc->types.pointer.gesture_sent) return; + + lv_obj_t * gesture_obj = proc->types.pointer.act_obj; + + /*If gesture parent is active check recursively the gesture attribute*/ + while(gesture_obj && lv_obj_get_gesture_parent(gesture_obj)) { + gesture_obj = lv_obj_get_parent(gesture_obj); + } + + if(gesture_obj == NULL) return; + + if((LV_MATH_ABS(proc->types.pointer.vect.x) < indev_act->driver.gesture_min_velocity) && + (LV_MATH_ABS(proc->types.pointer.vect.y) < indev_act->driver.gesture_min_velocity)) { + proc->types.pointer.gesture_sum.x = 0; + proc->types.pointer.gesture_sum.y = 0; + } + + /*Count the movement by gesture*/ + proc->types.pointer.gesture_sum.x += proc->types.pointer.vect.x; + proc->types.pointer.gesture_sum.y += proc->types.pointer.vect.y; + + if((LV_MATH_ABS(proc->types.pointer.gesture_sum.x) > indev_act->driver.gesture_limit) || + (LV_MATH_ABS(proc->types.pointer.gesture_sum.y) > indev_act->driver.gesture_limit)) { + + proc->types.pointer.gesture_sent = 1; + + if(LV_MATH_ABS(proc->types.pointer.gesture_sum.x) > LV_MATH_ABS(proc->types.pointer.gesture_sum.y)) { + if(proc->types.pointer.gesture_sum.x > 0) + proc->types.pointer.gesture_dir = LV_GESTURE_DIR_RIGHT; + else + proc->types.pointer.gesture_dir = LV_GESTURE_DIR_LEFT; + } + else { + if(proc->types.pointer.gesture_sum.y > 0) + proc->types.pointer.gesture_dir = LV_GESTURE_DIR_BOTTOM; + else + proc->types.pointer.gesture_dir = LV_GESTURE_DIR_TOP; + } + + gesture_obj->signal_cb(gesture_obj, LV_SIGNAL_GESTURE, indev_act); + if(indev_reset_check(proc)) return; + lv_event_send(gesture_obj, LV_EVENT_GESTURE, NULL); + if(indev_reset_check(proc)) return; + } +} + /** * Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions * @param proc pointer to an input device 'proc' - * return true if indev query should be immediately truncated. + * @return true if indev query should be immediately truncated. */ static bool indev_reset_check(lv_indev_proc_t * proc) { diff --git a/src/libs/lvgl/src/lv_core/lv_indev.h b/src/libs/lvgl/src/lv_core/lv_indev.h index 69ab5a41..15f0f89c 100644 --- a/src/libs/lvgl/src/lv_core/lv_indev.h +++ b/src/libs/lvgl/src/lv_core/lv_indev.h @@ -32,13 +32,13 @@ extern "C" { /** * Initialize the display input device subsystem */ -void lv_indev_init(void); +void _lv_indev_init(void); /** * Called periodically to read the input devices * @param task pointer to the task itself */ -void lv_indev_read_task(lv_task_t * task); +void _lv_indev_read_task(lv_task_t * task); /** * Get the currently processed input device. Can be used in action functions too. @@ -57,8 +57,9 @@ lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev); /** * Reset one or all input devices * @param indev pointer to an input device to reset or NULL to reset all of them + * @param obj pointer to an object which triggers the reset. */ -void lv_indev_reset(lv_indev_t * indev); +void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj); /** * Reset the long press state of an input device @@ -95,7 +96,7 @@ void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group); * @param indev pointer to an input device * @param group point to a group */ -void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points); +void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]); /** * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON) @@ -104,6 +105,13 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points); */ void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); +/** +* Get the current gesture direct +* @param indev pointer to an input device +* @return current gesture direct +*/ +lv_gesture_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev); + /** * Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD) * @param indev pointer to an input device @@ -128,18 +136,18 @@ bool lv_indev_is_dragging(const lv_indev_t * indev); void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point); /** - * Do nothing until the next release + * Manually finish dragging. + * `LV_SIGNAL_DRAG_END` and `LV_EVENT_DRAG_END` will be sent. * @param indev pointer to an input device + * @return `LV_RES_INV` if the object being dragged was deleted. Else `LV_RES_OK`. */ -void lv_indev_wait_release(lv_indev_t * indev); +lv_res_t lv_indev_finish_drag(lv_indev_t * indev); /** - * Get a pointer to the indev read task to - * modify its parameters with `lv_task_...` functions. - * @param indev pointer to an inout device - * @return pointer to the indev read refresher task. (NULL on error) + * Do nothing until the next release + * @param indev pointer to an input device */ -lv_task_t * lv_indev_get_read_task(lv_disp_t * indev); +void lv_indev_wait_release(lv_indev_t * indev); /** * Gets a pointer to the currently active object in indev proc functions. @@ -148,6 +156,22 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev); */ lv_obj_t * lv_indev_get_obj_act(void); +/** + * Search the most top, clickable object by a point + * @param obj pointer to a start object, typically the screen + * @param point pointer to a point for searching the most top child + * @return pointer to the found object or NULL if there was no suitable object + */ +lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point); + +/** + * Get a pointer to the indev read task to + * modify its parameters with `lv_task_...` functions. + * @param indev pointer to an inout device + * @return pointer to the indev read refresher task. (NULL on error) + */ +lv_task_t * lv_indev_get_read_task(lv_disp_t * indev); + /********************** * MACROS **********************/ diff --git a/src/libs/lvgl/src/lv_core/lv_obj.c b/src/libs/lvgl/src/lv_core/lv_obj.c index 511e72db..556bd006 100644 --- a/src/libs/lvgl/src/lv_core/lv_obj.c +++ b/src/libs/lvgl/src/lv_core/lv_obj.c @@ -1,5 +1,5 @@ /** - * @file lv_base_obj.c + * @file lv_obj.c * */ @@ -11,52 +11,137 @@ #include "lv_refr.h" #include "lv_group.h" #include "lv_disp.h" -#include "../lv_core/lv_debug.h" +#include "../lv_misc/lv_debug.h" #include "../lv_themes/lv_theme.h" #include "../lv_draw/lv_draw.h" #include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_task.h" #include "../lv_misc/lv_async.h" #include "../lv_misc/lv_fs.h" +#include "../lv_misc/lv_gc.h" +#include "../lv_misc/lv_math.h" +#include "../lv_misc/lv_log.h" #include "../lv_hal/lv_hal.h" #include #include -#include "../lv_misc/lv_gc.h" -#include "../lv_misc/lv_math.h" -#if defined(LV_GC_INCLUDE) -#include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ +#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT + #include "../lv_gpu/lv_gpu_nxp_pxp.h" + #include "../lv_gpu/lv_gpu_nxp_pxp_osa.h" +#endif + +#if defined(LV_USER_DATA_FREE_INCLUDE) + #include LV_USER_DATA_FREE_INCLUDE +#endif /* LV_USE_USER_DATA_FREE */ + +#include LV_THEME_DEFAULT_INCLUDE + +#if LV_USE_GPU_STM32_DMA2D + #include "../lv_gpu/lv_gpu_stm32_dma2d.h" +#endif /********************* * DEFINES *********************/ #define LV_OBJX_NAME "lv_obj" -#define LV_OBJ_DEF_WIDTH (LV_DPI) -#define LV_OBJ_DEF_HEIGHT (2 * LV_DPI / 3) +#define LV_OBJ_DEF_WIDTH (LV_DPX(100)) +#define LV_OBJ_DEF_HEIGHT (LV_DPX(50)) /********************** * TYPEDEFS **********************/ -typedef struct _lv_event_temp_data -{ +typedef struct _lv_event_temp_data { lv_obj_t * obj; bool deleted; struct _lv_event_temp_data * prev; } lv_event_temp_data_t; +typedef struct { + lv_obj_t * obj; + lv_style_property_t prop; + uint8_t part; + union { + lv_color_t _color; + lv_style_int_t _int; + lv_opa_t _opa; + const void * _ptr; + } start_value; + union { + lv_color_t _color; + lv_style_int_t _int; + lv_opa_t _opa; + const void * _ptr; + } end_value; +} lv_style_trans_t; + +typedef struct { + lv_draw_rect_dsc_t rect; + lv_draw_label_dsc_t label; + lv_draw_line_dsc_t line; + lv_draw_img_dsc_t img; + lv_style_int_t pad_top; + lv_style_int_t pad_bottom; + lv_style_int_t pad_right; + lv_style_int_t pad_left; + lv_style_int_t pad_inner; + lv_style_int_t margin_top; + lv_style_int_t margin_bottom; + lv_style_int_t margin_left; + lv_style_int_t margin_right; + lv_style_int_t size; + lv_style_int_t transform_width; + lv_style_int_t transform_height; + lv_style_int_t transform_angle; + lv_style_int_t transform_zoom; + lv_style_int_t scale_width; + lv_style_int_t scale_border_width; + lv_style_int_t scale_end_border_width; + lv_style_int_t scale_end_line_width; + lv_color_t scale_grad_color; + lv_color_t scale_end_color; + lv_opa_t opa_scale; + uint32_t clip_corner : 1; + uint32_t border_post : 1; +} style_snapshot_t; + +typedef enum { + STYLE_COMPARE_SAME, + STYLE_COMPARE_VISUAL_DIFF, + STYLE_COMPARE_DIFF, +} style_snapshot_res_t; + /********************** * STATIC PROTOTYPES **********************/ +static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode); +static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param); static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff); static void report_style_mod_core(void * style_p, lv_obj_t * obj); static void refresh_children_style(lv_obj_t * obj); -static void delete_children(lv_obj_t * obj); static void base_dir_refr_children(lv_obj_t * obj); +static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, + lv_coord_t x_ofs, lv_coord_t y_ofs); +static void obj_align_mid_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, + lv_coord_t x_ofs, lv_coord_t y_ofs); +#if LV_USE_ANIMATION +static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state, + lv_state_t new_state); +static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_trans_t * tr_limit); +static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v); +static void trans_anim_start_cb(lv_anim_t * a); +static void trans_anim_ready_cb(lv_anim_t * a); +static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v); +static void fade_in_anim_ready(lv_anim_t * a); +#endif static void lv_event_mark_deleted(lv_obj_t * obj); +static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find); static void lv_obj_del_async_cb(void * obj); -static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode); -static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param); +static void obj_del_core(lv_obj_t * obj); +static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop); +static void update_style_cache_children(lv_obj_t * obj); +static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_property_t prop); +static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot); +static style_snapshot_res_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2); /********************** * STATIC VARIABLES @@ -87,51 +172,84 @@ void lv_init(void) LV_LOG_TRACE("lv_init started"); /*Initialize the lv_misc modules*/ - lv_mem_init(); - lv_task_core_init(); + _lv_mem_init(); + _lv_task_core_init(); #if LV_USE_FILESYSTEM - lv_fs_init(); + _lv_fs_init(); #endif #if LV_USE_ANIMATION - lv_anim_core_init(); + _lv_anim_core_init(); #endif #if LV_USE_GROUP - lv_group_init(); + _lv_group_init(); #endif - /*Init. the sstyles*/ - lv_style_init(); +#if LV_USE_GPU_STM32_DMA2D + /*Initialize DMA2D GPU*/ + lv_gpu_stm32_dma2d_init(); +#endif - /*Initialize the screen refresh system*/ - lv_refr_init(); +#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT + if(lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) { + LV_LOG_ERROR("PXP init error. STOP.\n"); + for(; ;) ; + } +#endif - lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t)); - lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t)); + _lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(lv_style_trans_t)); + + _lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t)); + _lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t)); + + lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY, + LV_THEME_DEFAULT_FLAG, + LV_THEME_DEFAULT_FONT_SMALL, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE, LV_THEME_DEFAULT_FONT_TITLE); + lv_theme_set_act(th); + + /*Initialize the screen refresh system*/ + _lv_refr_init(); /*Init the input device handling*/ - lv_indev_init(); + _lv_indev_init(); - lv_img_decoder_init(); + _lv_img_decoder_init(); +#if LV_IMG_CACHE_DEF_SIZE lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE); +#endif + /*Test if the IDE has UTF-8 encoding*/ + char * txt = "Á"; + + uint8_t * txt_u8 = (uint8_t *) txt; + if(txt_u8[0] != 0xc3 || txt_u8[1] != 0x81 || txt_u8[2] != 0x00) { + LV_LOG_WARN("The strings has no UTF-8 encoding. Some characters won't be displayed.") + } lv_initialized = true; LV_LOG_INFO("lv_init ready"); } #if LV_ENABLE_GC || !LV_MEM_CUSTOM + +/** + * Deinit the 'lv' library + * Currently only implemented when not using custom allocators, or GC is enabled. + */ void lv_deinit(void) { - lv_gc_clear_roots(); -#if LV_USE_LOG - lv_log_register_print_cb(NULL); -#endif + _lv_gc_clear_roots(); + lv_disp_set_default(NULL); - lv_mem_deinit(); + _lv_mem_deinit(); lv_initialized = false; + LV_LOG_INFO("lv_deinit done"); + +#if LV_USE_LOG + lv_log_register_print_cb(NULL); +#endif } #endif @@ -148,9 +266,9 @@ void lv_deinit(void) */ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) { - lv_obj_t * new_obj = NULL; - /*Create a screen if the parent is NULL*/ + + /*Create a screen*/ if(parent == NULL) { LV_LOG_TRACE("Screen create started"); lv_disp_t * disp = lv_disp_get_default(); @@ -159,12 +277,17 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) return NULL; } - new_obj = lv_ll_ins_head(&disp->scr_ll); + new_obj = _lv_ll_ins_head(&disp->scr_ll); LV_ASSERT_MEM(new_obj); if(new_obj == NULL) return NULL; - new_obj->par = NULL; /*screens has no a parent*/ - lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t)); + _lv_memset_00(new_obj, sizeof(lv_obj_t)); + +#if LV_USE_BIDI + new_obj->base_dir = LV_BIDI_BASE_DIR_DEF; +#else + new_obj->base_dir = LV_BIDI_DIR_LTR; +#endif /*Set the callbacks*/ new_obj->signal_cb = lv_obj_signal; @@ -176,81 +299,19 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) new_obj->coords.y1 = 0; new_obj->coords.x2 = lv_disp_get_hor_res(NULL) - 1; new_obj->coords.y2 = lv_disp_get_ver_res(NULL) - 1; - new_obj->ext_draw_pad = 0; - -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL - memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad)); -#endif - -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY - new_obj->ext_click_pad_hor = 0; - new_obj->ext_click_pad_ver = 0; -#endif - - /*Init realign*/ -#if LV_USE_OBJ_REALIGN - new_obj->realign.align = LV_ALIGN_CENTER; - new_obj->realign.xofs = 0; - new_obj->realign.yofs = 0; - new_obj->realign.base = NULL; - new_obj->realign.auto_realign = 0; -#endif - - /*Set the default styles*/ - lv_theme_t * th = lv_theme_get_current(); - if(th) { - new_obj->style_p = th->style.scr; - } else { - new_obj->style_p = &lv_style_scr; - } - - /*Init. user date*/ -#if LV_USE_USER_DATA - memset(&new_obj->user_data, 0, sizeof(lv_obj_user_data_t)); -#endif - -#if LV_USE_GROUP - new_obj->group_p = NULL; -#endif - /*Set attributes*/ - new_obj->click = 0; - new_obj->drag = 0; - new_obj->drag_throw = 0; - new_obj->drag_parent = 0; - new_obj->hidden = 0; - new_obj->top = 0; - new_obj->protect = LV_PROTECT_NONE; - new_obj->opa_scale_en = 0; - new_obj->opa_scale = LV_OPA_COVER; - new_obj->parent_event = 0; -#if LV_USE_BIDI - new_obj->base_dir = LV_BIDI_BASE_DIR_DEF; -#else - new_obj->base_dir = LV_BIDI_DIR_LTR; -#endif - - new_obj->reserved = 0; - - new_obj->ext_attr = NULL; - - LV_LOG_INFO("Screen create ready"); } - /*parent != NULL create normal obj. on a parent*/ + /*Create a normal object*/ else { LV_LOG_TRACE("Object create started"); LV_ASSERT_OBJ(parent, LV_OBJX_NAME); - new_obj = lv_ll_ins_head(&parent->child_ll); + new_obj = _lv_ll_ins_head(&parent->child_ll); LV_ASSERT_MEM(new_obj); if(new_obj == NULL) return NULL; - new_obj->par = parent; /*Set the parent*/ - lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t)); + _lv_memset_00(new_obj, sizeof(lv_obj_t)); - /*Set the callbacks*/ - new_obj->signal_cb = lv_obj_signal; - new_obj->design_cb = lv_obj_design; - new_obj->event_cb = NULL; + new_obj->parent = parent; #if LV_USE_BIDI new_obj->base_dir = LV_BIDI_DIR_INHERIT; @@ -258,97 +319,96 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) new_obj->base_dir = LV_BIDI_DIR_LTR; #endif - /*Set coordinates left top corner of parent*/ + /*Set the callbacks (signal:cb is required in `lv_obj_get_base_dir` if `LV_USE_ASSERT_OBJ` is enabled)*/ + new_obj->signal_cb = lv_obj_signal; + new_obj->design_cb = lv_obj_design; + new_obj->event_cb = NULL; + new_obj->coords.y1 = parent->coords.y1; new_obj->coords.y2 = parent->coords.y1 + LV_OBJ_DEF_HEIGHT; if(lv_obj_get_base_dir(new_obj) == LV_BIDI_DIR_RTL) { new_obj->coords.x2 = parent->coords.x2; new_obj->coords.x1 = parent->coords.x2 - LV_OBJ_DEF_WIDTH; - } else { + } + else { new_obj->coords.x1 = parent->coords.x1; new_obj->coords.x2 = parent->coords.x1 + LV_OBJ_DEF_WIDTH; } - new_obj->ext_draw_pad = 0; - -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL - memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad)); -#endif + } -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY - new_obj->ext_click_pad_hor = 0; - new_obj->ext_click_pad_ver = 0; -#endif + _lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t)); - /*Init realign*/ -#if LV_USE_OBJ_REALIGN - new_obj->realign.align = LV_ALIGN_CENTER; - new_obj->realign.xofs = 0; - new_obj->realign.yofs = 0; - new_obj->realign.base = NULL; - new_obj->realign.auto_realign = 0; -#endif - /*Set appearance*/ - lv_theme_t * th = lv_theme_get_current(); - if(th) { - new_obj->style_p = th->style.panel; - } else { - new_obj->style_p = &lv_style_plain_color; - } + new_obj->ext_draw_pad = 0; #if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL - memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad)); + _lv_memset_00(&new_obj->ext_click_pad, sizeof(new_obj->ext_click_pad)); +#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + new_obj->ext_click_pad_hor = 0; + new_obj->ext_click_pad_ver = 0; #endif -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY - new_obj->ext_click_pad_hor = 0; - new_obj->ext_click_pad_ver = 0; + /*Init realign*/ +#if LV_USE_OBJ_REALIGN + new_obj->realign.align = LV_ALIGN_CENTER; + new_obj->realign.xofs = 0; + new_obj->realign.yofs = 0; + new_obj->realign.base = NULL; + new_obj->realign.auto_realign = 0; #endif - /*Init. user date*/ + /*Init. user date*/ #if LV_USE_USER_DATA - memset(&new_obj->user_data, 0, sizeof(lv_obj_user_data_t)); + _lv_memset_00(&new_obj->user_data, sizeof(lv_obj_user_data_t)); #endif #if LV_USE_GROUP - new_obj->group_p = NULL; + new_obj->group_p = NULL; #endif - /*Set attributes*/ - new_obj->click = 1; - new_obj->drag = 0; - new_obj->drag_dir = LV_DRAG_DIR_ALL; - new_obj->drag_throw = 0; - new_obj->drag_parent = 0; - new_obj->hidden = 0; - new_obj->top = 0; - new_obj->protect = LV_PROTECT_NONE; - new_obj->opa_scale = LV_OPA_COVER; - new_obj->opa_scale_en = 0; - new_obj->parent_event = 0; - new_obj->reserved = 0; - - new_obj->ext_attr = NULL; + /*Set attributes*/ + new_obj->adv_hittest = 0; + new_obj->click = 1; + new_obj->drag = 0; + new_obj->drag_throw = 0; + new_obj->drag_parent = 0; + new_obj->drag_dir = LV_DRAG_DIR_BOTH; + new_obj->hidden = 0; + new_obj->top = 0; + new_obj->protect = LV_PROTECT_NONE; + new_obj->parent_event = 0; + new_obj->gesture_parent = parent ? 1 : 0; + new_obj->focus_parent = 0; + new_obj->state = LV_STATE_DEFAULT; + + new_obj->ext_attr = NULL; + + lv_style_list_init(&new_obj->style_list); + if(copy == NULL) { + if(parent != NULL) lv_theme_apply(new_obj, LV_THEME_OBJ); + else lv_theme_apply(new_obj, LV_THEME_SCR); + } + else { + lv_style_list_copy(&new_obj->style_list, ©->style_list); } - /*Copy the attributes if required*/ if(copy != NULL) { - LV_ASSERT_OBJ(copy, LV_OBJX_NAME); lv_area_copy(&new_obj->coords, ©->coords); new_obj->ext_draw_pad = copy->ext_draw_pad; #if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL lv_area_copy(&new_obj->ext_click_pad, ©->ext_click_pad); -#endif - -#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY +#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY new_obj->ext_click_pad_hor = copy->ext_click_pad_hor; new_obj->ext_click_pad_ver = copy->ext_click_pad_ver; #endif - /*Set free data*/ + /*Set user data*/ #if LV_USE_USER_DATA - memcpy(&new_obj->user_data, ©->user_data, sizeof(lv_obj_user_data_t)); + _lv_memcpy(&new_obj->user_data, ©->user_data, sizeof(lv_obj_user_data_t)); #endif + + new_obj->base_dir = copy->base_dir; + /*Copy realign*/ #if LV_USE_OBJ_REALIGN new_obj->realign.align = copy->realign.align; @@ -363,6 +423,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) new_obj->event_cb = copy->event_cb; /*Copy attributes*/ + new_obj->adv_hittest = copy->adv_hittest; new_obj->click = copy->click; new_obj->drag = copy->drag; new_obj->drag_dir = copy->drag_dir; @@ -372,11 +433,9 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) new_obj->top = copy->top; new_obj->parent_event = copy->parent_event; - new_obj->opa_scale_en = copy->opa_scale_en; new_obj->protect = copy->protect; - new_obj->opa_scale = copy->opa_scale; - - new_obj->style_p = copy->style_p; + new_obj->gesture_parent = copy->gesture_parent; + new_obj->focus_parent = copy->focus_parent; #if LV_USE_GROUP /*Add to the same group*/ @@ -388,11 +447,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) /*Set the same coordinates for non screen objects*/ if(lv_obj_get_parent(copy) != NULL && parent != NULL) { lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy)); - } else { - lv_obj_set_pos(new_obj, 0, 0); } - - LV_LOG_INFO("Object create ready"); } /*Send a signal to the parent to notify it about the new child*/ @@ -403,6 +458,8 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) lv_obj_invalidate(new_obj); } + LV_LOG_INFO("Object create ready"); + return new_obj; } @@ -416,80 +473,41 @@ lv_res_t lv_obj_del(lv_obj_t * obj) LV_ASSERT_OBJ(obj, LV_OBJX_NAME); lv_obj_invalidate(obj); - /*Delete from the group*/ -#if LV_USE_GROUP - lv_group_t * group = lv_obj_get_group(obj); - if(group) lv_group_remove_obj(obj); -#endif - - /*Remove the animations from this object*/ -#if LV_USE_ANIMATION - lv_anim_del(obj, NULL); -#endif - - /*Recursively delete the children*/ - lv_obj_t * i; - lv_obj_t * i_next; - i = lv_ll_get_head(&(obj->child_ll)); - while(i != NULL) { - /*Get the next object before delete this*/ - i_next = lv_ll_get_next(&(obj->child_ll), i); - - /*Call the recursive del to the child too*/ - delete_children(i); - - /*Set i to the next node*/ - i = i_next; - } - - /*Let the user free the resources used in `LV_EVENT_DELETE`*/ - lv_event_send(obj, LV_EVENT_DELETE, NULL); - - lv_event_mark_deleted(obj); - - /* Reset all input devices if the object to delete is used*/ - lv_indev_t * indev = lv_indev_get_next(NULL); - while(indev) { - if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) { - lv_indev_reset(indev); - } - if(indev->proc.types.pointer.last_pressed == obj) { - indev->proc.types.pointer.last_pressed = NULL; - } - -#if LV_USE_GROUP - if(indev->group == group && obj == lv_indev_get_obj_act()) { - lv_indev_reset(indev); - } -#endif - indev = lv_indev_get_next(indev); - } - - /* All children deleted. - * Now clean up the object specific data*/ - obj->signal_cb(obj, LV_SIGNAL_CLEANUP, NULL); - - /*Remove the object from parent's children list*/ + lv_disp_t * disp = NULL; + bool act_scr_del = false; lv_obj_t * par = lv_obj_get_parent(obj); - if(par == NULL) { /*It is a screen*/ - lv_disp_t * d = lv_obj_get_disp(obj); - lv_ll_rem(&d->scr_ll, obj); - } else { - lv_ll_rem(&(par->child_ll), obj); + if(par == NULL) { + disp = lv_obj_get_disp(obj); + if(!disp) return LV_RES_INV; /*Shouldn't happen*/ + if(disp->act_scr == obj) act_scr_del = true; } - /*Delete the base objects*/ - if(obj->ext_attr != NULL) lv_mem_free(obj->ext_attr); - lv_mem_free(obj); /*Free the object itself*/ + obj_del_core(obj); /*Send a signal to the parent to notify it about the child delete*/ - if(par != NULL) { + if(par) { par->signal_cb(par, LV_SIGNAL_CHILD_CHG, NULL); } + /*Handle if the active screen was deleted*/ + if(act_scr_del) { + disp->act_scr = NULL; + } + return LV_RES_INV; } +#if LV_USE_ANIMATION +/** + * A function to be easily used in animation ready callback to delete an object when the animation is ready + * @param a pointer to the animation + */ +void lv_obj_del_anim_ready_cb(lv_anim_t * a) +{ + lv_obj_del(a->var); +} +#endif + /** * Helper function for asynchronously deleting objects. * Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent). @@ -510,13 +528,9 @@ void lv_obj_clean(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); lv_obj_t * child = lv_obj_get_child(obj, NULL); - lv_obj_t * child_next; while(child) { - /* Read the next child before deleting the current - * because the next couldn't be read from a deleted (invalid) node*/ - child_next = lv_obj_get_child(obj, child); lv_obj_del(child); - child = child_next; + child = lv_obj_get_child(obj, NULL); /*Get the new first child*/ } } @@ -530,12 +544,50 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - if(lv_obj_get_hidden(obj)) return; + lv_area_t area_tmp; + lv_area_copy(&area_tmp, area); + bool visible = lv_obj_area_is_visible(obj, &area_tmp); + + if(visible) _lv_inv_area(lv_obj_get_disp(obj), &area_tmp); +} + +/** + * Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task' + * @param obj pointer to an object + */ +void lv_obj_invalidate(const lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + /*Truncate the area to the object*/ + lv_area_t obj_coords; + lv_coord_t ext_size = obj->ext_draw_pad; + lv_area_copy(&obj_coords, &obj->coords); + obj_coords.x1 -= ext_size; + obj_coords.y1 -= ext_size; + obj_coords.x2 += ext_size; + obj_coords.y2 += ext_size; + + lv_obj_invalidate_area(obj, &obj_coords); + +} + +/** + * Tell whether an area of an object is visible (even partially) now or not + * @param obj pointer to an object + * @param area the are to check. The visible part of the area will be written back here. + * @return true: visible; false: not visible (hidden, out of parent, on other screen, etc) + */ +bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area) +{ + if(lv_obj_get_hidden(obj)) return false; - /*Invalidate the object only if it belongs to the 'LV_GC_ROOT(_lv_act_scr)'*/ + /*Invalidate the object only if it belongs to the current or previous'*/ lv_obj_t * obj_scr = lv_obj_get_screen(obj); lv_disp_t * disp = lv_obj_get_disp(obj_scr); - if(obj_scr == lv_disp_get_scr_act(disp) || obj_scr == lv_disp_get_layer_top(disp) || + if(obj_scr == lv_disp_get_scr_act(disp) || + obj_scr == lv_disp_get_scr_prev(disp) || + obj_scr == lv_disp_get_layer_top(disp) || obj_scr == lv_disp_get_layer_sys(disp)) { /*Truncate the area to the object*/ @@ -548,34 +600,33 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area) obj_coords.y2 += ext_size; bool is_common; - lv_area_t area_trunc; - is_common = lv_area_intersect(&area_trunc, area, &obj_coords); - if(is_common == false) return; /*The area is not on the object*/ + is_common = _lv_area_intersect(area, area, &obj_coords); + if(is_common == false) return false; /*The area is not on the object*/ /*Truncate recursively to the parents*/ lv_obj_t * par = lv_obj_get_parent(obj); while(par != NULL) { - is_common = lv_area_intersect(&area_trunc, &area_trunc, &par->coords); - if(is_common == false) break; /*If no common parts with parent break;*/ - if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/ + is_common = _lv_area_intersect(area, area, &par->coords); + if(is_common == false) return false; /*If no common parts with parent break;*/ + if(lv_obj_get_hidden(par)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/ par = lv_obj_get_parent(par); } - - if(is_common) lv_inv_area(disp, &area_trunc); } + + return true; } /** - * Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task' + * Tell whether an object is visible (even partially) now or not * @param obj pointer to an object + * @return true: visible; false: not visible (hidden, out of parent, on other screen, etc) */ -void lv_obj_invalidate(const lv_obj_t * obj) +bool lv_obj_is_visible(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - /*Truncate the area to the object*/ lv_area_t obj_coords; lv_coord_t ext_size = obj->ext_draw_pad; lv_area_copy(&obj_coords, &obj->coords); @@ -584,9 +635,10 @@ void lv_obj_invalidate(const lv_obj_t * obj) obj_coords.x2 += ext_size; obj_coords.y2 += ext_size; - lv_obj_invalidate_area(obj, &obj_coords); + return lv_obj_area_is_visible(obj, &obj_coords); } + /*===================== * Setter functions *====================*/ @@ -605,7 +657,7 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent) LV_ASSERT_OBJ(obj, LV_OBJX_NAME); LV_ASSERT_OBJ(parent, LV_OBJX_NAME); - if(obj->par == NULL) { + if(obj->parent == NULL) { LV_LOG_WARN("Can't set the parent of a screen"); return; } @@ -617,15 +669,30 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent) lv_obj_invalidate(obj); + lv_obj_t * old_par = obj->parent; lv_point_t old_pos; - old_pos.x = lv_obj_get_x(obj); old_pos.y = lv_obj_get_y(obj); - lv_obj_t * old_par = obj->par; + lv_bidi_dir_t new_base_dir = lv_obj_get_base_dir(parent); + + if(new_base_dir != LV_BIDI_DIR_RTL) { + old_pos.x = lv_obj_get_x(obj); + } + else { + old_pos.x = old_par->coords.x2 - obj->coords.x2; + } + + _lv_ll_chg_list(&obj->parent->child_ll, &parent->child_ll, obj, true); + obj->parent = parent; - lv_ll_chg_list(&obj->par->child_ll, &parent->child_ll, obj, true); - obj->par = parent; - lv_obj_set_pos(obj, old_pos.x, old_pos.y); + if(new_base_dir != LV_BIDI_DIR_RTL) { + lv_obj_set_pos(obj, old_pos.x, old_pos.y); + } + else { + /*Align to the right in case of RTL base dir*/ + lv_coord_t new_x = lv_obj_get_width(parent) - old_pos.x - lv_obj_get_width(obj); + lv_obj_set_pos(obj, new_x, old_pos.y); + } /*Notify the original parent because one of its children is lost*/ old_par->signal_cb(old_par, LV_SIGNAL_CHILD_CHG, NULL); @@ -647,11 +714,11 @@ void lv_obj_move_foreground(lv_obj_t * obj) lv_obj_t * parent = lv_obj_get_parent(obj); /*Do nothing of already in the foreground*/ - if(lv_ll_get_head(&parent->child_ll) == obj) return; + if(_lv_ll_get_head(&parent->child_ll) == obj) return; lv_obj_invalidate(parent); - lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, true); + _lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, true); /*Notify the new parent about the child*/ parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj); @@ -670,11 +737,11 @@ void lv_obj_move_background(lv_obj_t * obj) lv_obj_t * parent = lv_obj_get_parent(obj); /*Do nothing of already in the background*/ - if(lv_ll_get_tail(&parent->child_ll) == obj) return; + if(_lv_ll_get_tail(&parent->child_ll) == obj) return; lv_obj_invalidate(parent); - lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, false); + _lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, false); /*Notify the new parent about the child*/ parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj); @@ -697,10 +764,12 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) LV_ASSERT_OBJ(obj, LV_OBJX_NAME); /*Convert x and y to absolute coordinates*/ - lv_obj_t * par = obj->par; + lv_obj_t * par = obj->parent; - x = x + par->coords.x1; - y = y + par->coords.y1; + if(par) { + x = x + par->coords.x1; + y = y + par->coords.y1; + } /*Calculate and set the movement*/ lv_point_t diff; @@ -727,10 +796,10 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) refresh_children_position(obj, diff.x, diff.y); /*Inform the object about its new coordinates*/ - obj->signal_cb(obj, LV_SIGNAL_CORD_CHG, &ori); + obj->signal_cb(obj, LV_SIGNAL_COORD_CHG, &ori); /*Send a signal to the parent too*/ - par->signal_cb(par, LV_SIGNAL_CHILD_CHG, obj); + if(par) par->signal_cb(par, LV_SIGNAL_CHILD_CHG, obj); /*Invalidate the new area*/ lv_obj_invalidate(obj); @@ -770,7 +839,6 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - /* Do nothing if the size is not changed */ /* It is very important else recursive resizing can * occur without size change*/ @@ -789,12 +857,13 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) obj->coords.y2 = obj->coords.y1 + h - 1; if(lv_obj_get_base_dir(obj) == LV_BIDI_DIR_RTL) { obj->coords.x1 = obj->coords.x2 - w + 1; - } else { + } + else { obj->coords.x2 = obj->coords.x1 + w - 1; } /*Send a signal to the object with its new coordinates*/ - obj->signal_cb(obj, LV_SIGNAL_CORD_CHG, &ori); + obj->signal_cb(obj, LV_SIGNAL_COORD_CHG, &ori); /*Send a signal to the parent too*/ lv_obj_t * par = lv_obj_get_parent(obj); @@ -802,9 +871,8 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) /*Tell the children the parent's size has changed*/ lv_obj_t * i; - LV_LL_READ(obj->child_ll, i) - { - i->signal_cb(i, LV_SIGNAL_PARENT_SIZE_CHG, NULL); + _LV_LL_READ(obj->child_ll, i) { + i->signal_cb(i, LV_SIGNAL_PARENT_SIZE_CHG, &ori); } /*Invalidate the new area*/ @@ -840,307 +908,192 @@ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h) lv_obj_set_size(obj, lv_obj_get_width(obj), h); } +/** + * Set the width reduced by the left and right padding. + * @param obj pointer to an object + * @param w the width without paddings + */ +void lv_obj_set_width_fit(lv_obj_t * obj, lv_coord_t w) +{ + lv_style_int_t pleft = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN); + lv_style_int_t pright = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN); + + lv_obj_set_width(obj, w - pleft - pright); +} + +/** + * Set the height reduced by the top and bottom padding. + * @param obj pointer to an object + * @param h the height without paddings + */ +void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h) +{ + lv_style_int_t ptop = lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN); + lv_style_int_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN); + + lv_obj_set_height(obj, h - ptop - pbottom); +} + +/** + * Set the width of an object by taking the left and right margin into account. + * The object width will be `obj_w = w - margin_left - margin_right` + * @param obj pointer to an object + * @param w new height including margins + */ +void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w) +{ + lv_style_int_t mleft = lv_obj_get_style_margin_left(obj, LV_OBJ_PART_MAIN); + lv_style_int_t mright = lv_obj_get_style_margin_right(obj, LV_OBJ_PART_MAIN); + + lv_obj_set_width(obj, w - mleft - mright); +} + +/** + * Set the height of an object by taking the top and bottom margin into account. + * The object height will be `obj_h = h - margin_top - margin_bottom` + * @param obj pointer to an object + * @param h new height including margins + */ +void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h) +{ + lv_style_int_t mtop = lv_obj_get_style_margin_top(obj, LV_OBJ_PART_MAIN); + lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_OBJ_PART_MAIN); + + lv_obj_set_height(obj, h - mtop - mbottom); +} + /** * Align an object to an other object. * @param obj pointer to an object to align * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. * @param align type of alignment (see 'lv_align_t' enum) - * @param x_mod x coordinate shift after alignment - * @param y_mod y coordinate shift after alignment + * @param x_ofs x coordinate offset after alignment + * @param y_ofs y coordinate offset after alignment */ -void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod) +void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - lv_coord_t new_x = lv_obj_get_x(obj); - lv_coord_t new_y = lv_obj_get_y(obj); - - if(base == NULL) { - base = lv_obj_get_parent(obj); - } + if(base == NULL) base = lv_obj_get_parent(obj); LV_ASSERT_OBJ(base, LV_OBJX_NAME); + obj_align_core(obj, base, align, true, true, x_ofs, y_ofs); - switch(align) { - case LV_ALIGN_CENTER: - new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2; - new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2; - break; - - case LV_ALIGN_IN_TOP_LEFT: - new_x = 0; - new_y = 0; - break; - case LV_ALIGN_IN_TOP_MID: - new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2; - new_y = 0; - break; +#if LV_USE_OBJ_REALIGN + /*Save the last align parameters to use them in `lv_obj_realign`*/ + obj->realign.align = align; + obj->realign.xofs = x_ofs; + obj->realign.yofs = y_ofs; + obj->realign.base = base; + obj->realign.mid_align = 0; +#endif +} - case LV_ALIGN_IN_TOP_RIGHT: - new_x = lv_obj_get_width(base) - lv_obj_get_width(obj); - new_y = 0; - break; - - case LV_ALIGN_IN_BOTTOM_LEFT: - new_x = 0; - new_y = lv_obj_get_height(base) - lv_obj_get_height(obj); - break; - case LV_ALIGN_IN_BOTTOM_MID: - new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2; - new_y = lv_obj_get_height(base) - lv_obj_get_height(obj); - break; - - case LV_ALIGN_IN_BOTTOM_RIGHT: - new_x = lv_obj_get_width(base) - lv_obj_get_width(obj); - new_y = lv_obj_get_height(base) - lv_obj_get_height(obj); - break; - - case LV_ALIGN_IN_LEFT_MID: - new_x = 0; - new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2; - break; - - case LV_ALIGN_IN_RIGHT_MID: - new_x = lv_obj_get_width(base) - lv_obj_get_width(obj); - new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2; - break; - - case LV_ALIGN_OUT_TOP_LEFT: - new_x = 0; - new_y = -lv_obj_get_height(obj); - break; - - case LV_ALIGN_OUT_TOP_MID: - new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2; - new_y = -lv_obj_get_height(obj); - break; - - case LV_ALIGN_OUT_TOP_RIGHT: - new_x = lv_obj_get_width(base) - lv_obj_get_width(obj); - new_y = -lv_obj_get_height(obj); - break; +/** + * Align an object to an other object horizontally. + * @param obj pointer to an object to align + * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. + * @param align type of alignment (see 'lv_align_t' enum) + * @param x_ofs x coordinate offset after alignment + */ +void lv_obj_align_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - case LV_ALIGN_OUT_BOTTOM_LEFT: - new_x = 0; - new_y = lv_obj_get_height(base); - break; + if(base == NULL) base = lv_obj_get_parent(obj); - case LV_ALIGN_OUT_BOTTOM_MID: - new_x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2; - new_y = lv_obj_get_height(base); - break; + LV_ASSERT_OBJ(base, LV_OBJX_NAME); - case LV_ALIGN_OUT_BOTTOM_RIGHT: - new_x = lv_obj_get_width(base) - lv_obj_get_width(obj); - new_y = lv_obj_get_height(base); - break; + obj_align_core(obj, base, align, true, false, x_ofs, 0); +} - case LV_ALIGN_OUT_LEFT_TOP: - new_x = -lv_obj_get_width(obj); - new_y = 0; - break; +/** + * Align an object to an other object vertically. + * @param obj pointer to an object to align + * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. + * @param align type of alignment (see 'lv_align_t' enum) + * @param y_ofs y coordinate offset after alignment + */ +void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - case LV_ALIGN_OUT_LEFT_MID: - new_x = -lv_obj_get_width(obj); - new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2; - break; + if(base == NULL) base = lv_obj_get_parent(obj); - case LV_ALIGN_OUT_LEFT_BOTTOM: - new_x = -lv_obj_get_width(obj); - new_y = lv_obj_get_height(base) - lv_obj_get_height(obj); - break; + LV_ASSERT_OBJ(base, LV_OBJX_NAME); - case LV_ALIGN_OUT_RIGHT_TOP: - new_x = lv_obj_get_width(base); - new_y = 0; - break; + obj_align_core(obj, base, align, false, true, 0, y_ofs); +} - case LV_ALIGN_OUT_RIGHT_MID: - new_x = lv_obj_get_width(base); - new_y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2; - break; +/** + * Align an object's middle point to an other object. + * @param obj pointer to an object to align + * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. + * @param align type of alignment (see 'lv_align_t' enum) + * @param x_ofs x coordinate offset after alignment + * @param y_ofs y coordinate offset after alignment + */ +void lv_obj_align_mid(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - case LV_ALIGN_OUT_RIGHT_BOTTOM: - new_x = lv_obj_get_width(base); - new_y = lv_obj_get_height(base) - lv_obj_get_height(obj); - break; + if(base == NULL) { + base = lv_obj_get_parent(obj); } - /*Bring together the coordination system of base and obj*/ - lv_obj_t * par = lv_obj_get_parent(obj); - lv_coord_t base_abs_x = base->coords.x1; - lv_coord_t base_abs_y = base->coords.y1; - lv_coord_t par_abs_x = par->coords.x1; - lv_coord_t par_abs_y = par->coords.y1; - new_x += x_mod + base_abs_x; - new_y += y_mod + base_abs_y; - new_x -= par_abs_x; - new_y -= par_abs_y; + LV_ASSERT_OBJ(base, LV_OBJX_NAME); - lv_obj_set_pos(obj, new_x, new_y); + obj_align_mid_core(obj, base, align, true, true, x_ofs, y_ofs); #if LV_USE_OBJ_REALIGN /*Save the last align parameters to use them in `lv_obj_realign`*/ obj->realign.align = align; - obj->realign.xofs = x_mod; - obj->realign.yofs = y_mod; + obj->realign.xofs = x_ofs; + obj->realign.yofs = y_ofs; obj->realign.base = base; - obj->realign.origo_align = 0; + obj->realign.mid_align = 1; #endif } /** - * Align an object's middle point to an other object. + * Align an object's middle point to an other object horizontally. * @param obj pointer to an object to align * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. * @param align type of alignment (see 'lv_align_t' enum) - * @param x_mod x coordinate shift after alignment - * @param y_mod y coordinate shift after alignment + * @param x_ofs x coordinate offset after alignment */ -void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod) +void lv_obj_align_mid_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - lv_coord_t new_x = lv_obj_get_x(obj); - lv_coord_t new_y = lv_obj_get_y(obj); - - lv_coord_t obj_w_half = lv_obj_get_width(obj) / 2; - lv_coord_t obj_h_half = lv_obj_get_height(obj) / 2; - if(base == NULL) { base = lv_obj_get_parent(obj); } LV_ASSERT_OBJ(base, LV_OBJX_NAME); + obj_align_mid_core(obj, base, align, true, false, x_ofs, 0); +} - switch(align) { - case LV_ALIGN_CENTER: - new_x = lv_obj_get_width(base) / 2 - obj_w_half; - new_y = lv_obj_get_height(base) / 2 - obj_h_half; - break; - - case LV_ALIGN_IN_TOP_LEFT: - new_x = -obj_w_half; - new_y = -obj_h_half; - break; - case LV_ALIGN_IN_TOP_MID: - new_x = lv_obj_get_width(base) / 2 - obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_IN_TOP_RIGHT: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_IN_BOTTOM_LEFT: - new_x = -obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - case LV_ALIGN_IN_BOTTOM_MID: - new_x = lv_obj_get_width(base) / 2 - obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - - case LV_ALIGN_IN_BOTTOM_RIGHT: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - - case LV_ALIGN_IN_LEFT_MID: - new_x = -obj_w_half; - new_y = lv_obj_get_height(base) / 2 - obj_h_half; - break; - - case LV_ALIGN_IN_RIGHT_MID: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = lv_obj_get_height(base) / 2 - obj_h_half; - break; - - case LV_ALIGN_OUT_TOP_LEFT: - new_x = -obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_OUT_TOP_MID: - new_x = lv_obj_get_width(base) / 2 - obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_OUT_TOP_RIGHT: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_OUT_BOTTOM_LEFT: - new_x = -obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - - case LV_ALIGN_OUT_BOTTOM_MID: - new_x = lv_obj_get_width(base) / 2 - obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - - case LV_ALIGN_OUT_BOTTOM_RIGHT: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - - case LV_ALIGN_OUT_LEFT_TOP: - new_x = -obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_OUT_LEFT_MID: - new_x = -obj_w_half; - new_y = lv_obj_get_height(base) / 2 - obj_h_half; - break; - - case LV_ALIGN_OUT_LEFT_BOTTOM: - new_x = -obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; - - case LV_ALIGN_OUT_RIGHT_TOP: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = -obj_h_half; - break; - - case LV_ALIGN_OUT_RIGHT_MID: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = lv_obj_get_height(base) / 2 - obj_h_half; - break; +/** + * Align an object's middle point to an other object vertically. + * @param obj pointer to an object to align + * @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it. + * @param align type of alignment (see 'lv_align_t' enum) + * @param y_ofs y coordinate offset after alignment + */ +void lv_obj_align_mid_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - case LV_ALIGN_OUT_RIGHT_BOTTOM: - new_x = lv_obj_get_width(base) - obj_w_half; - new_y = lv_obj_get_height(base) - obj_h_half; - break; + if(base == NULL) { + base = lv_obj_get_parent(obj); } - /*Bring together the coordination system of base and obj*/ - lv_obj_t * par = lv_obj_get_parent(obj); - lv_coord_t base_abs_x = base->coords.x1; - lv_coord_t base_abs_y = base->coords.y1; - lv_coord_t par_abs_x = par->coords.x1; - lv_coord_t par_abs_y = par->coords.y1; - new_x += x_mod + base_abs_x; - new_y += y_mod + base_abs_y; - new_x -= par_abs_x; - new_y -= par_abs_y; - - lv_obj_set_pos(obj, new_x, new_y); + LV_ASSERT_OBJ(base, LV_OBJX_NAME); -#if LV_USE_OBJ_REALIGN - /*Save the last align parameters to use them in `lv_obj_realign`*/ - obj->realign.align = align; - obj->realign.xofs = x_mod; - obj->realign.yofs = y_mod; - obj->realign.base = base; - obj->realign.origo_align = 1; -#endif + obj_align_mid_core(obj, base, align, false, true, 0, y_ofs); } /** @@ -1152,13 +1105,13 @@ void lv_obj_realign(lv_obj_t * obj) LV_ASSERT_OBJ(obj, LV_OBJX_NAME); #if LV_USE_OBJ_REALIGN - if(obj->realign.origo_align) - lv_obj_align_origo(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); + if(obj->realign.mid_align) + lv_obj_align_mid(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); else lv_obj_align(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs); #else (void)obj; - LV_LOG_WARN("lv_obj_realaign: no effect because LV_USE_OBJ_REALIGN = 0"); + LV_LOG_WARN("lv_obj_realign: no effect because LV_USE_OBJ_REALIGN = 0"); #endif } @@ -1181,7 +1134,6 @@ void lv_obj_set_auto_realign(lv_obj_t * obj, bool en) #endif } - /** * Set the size of an extended clickable area * If TINY mode is used, only the largest of the horizontal and vertical padding @@ -1218,83 +1170,349 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right *--------------------*/ /** - * Set a new style for an object + * Add a new style to the style list of an object. * @param obj pointer to an object - * @param style_p pointer to the new style + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param style pointer to a style to add (Only its pointer will be saved) */ -void lv_obj_set_style(lv_obj_t * obj, const lv_style_t * style) +void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style) { - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - LV_ASSERT_STYLE(style); - - obj->style_p = style; + if(style == NULL) return; - /*Send a signal about style change to every children with NULL style*/ - refresh_children_style(obj); + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + if(style_dsc == NULL) { + LV_LOG_WARN("Can't find style with part: %d", part); + return; + } - /*Notify the object about the style change too*/ - lv_obj_refresh_style(obj); + _lv_style_list_add_style(style_dsc, style); +#if LV_USE_ANIMATION + trans_del(obj, part, 0xFF, NULL); +#endif + lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); } /** - * Notify an object about its style is modified + * Remove a style from the style list of an object. * @param obj pointer to an object + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param style pointer to a style to remove */ -void lv_obj_refresh_style(lv_obj_t * obj) +void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style) { - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + if(style == NULL) return; - lv_obj_invalidate(obj); - obj->signal_cb(obj, LV_SIGNAL_STYLE_CHG, NULL); - lv_obj_invalidate(obj); + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + if(style_dsc == NULL) { + LV_LOG_WARN("Can't find style with part: %d", part); + return; + } + + _lv_style_list_remove_style(style_dsc, style); +#if LV_USE_ANIMATION + trans_del(obj, part, 0xFF, NULL); +#endif + lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); } /** - * Notify all object if a style is modified - * @param style pointer to a style. Only the objects with this style will be notified - * (NULL to notify all objects) + * Reset a style to the default (empty) state. + * Release all used memories and cancel pending related transitions. + * Typically used in `LV_SIGN_CLEAN_UP. + * @param obj pointer to an object + * @param part the part of the object which style list should be reset. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` */ -void lv_obj_report_style_mod(lv_style_t * style) +void lv_obj_clean_style_list(lv_obj_t * obj, uint8_t part) { - LV_ASSERT_STYLE(style); - - lv_disp_t * d = lv_disp_get_next(NULL); - - while(d) { - lv_obj_t * i; - LV_LL_READ(d->scr_ll, i) - { - if(i->style_p == style || style == NULL) { - lv_obj_refresh_style(i); - } - - report_style_mod_core(style, i); - } - d = lv_disp_get_next(d); + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + if(style_dsc == NULL) { + LV_LOG_WARN("lv_obj_clean_style_list: can't find style with `part`"); + return; } -} -/*----------------- - * Attribute set - *----------------*/ + _lv_style_list_reset(style_dsc); +#if LV_USE_ANIMATION + trans_del(obj, part, 0xFF, NULL); +#endif +} /** - * Hide an object. It won't be visible and clickable. + * Reset a style to the default (empty) state. + * Release all used memories and cancel pending related transitions. + * Also notifies the object about the style change. * @param obj pointer to an object - * @param en true: hide the object + * @param part the part of the object which style list should be reset. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` */ -void lv_obj_set_hidden(lv_obj_t * obj, bool en) +void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part) { - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + lv_obj_clean_style_list(obj, part); - if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ + lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); +} + +/** + * Set a local style property of a part of an object in a given state. + * @param obj pointer to an object + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop a style property ORed with a state. + * E.g. `LV_STYLE_BORDER_WIDTH | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)` + * @param the value to set + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_opa()` + * @note for performance reasons it's not checked if the property really has integer type + */ +void _lv_obj_set_style_local_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value) +{ + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + _lv_style_list_set_local_int(style_dsc, prop, value); +#if LV_USE_ANIMATION + trans_del(obj, part, prop, NULL); +#endif + lv_obj_refresh_style(obj, part, prop & (~LV_STYLE_STATE_MASK)); +} + +/** + * Set a local style property of a part of an object in a given state. + * @param obj pointer to an object + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop a style property ORed with a state. + * E.g. `LV_STYLE_BORDER_COLOR | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)` + * @param the value to set + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_opa()` + * @note for performance reasons it's not checked if the property really has color type + */ +void _lv_obj_set_style_local_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color) +{ + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + _lv_style_list_set_local_color(style_dsc, prop, color); +#if LV_USE_ANIMATION + trans_del(obj, part, prop, NULL); +#endif + lv_obj_refresh_style(obj, part, prop & (~LV_STYLE_STATE_MASK)); +} + +/** + * Set a local style property of a part of an object in a given state. + * @param obj pointer to an object + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop a style property ORed with a state. + * E.g. `LV_STYLE_BORDER_OPA | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)` + * @param the value to set + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_opa()` + * @note for performance reasons it's not checked if the property really has opacity type + */ +void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa) +{ + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + _lv_style_list_set_local_opa(style_dsc, prop, opa); +#if LV_USE_ANIMATION + trans_del(obj, part, prop, NULL); +#endif + lv_obj_refresh_style(obj, part, prop & (~LV_STYLE_STATE_MASK)); +} + +/** + * Set a local style property of a part of an object in a given state. + * @param obj pointer to an object + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop a style property ORed with a state. + * E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)` + * @param value the value to set + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_opa()` + * @note for performance reasons it's not checked if the property really has pointer type + */ +void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, const void * value) +{ + lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part); + _lv_style_list_set_local_ptr(style_dsc, prop, value); +#if LV_USE_ANIMATION + trans_del(obj, part, prop, NULL); +#endif + lv_obj_refresh_style(obj, part, prop & (~LV_STYLE_STATE_MASK)); +} + +/** + * Remove a local style property from a part of an object with a given state. + * @param obj pointer to an object + * @param part the part of the object which style property should be removed. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop a style property ORed with a state. + * E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)` + * @note shouldn't be used directly. Use the specific property remove functions instead. + * For example: `lv_obj_style_remove_border_opa()` + * @return true: the property was found and removed; false: the property was not found + */ +bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + lv_style_t * style = lv_obj_get_local_style(obj, part); + if(style) return lv_style_remove_prop(style, prop); + else return false; +} + +/** + * Notify an object (and its children) about its style is modified + * @param obj pointer to an object + * @param part the part of the object which style property should be refreshed. + * @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used to optimize what needs to be refreshed. + */ +void lv_obj_refresh_style(lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + invalidate_style_cache(obj, part, prop); + + /*If a real style refresh is required*/ + bool real_refr = false; + switch(prop) { + case LV_STYLE_PROP_ALL: + case LV_STYLE_CLIP_CORNER: + case LV_STYLE_SIZE: + case LV_STYLE_TRANSFORM_WIDTH: + case LV_STYLE_TRANSFORM_HEIGHT: + case LV_STYLE_TRANSFORM_ANGLE: + case LV_STYLE_TRANSFORM_ZOOM: + case LV_STYLE_PAD_TOP: + case LV_STYLE_PAD_BOTTOM: + case LV_STYLE_PAD_LEFT: + case LV_STYLE_PAD_RIGHT: + case LV_STYLE_PAD_INNER: + case LV_STYLE_MARGIN_TOP: + case LV_STYLE_MARGIN_BOTTOM: + case LV_STYLE_MARGIN_LEFT: + case LV_STYLE_MARGIN_RIGHT: + case LV_STYLE_OUTLINE_WIDTH: + case LV_STYLE_OUTLINE_PAD: + case LV_STYLE_OUTLINE_OPA: + case LV_STYLE_SHADOW_WIDTH: + case LV_STYLE_SHADOW_OPA: + case LV_STYLE_SHADOW_OFS_X: + case LV_STYLE_SHADOW_OFS_Y: + case LV_STYLE_SHADOW_SPREAD: + case LV_STYLE_VALUE_LETTER_SPACE: + case LV_STYLE_VALUE_LINE_SPACE: + case LV_STYLE_VALUE_OFS_X: + case LV_STYLE_VALUE_OFS_Y: + case LV_STYLE_VALUE_ALIGN: + case LV_STYLE_VALUE_STR: + case LV_STYLE_VALUE_FONT: + case LV_STYLE_VALUE_OPA: + case LV_STYLE_TEXT_LETTER_SPACE: + case LV_STYLE_TEXT_LINE_SPACE: + case LV_STYLE_TEXT_FONT: + case LV_STYLE_LINE_WIDTH: + real_refr = true; + break; + default: + real_refr = false; + } + + if(real_refr) { + lv_obj_invalidate(obj); + obj->signal_cb(obj, LV_SIGNAL_STYLE_CHG, NULL); + + switch(prop) { + case LV_STYLE_PROP_ALL: + case LV_STYLE_MARGIN_TOP: + case LV_STYLE_MARGIN_BOTTOM: + case LV_STYLE_MARGIN_LEFT: + case LV_STYLE_MARGIN_RIGHT: + if(obj->parent) obj->parent->signal_cb(obj->parent, LV_SIGNAL_CHILD_CHG, NULL); + break; + } + + lv_obj_invalidate(obj); + + /*Send style change signals*/ + if(prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_INHERIT_MASK)) refresh_children_style(obj); + } + else { + lv_obj_invalidate(obj); + } +} + +/** + * Notify all object if a style is modified + * @param style pointer to a style. Only the objects with this style will be notified + * (NULL to notify all objects) + */ +void lv_obj_report_style_mod(lv_style_t * style) +{ + lv_disp_t * d = lv_disp_get_next(NULL); + + while(d) { + lv_obj_t * i; + _LV_LL_READ(d->scr_ll, i) { + report_style_mod_core(style, i); + } + d = lv_disp_get_next(d); + } +} + +/** + * Enable/disable the use of style cache for an object + * @param obj pointer to an object + * @param dis true: disable; false: enable (re-enable) + */ +void _lv_obj_disable_style_caching(lv_obj_t * obj, bool dis) +{ + uint8_t part; + for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) { + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + if(list == NULL) break; + list->ignore_cache = dis; + } + for(part = _LV_OBJ_PART_REAL_FIRST; part < 0xFF; part++) { + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + if(list == NULL) break; + list->ignore_cache = dis; + } +} + +/*----------------- + * Attribute set + *----------------*/ + +/** + * Hide an object. It won't be visible and clickable. + * @param obj pointer to an object + * @param en true: hide the object + */ +void lv_obj_set_hidden(lv_obj_t * obj, bool en) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ obj->hidden = en == false ? 0 : 1; if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ lv_obj_t * par = lv_obj_get_parent(obj); - par->signal_cb(par, LV_SIGNAL_CHILD_CHG, obj); + if(par) par->signal_cb(par, LV_SIGNAL_CHILD_CHG, obj); +} + +/** + * Set whether advanced hit-testing is enabled on an object + * @param obj pointer to an object + * @param en true: advanced hit-testing is enabled + */ +void lv_obj_set_adv_hittest(lv_obj_t * obj, bool en) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + obj->adv_hittest = en == false ? 0 : 1; } /** @@ -1325,7 +1543,7 @@ void lv_obj_set_top(lv_obj_t * obj, bool en) /** * Enable the dragging of an object * @param obj pointer to an object - * @param en true: make the object dragable + * @param en true: make the object draggable */ void lv_obj_set_drag(lv_obj_t * obj, bool en) { @@ -1374,6 +1592,42 @@ void lv_obj_set_drag_parent(lv_obj_t * obj, bool en) obj->drag_parent = (en == true ? 1 : 0); } +/** +* Enable to use parent for gesture related operations. +* If trying to gesture the object the parent will be moved instead +* @param obj pointer to an object +* @param en true: enable the 'gesture parent' for the object +*/ +void lv_obj_set_gesture_parent(lv_obj_t * obj, bool en) +{ + obj->gesture_parent = (en == true ? 1 : 0); +} + +/** +* Enable to use parent for focus state. +* When object is focused the parent will get the state instead (visual only) +* @param obj pointer to an object +* @param en true: enable the 'focus parent' for the object +*/ +void lv_obj_set_focus_parent(lv_obj_t * obj, bool en) +{ + if(lv_obj_is_focused(obj)) { + if(en) { + obj->focus_parent = 1; + lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED); + lv_obj_set_state(lv_obj_get_focused_obj(obj), LV_STATE_FOCUSED); + } + else { + lv_obj_clear_state(lv_obj_get_focused_obj(obj), LV_STATE_FOCUSED | LV_STATE_EDITED); + lv_obj_set_state(obj, LV_STATE_FOCUSED); + obj->focus_parent = 0; + } + } + else { + obj->focus_parent = (en == true ? 1 : 0); + } +} + /** * Propagate the events to the parent too * @param obj pointer to an object @@ -1386,6 +1640,12 @@ void lv_obj_set_parent_event(lv_obj_t * obj, bool en) obj->parent_event = (en == true ? 1 : 0); } +/** + * Set the base direction of the object. + * @note This only works if LV_USE_BIDI is enabled. + * @param obj pointer to an object + * @param dir the new base direction. `LV_BIDI_DIR_LTR/RTL/AUTO/INHERIT` + */ void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir) { if(dir != LV_BIDI_DIR_LTR && dir != LV_BIDI_DIR_RTL && @@ -1404,57 +1664,191 @@ void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir) } /** - * Set the opa scale enable parameter (required to set opa_scale with `lv_obj_set_opa_scale()`) + * Set a bit or bits in the protect filed * @param obj pointer to an object - * @param en true: opa scaling is enabled for this object and all children; false: no opa scaling + * @param prot 'OR'-ed values from `lv_protect_t` */ -void lv_obj_set_opa_scale_enable(lv_obj_t * obj, bool en) +void lv_obj_add_protect(lv_obj_t * obj, uint8_t prot) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - obj->opa_scale_en = en ? 1 : 0; + obj->protect |= prot; } /** - * Set the opa scale of an object. - * The opacity of this object and all it's children will be scaled down with this factor. - * `lv_obj_set_opa_scale_enable(obj, true)` needs to be called to enable it. - * (not for all children just for the parent where to start the opa scaling) + * Clear a bit or bits in the protect filed * @param obj pointer to an object - * @param opa_scale a factor to scale down opacity [0..255] + * @param prot 'OR'-ed values from `lv_protect_t` */ -void lv_obj_set_opa_scale(lv_obj_t * obj, lv_opa_t opa_scale) +void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - obj->opa_scale = opa_scale; - lv_obj_invalidate(obj); + prot = (~prot) & 0xFF; + obj->protect &= prot; } /** - * Set a bit or bits in the protect filed + * Set the state (fully overwrite) of an object. + * If specified in the styles a transition animation will be started + * from the previous state to the current * @param obj pointer to an object - * @param prot 'OR'-ed values from `lv_protect_t` + * @param state the new state */ -void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot) +void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) { + if(obj->state == new_state) return; + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - obj->protect |= prot; + lv_state_t prev_state = obj->state; + style_snapshot_res_t cmp_res = STYLE_COMPARE_SAME; + uint8_t part; + for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) { + lv_style_list_t * style_list = lv_obj_get_style_list(obj, part); + if(style_list == NULL) break; /*No more style lists*/ + obj->state = prev_state; + style_snapshot_t shot_pre; + style_snapshot(obj, part, &shot_pre); + obj->state = new_state; + style_snapshot_t shot_post; + style_snapshot(obj, part, &shot_post); + + style_snapshot_res_t r = style_snapshot_compare(&shot_pre, &shot_post); + if(r == STYLE_COMPARE_DIFF) { + cmp_res = STYLE_COMPARE_DIFF; + break; + } + if(r == STYLE_COMPARE_VISUAL_DIFF) { + cmp_res = STYLE_COMPARE_VISUAL_DIFF; + } + } + + obj->state = new_state; + + if(cmp_res == STYLE_COMPARE_SAME) { + return; + } + +#if LV_USE_ANIMATION == 0 + if(cmp_res == STYLE_COMPARE_DIFF) lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); + else if(cmp_res == STYLE_COMPARE_VISUAL_DIFF) lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); +#else + + for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) { + lv_style_list_t * style_list = lv_obj_get_style_list(obj, part); + if(style_list == NULL) break; /*No more style lists*/ + if(style_list->ignore_trans) continue; + + lv_style_int_t time = lv_obj_get_style_transition_time(obj, part); + lv_style_property_t props[LV_STYLE_TRANS_NUM_MAX]; + lv_style_int_t delay = lv_obj_get_style_transition_delay(obj, part); + const lv_anim_path_t * path = lv_obj_get_style_transition_path(obj, part); + props[0] = lv_obj_get_style_transition_prop_1(obj, part); + props[1] = lv_obj_get_style_transition_prop_2(obj, part); + props[2] = lv_obj_get_style_transition_prop_3(obj, part); + props[3] = lv_obj_get_style_transition_prop_4(obj, part); + props[4] = lv_obj_get_style_transition_prop_5(obj, part); + props[5] = lv_obj_get_style_transition_prop_6(obj, part); + + uint8_t i; + for(i = 0; i < LV_STYLE_TRANS_NUM_MAX; i++) { + if(props[i] != 0) { + _lv_style_list_add_trans_style(style_list); + + lv_style_trans_t * tr = trans_create(obj, props[i], part, prev_state, new_state); + + /*If there is a pending anim for this property remove it*/ + if(tr) { + tr->obj = obj; + tr->prop = props[i]; + tr->part = part; + + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_var(&a, tr); + lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)trans_anim_cb); + lv_anim_set_start_cb(&a, trans_anim_start_cb); + lv_anim_set_ready_cb(&a, trans_anim_ready_cb); + lv_anim_set_values(&a, 0x00, 0xFF); + lv_anim_set_time(&a, time); + lv_anim_set_delay(&a, delay); + lv_anim_set_path(&a, path); + a.early_apply = 0; + lv_anim_start(&a); + } + + } + } + if(cmp_res == STYLE_COMPARE_DIFF) lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); + + if(cmp_res == STYLE_COMPARE_VISUAL_DIFF) { + invalidate_style_cache(obj, part, LV_STYLE_PROP_ALL); + } + } + + if(cmp_res == STYLE_COMPARE_VISUAL_DIFF) { + lv_obj_invalidate(obj); + } + +#endif + } /** - * Clear a bit or bits in the protect filed + * Add a given state or states to the object. The other state bits will remain unchanged. + * If specified in the styles a transition animation will be started + * from the previous state to the current * @param obj pointer to an object - * @param prot 'OR'-ed values from `lv_protect_t` + * @param state the state bits to add. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` */ -void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot) +void lv_obj_add_state(lv_obj_t * obj, lv_state_t state) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - prot = (~prot) & 0xFF; - obj->protect &= prot; + lv_state_t new_state = obj->state | state; + if(obj->state != new_state) { + lv_obj_set_state(obj, new_state); + } +} + +/** + * Remove a given state or states to the object. The other state bits will remain unchanged. + * If specified in the styles a transition animation will be started + * from the previous state to the current + * @param obj pointer to an object + * @param state the state bits to remove. E.g `LV_STATE_PRESSED | LV_STATE_FOCUSED` + */ +void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + lv_state_t new_state = obj->state & (~state); + if(obj->state != new_state) { + lv_obj_set_state(obj, new_state); + } +} + +#if LV_USE_ANIMATION +/** + * Finish all pending transitions on a part of an object + * @param obj pointer to an object + * @param part part of the object, e.g `LV_BRN_PART_MAIN` or `LV_OBJ_PART_ALL` for all parts + */ +void lv_obj_finish_transitions(lv_obj_t * obj, uint8_t part) +{ + /*Animate all related transition to the end value*/ + lv_style_trans_t * tr; + _LV_LL_READ_BACK(LV_GC_ROOT(_lv_obj_style_trans_ll), tr) { + if(tr->obj == obj && (part == tr->part || part == LV_OBJ_PART_ALL)) { + trans_anim_cb(tr, 255); + } + } + + /*Free all related transition data*/ + trans_del(obj, part, 0xFF, NULL); } +#endif /** * Set a an event handler function for an object. @@ -1487,6 +1881,51 @@ lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data) return res; } +/** + * Send LV_EVENT_REFRESH event to an object + * @param obj point to an object. (Can NOT be NULL) + * @return LV_RES_OK: success, LV_RES_INV: to object become invalid (e.g. deleted) due to this event. + */ +lv_res_t lv_event_send_refresh(lv_obj_t * obj) +{ + return lv_event_send(obj, LV_EVENT_REFRESH, NULL); +} + +/** + * Send LV_EVENT_REFRESH event to an object and all of its children. + * @param obj pointer to an object or NULL to refresh all objects of all displays + */ +void lv_event_send_refresh_recursive(lv_obj_t * obj) +{ + if(obj == NULL) { + /*If no obj specified refresh all screen of all displays */ + lv_disp_t * d = lv_disp_get_next(NULL); + while(d) { + lv_obj_t * scr = _lv_ll_get_head(&d->scr_ll); + while(scr) { + lv_event_send_refresh_recursive(scr); + scr = _lv_ll_get_next(&d->scr_ll, scr); + } + lv_event_send_refresh_recursive(d->top_layer); + lv_event_send_refresh_recursive(d->sys_layer); + + d = lv_disp_get_next(d); + } + } + else { + + lv_res_t res = lv_event_send_refresh(obj); + if(res != LV_RES_OK) return; /*If invalid returned do not check the children*/ + + lv_obj_t * child = lv_obj_get_child(obj, NULL); + while(child) { + lv_event_send_refresh_recursive(child); + + child = lv_obj_get_child(obj, child); + } + } +} + /** * Call an event function with an object, event, and data. * @param event_xcb an event callback function. If `NULL` `LV_RES_OK` will return without any actions. @@ -1539,8 +1978,8 @@ lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t } if(obj) { - if(obj->parent_event && obj->par) { - lv_res_t res = lv_event_send(obj->par, event, data); + if(obj->parent_event && obj->parent) { + lv_res_t res = lv_event_send(obj->parent, event, data); if(res != LV_RES_OK) { return LV_RES_INV; } @@ -1576,12 +2015,16 @@ void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb) * Send an event to the object * @param obj pointer to an object * @param event the type of the event from `lv_event_t`. + * @return LV_RES_OK or LV_RES_INV */ -void lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param) +lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param) { - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + if(obj == NULL) return LV_RES_OK; + + lv_res_t res = LV_RES_OK; + if(obj->signal_cb) res = obj->signal_cb(obj, signal, param); - if(obj->signal_cb) obj->signal_cb(obj, signal, param); + return res; } /** @@ -1604,19 +2047,23 @@ void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb) * Allocate a new ext. data for an object * @param obj pointer to an object * @param ext_size the size of the new ext. data - * @return Normal pointer to the allocated ext + * @return pointer to the allocated ext. + * If out of memory NULL is returned and the original ext is preserved */ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - obj->ext_attr = lv_mem_realloc(obj->ext_attr, ext_size); + void * new_ext = lv_mem_realloc(obj->ext_attr, ext_size); + if(new_ext == NULL) return NULL; + obj->ext_attr = new_ext; return (void *)obj->ext_attr; } /** - * Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object + * Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object to refresh the extended draw area. + * he object needs to be invalidated by `lv_obj_invalidate(obj)` manually after this function. * @param obj pointer to an object */ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj) @@ -1626,7 +2073,6 @@ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj) obj->ext_draw_pad = 0; obj->signal_cb(obj, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL); - lv_obj_invalidate(obj); } /*======================= @@ -1664,17 +2110,15 @@ lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj) const lv_obj_t * scr; - if(obj->par == NULL) + if(obj->parent == NULL) scr = obj; /*`obj` is a screen*/ else scr = lv_obj_get_screen(obj); /*get the screen of `obj`*/ lv_disp_t * d; - LV_LL_READ(LV_GC_ROOT(_lv_disp_ll), d) - { + _LV_LL_READ(LV_GC_ROOT(_lv_disp_ll), d) { lv_obj_t * s; - LV_LL_READ(d->scr_ll, s) - { + _LV_LL_READ(d->scr_ll, s) { if(s == scr) return d; } } @@ -1696,7 +2140,7 @@ lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - return obj->par; + return obj->parent; } /** @@ -1713,9 +2157,10 @@ lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child) lv_obj_t * result = NULL; if(child == NULL) { - result = lv_ll_get_head(&obj->child_ll); - } else { - result = lv_ll_get_next(&obj->child_ll, child); + result = _lv_ll_get_head(&obj->child_ll); + } + else { + result = _lv_ll_get_next(&obj->child_ll, child); } return result; @@ -1735,9 +2180,10 @@ lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child) lv_obj_t * result = NULL; if(child == NULL) { - result = lv_ll_get_tail(&obj->child_ll); - } else { - result = lv_ll_get_prev(&obj->child_ll, child); + result = _lv_ll_get_tail(&obj->child_ll); + } + else { + result = _lv_ll_get_prev(&obj->child_ll, child); } return result; @@ -1755,7 +2201,7 @@ uint16_t lv_obj_count_children(const lv_obj_t * obj) lv_obj_t * i; uint16_t cnt = 0; - LV_LL_READ(obj->child_ll, i) cnt++; + _LV_LL_READ(obj->child_ll, i) cnt++; return cnt; } @@ -1771,8 +2217,7 @@ uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj) lv_obj_t * i; uint16_t cnt = 0; - LV_LL_READ(obj->child_ll, i) - { + _LV_LL_READ(obj->child_ll, i) { cnt++; /*Count the child*/ cnt += lv_obj_count_children_recursive(i); /*recursively count children's children*/ } @@ -1805,14 +2250,16 @@ void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - const lv_style_t * style = lv_obj_get_style(obj); - if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width; + lv_border_side_t part = lv_obj_get_style_border_side(obj, LV_OBJ_PART_MAIN); + lv_coord_t w = lv_obj_get_style_border_width(obj, LV_OBJ_PART_MAIN); + + if(part & LV_BORDER_SIDE_LEFT) coords_p->x1 += w; - if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width; + if(part & LV_BORDER_SIDE_RIGHT) coords_p->x2 -= w; - if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width; + if(part & LV_BORDER_SIDE_TOP) coords_p->y1 += w; - if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width; + if(part & LV_BORDER_SIDE_BOTTOM) coords_p->y2 -= w; } /** @@ -1828,7 +2275,8 @@ lv_coord_t lv_obj_get_x(const lv_obj_t * obj) lv_obj_t * parent = lv_obj_get_parent(obj); if(parent) { rel_x = obj->coords.x1 - parent->coords.x1; - } else { + } + else { rel_x = obj->coords.x1; } return rel_x; @@ -1845,11 +2293,12 @@ lv_coord_t lv_obj_get_y(const lv_obj_t * obj) lv_coord_t rel_y; lv_obj_t * parent = lv_obj_get_parent(obj); - if(parent) { - rel_y = obj->coords.y1 - parent->coords.y1; - } else { - rel_y = obj->coords.y1; - } + if(parent) { + rel_y = obj->coords.y1 - parent->coords.y1; + } + else { + rel_y = obj->coords.y1; + } return rel_y; } @@ -1886,9 +2335,10 @@ lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - const lv_style_t * style = lv_obj_get_style(obj); + lv_style_int_t left = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN); + lv_style_int_t right = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN); - return lv_obj_get_width(obj) - style->body.padding.left - style->body.padding.right; + return lv_obj_get_width(obj) - left - right; } /** @@ -1900,15 +2350,86 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - const lv_style_t * style = lv_obj_get_style(obj); + lv_style_int_t top = lv_obj_get_style_pad_top((lv_obj_t *)obj, LV_OBJ_PART_MAIN); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom((lv_obj_t *)obj, LV_OBJ_PART_MAIN); + + return lv_obj_get_height(obj) - top - bottom; +} + +/** + * Get the height of an object by taking the top and bottom margin into account. + * The returned height will be `obj_h + margin_top + margin_bottom` + * @param obj pointer to an object + * @return the height including thee margins + */ +lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj) +{ + lv_style_int_t mtop = lv_obj_get_style_margin_top(obj, LV_OBJ_PART_MAIN); + lv_style_int_t mbottom = lv_obj_get_style_margin_bottom(obj, LV_OBJ_PART_MAIN); + + return lv_obj_get_height(obj) + mtop + mbottom; +} + +/** + * Get the width of an object by taking the left and right margin into account. + * The returned width will be `obj_w + margin_left + margin_right` + * @param obj pointer to an object + * @return the height including thee margins + */ +lv_coord_t lv_obj_get_width_margin(lv_obj_t * obj) +{ + lv_style_int_t mleft = lv_obj_get_style_margin_left(obj, LV_OBJ_PART_MAIN); + lv_style_int_t mright = lv_obj_get_style_margin_right(obj, LV_OBJ_PART_MAIN); + + return lv_obj_get_width(obj) + mleft + mright; +} + +/** + * Set that width reduced by the left and right padding of the parent. + * @param obj pointer to an object + * @param div indicates how many columns are assumed. + * If 1 the width will be set the parent's width + * If 2 only half parent width - inner padding of the parent + * If 3 only third parent width - 2 * inner padding of the parent + * @param span how many columns are combined + * @return the width according to the given parameters + */ +lv_coord_t lv_obj_get_width_grid(lv_obj_t * obj, uint8_t div, uint8_t span) +{ + lv_coord_t obj_w = lv_obj_get_width_fit(obj); + lv_style_int_t pinner = lv_obj_get_style_pad_inner(obj, LV_OBJ_PART_MAIN); + + lv_coord_t r = (obj_w - (div - 1) * pinner) / div; + + r = r * span + (span - 1) * pinner; + return r; +} + +/** + * Get that height reduced by the top and bottom padding of the parent. + * @param obj pointer to an object + * @param div indicates how many rows are assumed. + * If 1 the height will be set the parent's height + * If 2 only half parent height - inner padding of the parent + * If 3 only third parent height - 2 * inner padding of the parent + * @param span how many rows are combined + * @return the height according to the given parameters + */ +lv_coord_t lv_obj_get_height_grid(lv_obj_t * obj, uint8_t div, uint8_t span) +{ + lv_coord_t obj_h = lv_obj_get_height_fit(obj); + lv_style_int_t pinner = lv_obj_get_style_pad_inner(obj, LV_OBJ_PART_MAIN); + + lv_coord_t r = (obj_h - (div - 1) * pinner) / div; - return lv_obj_get_height(obj) - style->body.padding.top - style->body.padding.bottom; + r = r * span + (span - 1) * pinner; + return r; } /** * Get the automatic realign property of the object. * @param obj pointer to an object - * @return true: auto realign is enabled; false: auto realign is disabled + * @return true: auto realign is enabled; false: auto realign is disabled */ bool lv_obj_get_auto_realign(const lv_obj_t * obj) { @@ -2014,50 +2535,379 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj) * Appearance get *---------------*/ -/** - * Get the style pointer of an object (if NULL get style of the parent) - * @param obj pointer to an object - * @return pointer to a style - */ -const lv_style_t * lv_obj_get_style(const lv_obj_t * obj) +lv_style_list_t * lv_obj_get_style_list(const lv_obj_t * obj, uint8_t part) { - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + if(part == LV_OBJ_PART_MAIN) return &((lv_obj_t *)obj)->style_list; - const lv_style_t * style_act = obj->style_p; - if(style_act == NULL) { - lv_obj_t * par = obj->par; + lv_get_style_info_t info; + info.part = part; + info.result = NULL; - while(par) { - if(par->style_p) { - if(par->style_p->glass == 0) { -#if LV_USE_GROUP == 0 - style_act = par->style_p; -#else - /*If a parent is focused then use then focused style*/ - lv_group_t * g = lv_obj_get_group(par); - if(lv_group_get_focused(g) == par) { - style_act = lv_group_mod_style(g, par->style_p); - } else { - style_act = par->style_p; - } -#endif + lv_res_t res; + res = lv_signal_send((lv_obj_t *)obj, LV_SIGNAL_GET_STYLE, &info); + + if(res != LV_RES_OK) return NULL; + + return info.result; +} + +/** + * Get a style property of a part of an object in the object's current state. + * If there is a running transitions it is taken into account + * @param obj pointer to an object + * @param part the part of the object which style property should be get. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop the property to get. E.g. `LV_STYLE_BORDER_WIDTH`. + * The state of the object will be added internally + * @return the value of the property of the given part in the current state. + * If the property is not found a default value will be returned. + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_width()` + * @note for performance reasons it's not checked if the property really has integer type + */ +lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + lv_style_property_t prop_ori = prop; + + lv_style_attr_t attr; + attr = prop_ori >> 8; + + lv_style_int_t value_act; + lv_res_t res = LV_RES_INV; + const lv_obj_t * parent = obj; + while(parent) { + lv_style_list_t * list = lv_obj_get_style_list(parent, part); + if(!list->ignore_cache && list->style_cnt > 0) { + if(!list->valid_cache) update_style_cache((lv_obj_t *)parent, part, prop & (~LV_STYLE_STATE_MASK)); + + bool def = false; + switch(prop & (~LV_STYLE_STATE_MASK)) { + case LV_STYLE_CLIP_CORNER: + if(list->clip_corner_off) def = true; break; - } + case LV_STYLE_TEXT_LETTER_SPACE: + case LV_STYLE_TEXT_LINE_SPACE: + if(list->text_space_zero) def = true; + break; + case LV_STYLE_TRANSFORM_ANGLE: + case LV_STYLE_TRANSFORM_WIDTH: + case LV_STYLE_TRANSFORM_HEIGHT: + case LV_STYLE_TRANSFORM_ZOOM: + if(list->transform_all_zero) def = true; + break; + case LV_STYLE_BORDER_WIDTH: + if(list->border_width_zero) def = true; + break; + case LV_STYLE_BORDER_SIDE: + if(list->border_side_full) def = true; + break; + case LV_STYLE_BORDER_POST: + if(list->border_post_off) def = true; + break; + case LV_STYLE_OUTLINE_WIDTH: + if(list->outline_width_zero) def = true; + break; + case LV_STYLE_RADIUS: + if(list->radius_zero) def = true; + break; + case LV_STYLE_SHADOW_WIDTH: + if(list->shadow_width_zero) def = true; + break; + case LV_STYLE_PAD_TOP: + case LV_STYLE_PAD_BOTTOM: + case LV_STYLE_PAD_LEFT: + case LV_STYLE_PAD_RIGHT: + if(list->pad_all_zero) def = true; + break; + case LV_STYLE_MARGIN_TOP: + case LV_STYLE_MARGIN_BOTTOM: + case LV_STYLE_MARGIN_LEFT: + case LV_STYLE_MARGIN_RIGHT: + if(list->margin_all_zero) def = true; + break; + case LV_STYLE_BG_BLEND_MODE: + case LV_STYLE_BORDER_BLEND_MODE: + case LV_STYLE_IMAGE_BLEND_MODE: + case LV_STYLE_LINE_BLEND_MODE: + case LV_STYLE_OUTLINE_BLEND_MODE: + case LV_STYLE_PATTERN_BLEND_MODE: + case LV_STYLE_SHADOW_BLEND_MODE: + case LV_STYLE_TEXT_BLEND_MODE: + case LV_STYLE_VALUE_BLEND_MODE: + if(list->blend_mode_all_normal) def = true; + break; + case LV_STYLE_TEXT_DECOR: + if(list->text_decor_none) def = true; + break; + } + + if(def) { + break; } - par = par->par; } + + lv_state_t state = lv_obj_get_state(parent, part); + prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); + + res = _lv_style_list_get_int(list, prop, &value_act); + if(res == LV_RES_OK) return value_act; + + if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break; + + /*If not found, check the `MAIN` style first*/ + if(part != LV_OBJ_PART_MAIN) { + part = LV_OBJ_PART_MAIN; + continue; + } + + /*Check the parent too.*/ + parent = lv_obj_get_parent(parent); } -#if LV_USE_GROUP - if(obj->group_p) { - if(lv_group_get_focused(obj->group_p) == obj) { - style_act = lv_group_mod_style(obj->group_p, style_act); + + /*Handle unset values*/ + prop = prop & (~LV_STYLE_STATE_MASK); + switch(prop) { + case LV_STYLE_BORDER_SIDE: + return LV_BORDER_SIDE_FULL; + case LV_STYLE_SIZE: + return LV_DPI / 20; + case LV_STYLE_SCALE_WIDTH: + return LV_DPI / 8; + case LV_STYLE_BG_GRAD_STOP: + return 255; + case LV_STYLE_TRANSFORM_ZOOM: + return LV_IMG_ZOOM_NONE; + } + + return 0; +} + +/** + * Get a style property of a part of an object in the object's current state. + * If there is a running transitions it is taken into account + * @param obj pointer to an object + * @param part the part of the object which style property should be get. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop the property to get. E.g. `LV_STYLE_BORDER_COLOR`. + * The state of the object will be added internally + * @return the value of the property of the given part in the current state. + * If the property is not found a default value will be returned. + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_color()` + * @note for performance reasons it's not checked if the property really has color type + */ +lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + lv_style_property_t prop_ori = prop; + + lv_style_attr_t attr; + attr = prop_ori >> 8; + + lv_color_t value_act; + lv_res_t res = LV_RES_INV; + const lv_obj_t * parent = obj; + while(parent) { + lv_style_list_t * list = lv_obj_get_style_list(parent, part); + + lv_state_t state = lv_obj_get_state(parent, part); + prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); + + res = _lv_style_list_get_color(list, prop, &value_act); + if(res == LV_RES_OK) return value_act; + + if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break; + + /*If not found, check the `MAIN` style first*/ + if(part != LV_OBJ_PART_MAIN) { + part = LV_OBJ_PART_MAIN; + continue; + } + + /*Check the parent too.*/ + parent = lv_obj_get_parent(parent); + } + + /*Handle unset values*/ + prop = prop & (~LV_STYLE_STATE_MASK); + switch(prop) { + case LV_STYLE_BG_COLOR: + case LV_STYLE_BG_GRAD_COLOR: + return LV_COLOR_WHITE; + } + + return LV_COLOR_BLACK; +} + +/** + * Get a style property of a part of an object in the object's current state. + * If there is a running transitions it is taken into account + * @param obj pointer to an object + * @param part the part of the object which style property should be get. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop the property to get. E.g. `LV_STYLE_BORDER_OPA`. + * The state of the object will be added internally + * @return the value of the property of the given part in the current state. + * If the property is not found a default value will be returned. + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_opa()` + * @note for performance reasons it's not checked if the property really has opacity type + */ +lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + lv_style_property_t prop_ori = prop; + + lv_style_attr_t attr; + attr = prop_ori >> 8; + + lv_opa_t value_act; + lv_res_t res = LV_RES_INV; + const lv_obj_t * parent = obj; + while(parent) { + lv_style_list_t * list = lv_obj_get_style_list(parent, part); + + if(!list->ignore_cache && list->style_cnt > 0) { + if(!list->valid_cache) update_style_cache((lv_obj_t *)parent, part, prop & (~LV_STYLE_STATE_MASK)); + bool def = false; + switch(prop & (~LV_STYLE_STATE_MASK)) { + case LV_STYLE_OPA_SCALE: + if(list->opa_scale_cover) def = true; + break; + case LV_STYLE_BG_OPA: + if(list->bg_opa_cover) return LV_OPA_COVER; /*Special case, not the default value is used*/ + if(list->bg_opa_transp) def = true; + break; + case LV_STYLE_IMAGE_RECOLOR_OPA: + if(list->img_recolor_opa_transp) def = true; + break; + } + + if(def) { + break; + } + } + + lv_state_t state = lv_obj_get_state(parent, part); + prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); + + res = _lv_style_list_get_opa(list, prop, &value_act); + if(res == LV_RES_OK) return value_act; + + if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break; + + /*If not found, check the `MAIN` style first*/ + if(part != LV_OBJ_PART_MAIN) { + part = LV_OBJ_PART_MAIN; + continue; + } + + /*Check the parent too.*/ + parent = lv_obj_get_parent(parent); + } + + /*Handle unset values*/ + prop = prop & (~LV_STYLE_STATE_MASK); + switch(prop) { + case LV_STYLE_BG_OPA: + case LV_STYLE_IMAGE_RECOLOR_OPA: + case LV_STYLE_PATTERN_RECOLOR_OPA: + return LV_OPA_TRANSP; + } + + return LV_OPA_COVER; +} + +/** + * Get a style property of a part of an object in the object's current state. + * If there is a running transitions it is taken into account + * @param obj pointer to an object + * @param part the part of the object which style property should be get. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @param prop the property to get. E.g. `LV_STYLE_TEXT_FONT`. + * The state of the object will be added internally + * @return the value of the property of the given part in the current state. + * If the property is not found a default value will be returned. + * @note shouldn't be used directly. Use the specific property get functions instead. + * For example: `lv_obj_style_get_border_opa()` + * @note for performance reasons it's not checked if the property really has pointer type + */ +const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + lv_style_property_t prop_ori = prop; + + lv_style_attr_t attr; + attr = prop_ori >> 8; + + const void * value_act; + lv_res_t res = LV_RES_INV; + const lv_obj_t * parent = obj; + while(parent) { + lv_style_list_t * list = lv_obj_get_style_list(parent, part); + + if(!list->ignore_cache && list->style_cnt > 0) { + if(!list->valid_cache) update_style_cache((lv_obj_t *)parent, part, prop & (~LV_STYLE_STATE_MASK)); + bool def = false; + switch(prop & (~LV_STYLE_STATE_MASK)) { + case LV_STYLE_VALUE_STR: + if(list->value_txt_str) def = true; + break; + case LV_STYLE_PATTERN_IMAGE: + if(list->pattern_img_null) def = true; + break; + case LV_STYLE_TEXT_FONT: + if(list->text_font_normal) def = true; + break; + } + + if(def) { + break; + } + } + + lv_state_t state = lv_obj_get_state(parent, part); + prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS); + + res = _lv_style_list_get_ptr(list, prop, &value_act); + if(res == LV_RES_OK) return value_act; + + if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break; + + /*If not found, check the `MAIN` style first*/ + if(part != LV_OBJ_PART_MAIN) { + part = LV_OBJ_PART_MAIN; + continue; } + + /*Check the parent too.*/ + parent = lv_obj_get_parent(parent); } + + /*Handle unset values*/ + prop = prop & (~LV_STYLE_STATE_MASK); + switch(prop) { + case LV_STYLE_TEXT_FONT: + case LV_STYLE_VALUE_FONT: + return lv_theme_get_font_normal(); +#if LV_USE_ANIMATION + case LV_STYLE_TRANSITION_PATH: + return &lv_anim_path_def; #endif + } - if(style_act == NULL) style_act = &lv_style_plain; + return NULL; +} - return style_act; +/** + * Get the local style of a part of an object. + * @param obj pointer to an object + * @param part the part of the object which style property should be set. + * E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB` + * @return pointer to the local style if exists else `NULL`. + */ +lv_style_t * lv_obj_get_local_style(lv_obj_t * obj, uint8_t part) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + lv_style_list_t * style_list = lv_obj_get_style_list(obj, part); + return lv_style_list_get_local_style(style_list); } /*----------------- @@ -2076,6 +2926,18 @@ bool lv_obj_get_hidden(const lv_obj_t * obj) return obj->hidden == 0 ? false : true; } +/** + * Get whether advanced hit-testing is enabled on an object + * @param obj pointer to an object + * @return true: advanced hit-testing is enabled + */ +bool lv_obj_get_adv_hittest(const lv_obj_t * obj) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + return obj->adv_hittest == 0 ? false : true; +} + /** * Get the click enable attribute of an object * @param obj pointer to an object @@ -2091,7 +2953,7 @@ bool lv_obj_get_click(const lv_obj_t * obj) /** * Get the top enable attribute of an object * @param obj pointer to an object - * @return true: the auto top feture is enabled + * @return true: the auto top feature is enabled */ bool lv_obj_get_top(const lv_obj_t * obj) { @@ -2103,7 +2965,7 @@ bool lv_obj_get_top(const lv_obj_t * obj) /** * Get the drag enable attribute of an object * @param obj pointer to an object - * @return true: the object is dragable + * @return true: the object is draggable */ bool lv_obj_get_drag(const lv_obj_t * obj) { @@ -2146,6 +3008,26 @@ bool lv_obj_get_drag_parent(const lv_obj_t * obj) return obj->drag_parent == 0 ? false : true; } +/** +* Get the gesture parent attribute of an object +* @param obj pointer to an object +* @return true: gesture parent is enabled +*/ +bool lv_obj_get_gesture_parent(const lv_obj_t * obj) +{ + return obj->gesture_parent == 0 ? false : true; +} + +/** +* Get the focus parent attribute of an object +* @param obj pointer to an object +* @return true: focus parent is enabled +*/ +bool lv_obj_get_focus_parent(const lv_obj_t * obj) +{ + return obj->focus_parent == 0 ? false : true; +} + /** * Get the drag parent attribute of an object * @param obj pointer to an object @@ -2158,9 +3040,10 @@ bool lv_obj_get_parent_event(const lv_obj_t * obj) return obj->parent_event == 0 ? false : true; } - lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj) { + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + #if LV_USE_BIDI const lv_obj_t * parent = obj; @@ -2177,38 +3060,6 @@ lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj) #endif } - -/** - * Get the opa scale enable parameter - * @param obj pointer to an object - * @return true: opa scaling is enabled for this object and all children; false: no opa scaling - */ -lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj) -{ - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - - return obj->opa_scale_en == 0 ? false : true; -} - -/** - * Get the opa scale parameter of an object - * @param obj pointer to an object - * @return opa scale [0..255] - */ -lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj) -{ - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - - const lv_obj_t * parent = obj; - - while(parent) { - if(parent->opa_scale_en) return parent->opa_scale; - parent = lv_obj_get_parent(parent); - } - - return LV_OPA_COVER; -} - /** * Get the protect field of an object * @param obj pointer to an object @@ -2234,6 +3085,24 @@ bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot) return (obj->protect & prot) == 0 ? false : true; } +lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part) +{ + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + if(part < _LV_OBJ_PART_REAL_LAST) return ((lv_obj_t *)obj)->state; + + /*If a real part is asked, then use the object's signal to get its state. + * A real object can be in different state then the main part + * and only the object itself knows who to get it's state. */ + lv_get_state_info_t info; + info.part = part; + info.result = LV_STATE_DEFAULT; + lv_signal_send((lv_obj_t *)obj, LV_SIGNAL_GET_STATE_DSC, &info); + + return info.result; + +} + /** * Get the signal function of an object * @param obj pointer to an object @@ -2300,8 +3169,8 @@ void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf) lv_obj_type_t tmp; - memset(buf, 0, sizeof(lv_obj_type_t)); - memset(&tmp, 0, sizeof(lv_obj_type_t)); + _lv_memset_00(buf, sizeof(lv_obj_type_t)); + _lv_memset_00(&tmp, sizeof(lv_obj_type_t)); obj->signal_cb((lv_obj_t *)obj, LV_SIGNAL_GET_TYPE, &tmp); @@ -2352,11 +3221,10 @@ void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t)); + _lv_memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t)); } #endif -#if LV_USE_GROUP /** * Get the group of the object * @param obj pointer to an object @@ -2366,7 +3234,12 @@ void * lv_obj_get_group(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); +#if LV_USE_GROUP return obj->group_p; +#else + LV_UNUSED(obj); + return NULL; +#endif } /** @@ -2378,19 +3251,74 @@ bool lv_obj_is_focused(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); +#if LV_USE_GROUP if(obj->group_p) { if(lv_group_get_focused(obj->group_p) == obj) return true; } - return false; -} +#else + LV_UNUSED(obj); + return false; #endif - +} /*------------------- * OTHER FUNCTIONS *------------------*/ +/** + * Check if a given screen-space point is on an object's coordinates. + * + * This method is intended to be used mainly by advanced hit testing algorithms to check + * whether the point is even within the object (as an optimization). + * @param obj object to check + * @param point screen-space point + */ +bool lv_obj_is_point_on_coords(lv_obj_t * obj, const lv_point_t * point) +{ +#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY + lv_area_t ext_area; + ext_area.x1 = obj->coords.x1 - obj->ext_click_pad_hor; + ext_area.x2 = obj->coords.x2 + obj->ext_click_pad_hor; + ext_area.y1 = obj->coords.y1 - obj->ext_click_pad_ver; + ext_area.y2 = obj->coords.y2 + obj->ext_click_pad_ver; + + if(!_lv_area_is_point_on(&ext_area, point, 0)) { +#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL + lv_area_t ext_area; + ext_area.x1 = obj->coords.x1 - obj->ext_click_pad.x1; + ext_area.x2 = obj->coords.x2 + obj->ext_click_pad.x2; + ext_area.y1 = obj->coords.y1 - obj->ext_click_pad.y1; + ext_area.y2 = obj->coords.y2 + obj->ext_click_pad.y2; + + if(!_lv_area_is_point_on(&ext_area, point, 0)) { +#else + if(!_lv_area_is_point_on(&obj->coords, point, 0)) { +#endif + return false; + } + return true; +} + +/** + * Hit-test an object given a particular point in screen space. + * @param obj object to hit-test + * @param point screen-space point + * @return true if the object is considered under the point + */ +bool lv_obj_hittest(lv_obj_t * obj, lv_point_t * point) +{ + if(obj->adv_hittest) { + lv_hit_test_info_t hit_info; + hit_info.point = point; + hit_info.result = true; + obj->signal_cb(obj, LV_SIGNAL_HIT_TEST, &hit_info); + return hit_info.result; + } + else + return lv_obj_is_point_on_coords(obj, point); +} + /** * Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal * @param obj pointer to an object @@ -2409,241 +3337,1497 @@ lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name) return LV_RES_OK; } -/********************** - * STATIC FUNCTIONS - **********************/ - -static void lv_obj_del_async_cb(void * obj) -{ - LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - - lv_obj_del(obj); -} - /** - * Handle the drawing related tasks of the base objects. + * Initialize a rectangle descriptor from an object's styles * @param obj pointer to an object - * @param mask the object will be drawn only in this area - * @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area - * (return 'true' if yes) - * LV_DESIGN_DRAW: draw the object (always return 'true') - * @param return true/false, depends on 'mode' + * @param type type of style. E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_STYLE_REL` or `LV_PAGE_STYLE_SCRL` + * @param draw_dsc the descriptor the initialize + * @note Only the relevant fields will be set. + * E.g. if `border width == 0` the other border properties won't be evaluated. */ -static bool lv_obj_design(lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode) +void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t * draw_dsc) { - if(mode == LV_DESIGN_COVER_CHK) { - - /*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/ - if(lv_area_is_in(mask_p, &obj->coords) == false) return false; - - /*Can cover the area only if fully solid (no opacity)*/ - const lv_style_t * style = lv_obj_get_style(obj); - if(style->body.opa < LV_OPA_MAX) return false; + draw_dsc->radius = lv_obj_get_style_radius(obj, part); + +#if LV_USE_OPA_SCALE + lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part); + if(opa_scale <= LV_OPA_MIN) { + draw_dsc->bg_opa = LV_OPA_TRANSP; + draw_dsc->border_opa = LV_OPA_TRANSP; + draw_dsc->shadow_opa = LV_OPA_TRANSP; + draw_dsc->pattern_opa = LV_OPA_TRANSP; + draw_dsc->value_opa = LV_OPA_TRANSP; + return; + } +#endif - /* Because of the radius it is not sure the area is covered - * Check the areas where there is no radius*/ - lv_coord_t r = style->body.radius; + if(draw_dsc->bg_opa != LV_OPA_TRANSP) { + draw_dsc->bg_opa = lv_obj_get_style_bg_opa(obj, part); + if(draw_dsc->bg_opa > LV_OPA_MIN) { + draw_dsc->bg_color = lv_obj_get_style_bg_color(obj, part); + draw_dsc->bg_grad_dir = lv_obj_get_style_bg_grad_dir(obj, part); + if(draw_dsc->bg_grad_dir != LV_GRAD_DIR_NONE) { + draw_dsc->bg_grad_color = lv_obj_get_style_bg_grad_color(obj, part); + draw_dsc->bg_main_color_stop = lv_obj_get_style_bg_main_stop(obj, part); + draw_dsc->bg_grad_color_stop = lv_obj_get_style_bg_grad_stop(obj, part); + } - if(r == LV_RADIUS_CIRCLE) return false; +#if LV_USE_BLEND_MODES + draw_dsc->bg_blend_mode = lv_obj_get_style_bg_blend_mode(obj, part); +#endif + } + } - lv_area_t area_tmp; + draw_dsc->border_width = lv_obj_get_style_border_width(obj, part); + if(draw_dsc->border_width) { + if(draw_dsc->border_opa != LV_OPA_TRANSP) { + draw_dsc->border_opa = lv_obj_get_style_border_opa(obj, part); + if(draw_dsc->border_opa > LV_OPA_MIN) { + draw_dsc->border_side = lv_obj_get_style_border_side(obj, part); + draw_dsc->border_color = lv_obj_get_style_border_color(obj, part); + } +#if LV_USE_BLEND_MODES + draw_dsc->border_blend_mode = lv_obj_get_style_border_blend_mode(obj, part); +#endif + } + } - /*Check horizontally without radius*/ - lv_obj_get_coords(obj, &area_tmp); - area_tmp.x1 += r; - area_tmp.x2 -= r; - if(lv_area_is_in(mask_p, &area_tmp) == false) return false; +#if LV_USE_OUTLINE + draw_dsc->outline_width = lv_obj_get_style_outline_width(obj, part); + if(draw_dsc->outline_width) { + if(draw_dsc->outline_opa != LV_OPA_TRANSP) { + draw_dsc->outline_opa = lv_obj_get_style_outline_opa(obj, part); + if(draw_dsc->outline_opa > LV_OPA_MIN) { + draw_dsc->outline_pad = lv_obj_get_style_outline_pad(obj, part); + draw_dsc->outline_color = lv_obj_get_style_outline_color(obj, part); + } +#if LV_USE_BLEND_MODES + draw_dsc->outline_blend_mode = lv_obj_get_style_outline_blend_mode(obj, part); +#endif + } + } +#endif - /*Check vertically without radius*/ - lv_obj_get_coords(obj, &area_tmp); - area_tmp.y1 += r; - area_tmp.y2 -= r; - if(lv_area_is_in(mask_p, &area_tmp) == false) return false; +#if LV_USE_PATTERN + draw_dsc->pattern_image = lv_obj_get_style_pattern_image(obj, part); + if(draw_dsc->pattern_image) { + if(draw_dsc->pattern_opa != LV_OPA_TRANSP) { + draw_dsc->pattern_opa = lv_obj_get_style_pattern_opa(obj, part); + if(draw_dsc->pattern_opa > LV_OPA_MIN) { + draw_dsc->pattern_recolor_opa = lv_obj_get_style_pattern_recolor_opa(obj, part); + draw_dsc->pattern_repeat = lv_obj_get_style_pattern_repeat(obj, part); + if(lv_img_src_get_type(draw_dsc->pattern_image) == LV_IMG_SRC_SYMBOL) { + draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part); + draw_dsc->pattern_font = lv_obj_get_style_text_font(obj, part); + } + else if(draw_dsc->pattern_recolor_opa > LV_OPA_MIN) { + draw_dsc->pattern_recolor = lv_obj_get_style_pattern_recolor(obj, part); + } +#if LV_USE_BLEND_MODES + draw_dsc->pattern_blend_mode = lv_obj_get_style_pattern_blend_mode(obj, part); +#endif + } + } + } +#endif - } else if(mode == LV_DESIGN_DRAW_MAIN) { - const lv_style_t * style = lv_obj_get_style(obj); - lv_draw_rect(&obj->coords, mask_p, style, lv_obj_get_opa_scale(obj)); +#if LV_USE_SHADOW + draw_dsc->shadow_width = lv_obj_get_style_shadow_width(obj, part); + if(draw_dsc->shadow_width) { + if(draw_dsc->shadow_opa > LV_OPA_MIN) { + draw_dsc->shadow_opa = lv_obj_get_style_shadow_opa(obj, part); + if(draw_dsc->shadow_opa > LV_OPA_MIN) { + draw_dsc->shadow_ofs_x = lv_obj_get_style_shadow_ofs_x(obj, part); + draw_dsc->shadow_ofs_y = lv_obj_get_style_shadow_ofs_y(obj, part); + draw_dsc->shadow_spread = lv_obj_get_style_shadow_spread(obj, part); + draw_dsc->shadow_color = lv_obj_get_style_shadow_color(obj, part); +#if LV_USE_BLEND_MODES + draw_dsc->shadow_blend_mode = lv_obj_get_style_shadow_blend_mode(obj, part); +#endif + } + } } +#endif - return true; -} +#if LV_USE_VALUE_STR + draw_dsc->value_str = lv_obj_get_style_value_str(obj, part); + if(draw_dsc->value_str) { + if(draw_dsc->value_opa > LV_OPA_MIN) { + draw_dsc->value_opa = lv_obj_get_style_value_opa(obj, part); + if(draw_dsc->value_opa > LV_OPA_MIN) { + draw_dsc->value_ofs_x = lv_obj_get_style_value_ofs_x(obj, part); + draw_dsc->value_ofs_y = lv_obj_get_style_value_ofs_y(obj, part); + draw_dsc->value_color = lv_obj_get_style_value_color(obj, part); + draw_dsc->value_font = lv_obj_get_style_value_font(obj, part); + draw_dsc->value_letter_space = lv_obj_get_style_value_letter_space(obj, part); + draw_dsc->value_line_space = lv_obj_get_style_value_line_space(obj, part); + draw_dsc->value_align = lv_obj_get_style_value_align(obj, part); +#if LV_USE_BLEND_MODES + draw_dsc->value_blend_mode = lv_obj_get_style_value_blend_mode(obj, part); +#endif + } + } + } +#endif + +#if LV_USE_OPA_SCALE + if(opa_scale < LV_OPA_MAX) { + draw_dsc->bg_opa = (uint16_t)((uint16_t)draw_dsc->bg_opa * opa_scale) >> 8; + draw_dsc->border_opa = (uint16_t)((uint16_t)draw_dsc->border_opa * opa_scale) >> 8; + draw_dsc->shadow_opa = (uint16_t)((uint16_t)draw_dsc->shadow_opa * opa_scale) >> 8; + draw_dsc->pattern_opa = (uint16_t)((uint16_t)draw_dsc->pattern_opa * opa_scale) >> 8; + draw_dsc->value_opa = (uint16_t)((uint16_t)draw_dsc->value_opa * opa_scale) >> 8; + } +#endif +} + +void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_t * draw_dsc) +{ + draw_dsc->opa = lv_obj_get_style_text_opa(obj, part); + if(draw_dsc->opa <= LV_OPA_MIN) return; + +#if LV_USE_OPA_SCALE + lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part); + if(opa_scale < LV_OPA_MAX) { + draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; +#endif + + draw_dsc->color = lv_obj_get_style_text_color(obj, part); + draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part); + draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part); + draw_dsc->decor = lv_obj_get_style_text_decor(obj, part); +#if LV_USE_BLEND_MODES + draw_dsc->blend_mode = lv_obj_get_style_text_blend_mode(obj, part); +#endif + + draw_dsc->font = lv_obj_get_style_text_font(obj, part); + + if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) { + draw_dsc->sel_color = lv_obj_get_style_text_sel_color(obj, part); + draw_dsc->sel_bg_color = lv_obj_get_style_text_sel_bg_color(obj, part); + } + +#if LV_USE_BIDI + draw_dsc->bidi_dir = lv_obj_get_base_dir(obj); +#endif +} + +void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint8_t part, lv_draw_img_dsc_t * draw_dsc) +{ + draw_dsc->opa = lv_obj_get_style_image_opa(obj, part); + if(draw_dsc->opa <= LV_OPA_MIN) return; + +#if LV_USE_OPA_SCALE + lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part); + if(opa_scale < LV_OPA_MAX) { + draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; +#endif + + draw_dsc->angle = 0; + draw_dsc->zoom = LV_IMG_ZOOM_NONE; + draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2; + draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2; + + draw_dsc->recolor_opa = lv_obj_get_style_image_recolor_opa(obj, part); + if(draw_dsc->recolor_opa > 0) { + draw_dsc->recolor = lv_obj_get_style_image_recolor(obj, part); + } +#if LV_USE_BLEND_MODES + draw_dsc->blend_mode = lv_obj_get_style_image_blend_mode(obj, part); +#endif +} + +void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t * draw_dsc) +{ + draw_dsc->width = lv_obj_get_style_line_width(obj, part); + if(draw_dsc->width == 0) return; + + draw_dsc->opa = lv_obj_get_style_line_opa(obj, part); + if(draw_dsc->opa <= LV_OPA_MIN) return; + +#if LV_USE_OPA_SCALE + lv_opa_t opa_scale = lv_obj_get_style_opa_scale(obj, part); + if(opa_scale < LV_OPA_MAX) { + draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; +#endif + + draw_dsc->color = lv_obj_get_style_line_color(obj, part); + + draw_dsc->dash_width = lv_obj_get_style_line_dash_width(obj, part); + if(draw_dsc->dash_width) { + draw_dsc->dash_gap = lv_obj_get_style_line_dash_gap(obj, part); + } + + draw_dsc->round_start = lv_obj_get_style_line_rounded(obj, part); + draw_dsc->round_end = draw_dsc->round_start; + +#if LV_USE_BLEND_MODES + draw_dsc->blend_mode = lv_obj_get_style_line_blend_mode(obj, part); +#endif +} /** - * Signal function of the basic object + * Get the required extra size (around the object's part) to draw shadow, outline, value etc. * @param obj pointer to an object - * @param sign signal type - * @param param parameter for the signal (depends on signal type) - * @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted + * @param part part of the object */ -static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) +lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part) { - if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME); + lv_coord_t s = 0; + + lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part); + if(sh_width) { + lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part); + if(sh_opa > LV_OPA_MIN) { + sh_width = sh_width / 2; /*THe blur adds only half width*/ + sh_width++; + sh_width += lv_obj_get_style_shadow_spread(obj, part); + lv_style_int_t sh_ofs_x = lv_obj_get_style_shadow_ofs_x(obj, part); + lv_style_int_t sh_ofs_y = lv_obj_get_style_shadow_ofs_y(obj, part); + sh_width += LV_MATH_MAX(LV_MATH_ABS(sh_ofs_x), LV_MATH_ABS(sh_ofs_y)); + s = LV_MATH_MAX(s, sh_width); + } + } - lv_res_t res = LV_RES_OK; + const char * value_str = lv_obj_get_style_value_str(obj, part); + if(value_str) { + lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part); + if(value_opa > LV_OPA_MIN) { + lv_style_int_t letter_space = lv_obj_get_style_value_letter_space(obj, part); + lv_style_int_t line_space = lv_obj_get_style_value_letter_space(obj, part); + const lv_font_t * font = lv_obj_get_style_value_font(obj, part); + + lv_point_t txt_size; + _lv_txt_get_size(&txt_size, value_str, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE); + + lv_area_t value_area; + value_area.x1 = 0; + value_area.y1 = 0; + value_area.x2 = txt_size.x - 1; + value_area.y2 = txt_size.y - 1; + + lv_style_int_t align = lv_obj_get_style_value_align(obj, part); + lv_style_int_t xofs = lv_obj_get_style_value_ofs_x(obj, part); + lv_style_int_t yofs = lv_obj_get_style_value_ofs_y(obj, part); + lv_point_t p_align; + _lv_area_align(&obj->coords, &value_area, align, &p_align); + + value_area.x1 += p_align.x + xofs; + value_area.y1 += p_align.y + yofs; + value_area.x2 += p_align.x + xofs; + value_area.y2 += p_align.y + yofs; + + s = LV_MATH_MAX(s, obj->coords.x1 - value_area.x1); + s = LV_MATH_MAX(s, obj->coords.y1 - value_area.y1); + s = LV_MATH_MAX(s, value_area.x2 - obj->coords.x2); + s = LV_MATH_MAX(s, value_area.y2 - obj->coords.y2); + } + } - if(sign == LV_SIGNAL_CHILD_CHG) { - /*Return 'invalid' if the child change signal is not enabled*/ - if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV; - } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { - const lv_style_t * style = lv_obj_get_style(obj); - if(style->body.shadow.width > obj->ext_draw_pad) obj->ext_draw_pad = style->body.shadow.width; - } else if(sign == LV_SIGNAL_STYLE_CHG) { - lv_obj_refresh_ext_draw_pad(obj); + lv_style_int_t outline_width = lv_obj_get_style_outline_width(obj, part); + if(outline_width) { + lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part); + if(outline_opa > LV_OPA_MIN) { + lv_style_int_t outline_pad = lv_obj_get_style_outline_pad(obj, part); + s = LV_MATH_MAX(s, outline_pad + outline_width); + } } - return res; + + lv_coord_t w = lv_obj_get_style_transform_width(obj, part); + lv_coord_t h = lv_obj_get_style_transform_height(obj, part); + lv_coord_t wh = LV_MATH_MAX(w, h); + if(wh > 0) s += wh; + + return s; } /** - * Reposition the children of an object. (Called recursively) - * @param obj pointer to an object which children will be repositioned - * @param x_diff x coordinate shift - * @param y_diff y coordinate shift + * Fade in (from transparent to fully cover) an object and all its children using an `opa_scale` animation. + * @param obj the object to fade in + * @param time duration of the animation [ms] + * @param delay wait before the animation starts [ms] */ -static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff) +void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay) { - lv_obj_t * i; - LV_LL_READ(obj->child_ll, i) - { - i->coords.x1 += x_diff; - i->coords.y1 += y_diff; - i->coords.x2 += x_diff; - i->coords.y2 += y_diff; +#if LV_USE_ANIMATION + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_var(&a, obj); + lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER); + lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)opa_scale_anim); + lv_anim_set_ready_cb(&a, fade_in_anim_ready); + lv_anim_set_time(&a, time); + lv_anim_set_delay(&a, delay); + lv_anim_start(&a); +#else + (void) obj; /*Unused*/ + (void) time; /*Unused*/ + (void) delay; /*Unused*/ +#endif +} - refresh_children_position(i, x_diff, y_diff); - } +/** + * Fade out (from fully cover to transparent) an object and all its children using an `opa_scale` animation. + * @param obj the object to fade in + * @param time duration of the animation [ms] + * @param delay wait before the animation starts [ms] + */ +void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay) +{ +#if LV_USE_ANIMATION + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_var(&a, obj); + lv_anim_set_values(&a, LV_OPA_COVER, LV_OPA_TRANSP); + lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)opa_scale_anim); + lv_anim_set_time(&a, time); + lv_anim_set_delay(&a, delay); + lv_anim_start(&a); +#else + (void) obj; /*Unused*/ + (void) time; /*Unused*/ + (void) delay; /*Unused*/ +#endif } /** - * Refresh the style of all children of an object. (Called recursively) - * @param style_p refresh objects only with this style. + * Check if any object has a given type * @param obj pointer to an object + * @param obj_type type of the object. (e.g. "lv_btn") + * @return true: valid */ -static void report_style_mod_core(void * style_p, lv_obj_t * obj) +bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type) { - lv_obj_t * i; - LV_LL_READ(obj->child_ll, i) - { - if(i->style_p == style_p || style_p == NULL) { - refresh_children_style(i); - lv_obj_refresh_style(i); - } + if(obj_type[0] == '\0') return true; + + lv_obj_type_t types; + lv_obj_get_type((lv_obj_t *)obj, &types); - report_style_mod_core(style_p, i); + uint8_t i; + for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) { + if(types.type[i] == NULL) break; + if(strcmp(types.type[i], obj_type) == 0) return true; } + + return false; } /** - * Recursively refresh the style of the children. Go deeper until a not NULL style is found - * because the NULL styles are inherited from the parent + * Check if any object is still "alive", and part of the hierarchy * @param obj pointer to an object + * @param obj_type type of the object. (e.g. "lv_btn") + * @return true: valid */ -static void refresh_children_style(lv_obj_t * obj) +bool lv_debug_check_obj_valid(const lv_obj_t * obj) { - lv_obj_t * child = lv_obj_get_child(obj, NULL); - while(child != NULL) { - if(child->style_p == NULL) { - refresh_children_style(child); /*Check children too*/ - lv_obj_refresh_style(child); /*Notify the child about the style change*/ - } else if(child->style_p->glass) { - /*Children with 'glass' parent might be effected if their style == NULL*/ - refresh_children_style(child); + lv_disp_t * disp = lv_disp_get_next(NULL); + while(disp) { + lv_obj_t * scr; + _LV_LL_READ(disp->scr_ll, scr) { + + if(scr == obj) return true; + bool found = obj_valid_child(scr, obj); + if(found) return true; } - child = lv_obj_get_child(obj, child); + + disp = lv_disp_get_next(disp); } + + return false; } -/** - * Called by 'lv_obj_del' to delete the children objects - * @param obj pointer to an object (all of its children will be deleted) - */ -static void delete_children(lv_obj_t * obj) +/********************** + * STATIC FUNCTIONS + **********************/ + +static void lv_obj_del_async_cb(void * obj) { - lv_obj_t * i; - lv_obj_t * i_next; - i = lv_ll_get_head(&(obj->child_ll)); + LV_ASSERT_OBJ(obj, LV_OBJX_NAME); + + lv_obj_del(obj); +} + +static void obj_del_core(lv_obj_t * obj) +{ + /*Let the user free the resources used in `LV_EVENT_DELETE`*/ + lv_event_send(obj, LV_EVENT_DELETE, NULL); - /*Remove from the group; remove before transversing children so that - * the object still has access to all children during the - * LV_SIGNAL_DEFOCUS call*/ + /*Delete from the group*/ #if LV_USE_GROUP lv_group_t * group = lv_obj_get_group(obj); if(group) lv_group_remove_obj(obj); #endif - while(i != NULL) { - /*Get the next object before delete this*/ - i_next = lv_ll_get_next(&(obj->child_ll), i); + /*Delete the user data*/ +#if LV_USE_USER_DATA +#if LV_USE_USER_DATA_FREE + LV_USER_DATA_FREE(obj); +#endif +#endif - /*Call the recursive del to the child too*/ - delete_children(i); + /*Recursively delete the children*/ + lv_obj_t * i; + i = _lv_ll_get_head(&(obj->child_ll)); + while(i != NULL) { + /*Call the recursive delete to the child too*/ + obj_del_core(i); - /*Set i to the next node*/ - i = i_next; + /*Set i to the new head node*/ + i = _lv_ll_get_head(&(obj->child_ll)); } - /*Let the suer free the resources used in `LV_EVENT_DELETE`*/ - lv_event_send(obj, LV_EVENT_DELETE, NULL); - - lv_event_mark_deleted(obj); - /*Remove the animations from this object*/ #if LV_USE_ANIMATION lv_anim_del(obj, NULL); + trans_del(obj, 0xFF, 0xFF, NULL); #endif - /* Reset the input devices if - * the object to delete is used*/ + lv_event_mark_deleted(obj); + + /* Reset all input devices if the object to delete is used*/ lv_indev_t * indev = lv_indev_get_next(NULL); while(indev) { if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) { - lv_indev_reset(indev); + lv_indev_reset(indev, obj); } - if(indev->proc.types.pointer.last_pressed == obj) { indev->proc.types.pointer.last_pressed = NULL; } + #if LV_USE_GROUP if(indev->group == group && obj == lv_indev_get_obj_act()) { - lv_indev_reset(indev); + lv_indev_reset(indev, obj); } #endif indev = lv_indev_get_next(indev); } - /* Clean up the object specific data*/ + /* All children deleted. + * Now clean up the object specific data*/ obj->signal_cb(obj, LV_SIGNAL_CLEANUP, NULL); /*Remove the object from parent's children list*/ lv_obj_t * par = lv_obj_get_parent(obj); - lv_ll_rem(&(par->child_ll), obj); + if(par == NULL) { /*It is a screen*/ + lv_disp_t * d = lv_obj_get_disp(obj); + _lv_ll_remove(&d->scr_ll, obj); + } + else { + _lv_ll_remove(&(par->child_ll), obj); + } /*Delete the base objects*/ if(obj->ext_attr != NULL) lv_mem_free(obj->ext_attr); lv_mem_free(obj); /*Free the object itself*/ } -static void base_dir_refr_children(lv_obj_t * obj) +/** + * Handle the drawing related tasks of the base objects. + * @param obj pointer to an object + * @param clip_area the object will be drawn only in this area + * @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area + * (return 'true' if yes) + * LV_DESIGN_DRAW: draw the object (always return 'true') + * @param return an element of `lv_design_res_t` + */ +static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode) { - lv_obj_t * child; - child = lv_obj_get_child(obj, NULL); + if(mode == LV_DESIGN_COVER_CHK) { + if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) return LV_DESIGN_RES_MASKED; - while(child) { - if(child->base_dir == LV_BIDI_DIR_INHERIT) { - lv_signal_send(child, LV_SIGNAL_BASE_DIR_CHG, NULL); - base_dir_refr_children(child); + /*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/ + lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN); + lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN); + lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN); + lv_area_t coords; + lv_area_copy(&coords, &obj->coords); + coords.x1 -= w; + coords.x2 += w; + coords.y1 -= h; + coords.y2 += h; + + if(_lv_area_is_in(clip_area, &coords, r) == false) return LV_DESIGN_RES_NOT_COVER; + + if(lv_obj_get_style_bg_opa(obj, LV_OBJ_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER; + + if(lv_obj_get_style_bg_blend_mode(obj, LV_OBJ_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER; + if(lv_obj_get_style_border_blend_mode(obj, LV_OBJ_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER; + if(lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER; + + return LV_DESIGN_RES_COVER; + + } + else if(mode == LV_DESIGN_DRAW_MAIN) { + lv_draw_rect_dsc_t draw_dsc; + lv_draw_rect_dsc_init(&draw_dsc); + /*If the border is drawn later disable loading its properties*/ + if(lv_obj_get_style_border_post(obj, LV_OBJ_PART_MAIN)) { + draw_dsc.border_post = 1; } - child = lv_obj_get_child(obj, child); + lv_obj_init_draw_rect_dsc(obj, LV_OBJ_PART_MAIN, &draw_dsc); + + lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN); + lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN); + lv_area_t coords; + lv_area_copy(&coords, &obj->coords); + coords.x1 -= w; + coords.x2 += w; + coords.y1 -= h; + coords.y2 += h; + + lv_draw_rect(&coords, clip_area, &draw_dsc); + + if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) { + lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t)); + + lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN); + /* If it has border make the clip area 1 px smaller to avoid color bleeding + * The border will cover the minimal issue on the edges*/ + if(draw_dsc.border_post && draw_dsc.border_opa >= LV_OPA_MIN && draw_dsc.border_width > 0) { + lv_area_t cc_area; + cc_area.x1 = obj->coords.x1 + 1; + cc_area.y1 = obj->coords.y1 + 1; + cc_area.x2 = obj->coords.x2 - 1; + cc_area.y2 = obj->coords.y2 - 1; + lv_draw_mask_radius_init(mp, &cc_area, r, false); + } + /*If no border use the full size.*/ + else { + lv_draw_mask_radius_init(mp, &obj->coords, r, false); + } + + /*Add the mask and use `obj+8` as custom id. Don't use `obj` directly because it might be used by the user*/ + lv_draw_mask_add(mp, obj + 8); + } + } + else if(mode == LV_DESIGN_DRAW_POST) { + if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) { + lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(obj + 8); + _lv_mem_buf_release(param); + } + + /*If the border is drawn later disable loading other properties*/ + if(lv_obj_get_style_border_post(obj, LV_OBJ_PART_MAIN)) { + lv_draw_rect_dsc_t draw_dsc; + lv_draw_rect_dsc_init(&draw_dsc); + draw_dsc.bg_opa = LV_OPA_TRANSP; + draw_dsc.pattern_opa = LV_OPA_TRANSP; + draw_dsc.shadow_opa = LV_OPA_TRANSP; + draw_dsc.value_opa = LV_OPA_TRANSP; + lv_obj_init_draw_rect_dsc(obj, LV_OBJ_PART_MAIN, &draw_dsc); + + lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN); + lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_OBJ_PART_MAIN); + lv_area_t coords; + lv_area_copy(&coords, &obj->coords); + coords.x1 -= w; + coords.x2 += w; + coords.y1 -= h; + coords.y2 += h; + lv_draw_rect(&coords, clip_area, &draw_dsc); + } } + + return LV_DESIGN_RES_OK; } +/** + * Get the really focused object by taking `focus_parent` into account. + * @param obj the start object + * @return the object to really focus + */ +lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj) +{ + if(obj == NULL) return NULL; + const lv_obj_t * focus_obj = obj; + while(lv_obj_get_focus_parent(focus_obj) != false && focus_obj != NULL) { + focus_obj = lv_obj_get_parent(focus_obj); + } + + return (lv_obj_t *)focus_obj; +} -static void lv_event_mark_deleted(lv_obj_t * obj) +/** + * Signal function of the basic object + * @param obj pointer to an object + * @param sign signal type + * @param param parameter for the signal (depends on signal type) + * @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted + */ +static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) { - lv_event_temp_data_t * t = event_temp_data_head; + if(sign == LV_SIGNAL_GET_STYLE) { + lv_get_style_info_t * info = param; + if(info->part == LV_OBJ_PART_MAIN) info->result = &obj->style_list; + else info->result = NULL; + return LV_RES_OK; + } + else if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME); - while(t) { - if(t->obj == obj) t->deleted = true; - t = t->prev; + lv_res_t res = LV_RES_OK; + + if(sign == LV_SIGNAL_CHILD_CHG) { + /*Return 'invalid' if the child change signal is not enabled*/ + if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV; + } + else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { + lv_coord_t d = lv_obj_get_draw_rect_ext_pad_size(obj, LV_OBJ_PART_MAIN); + obj->ext_draw_pad = LV_MATH_MAX(obj->ext_draw_pad, d); + } +#if LV_USE_OBJ_REALIGN + else if(sign == LV_SIGNAL_PARENT_SIZE_CHG) { + if(obj->realign.auto_realign) { + lv_obj_realign(obj); + } + } +#endif + else if(sign == LV_SIGNAL_STYLE_CHG) { + lv_obj_refresh_ext_draw_pad(obj); + } + else if(sign == LV_SIGNAL_PRESSED) { + lv_obj_add_state(obj, LV_STATE_PRESSED); + } + else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) { + lv_obj_clear_state(obj, LV_STATE_PRESSED); + } + else if(sign == LV_SIGNAL_FOCUS) { + bool editing = false; +#if LV_USE_GROUP + editing = lv_group_get_editing(lv_obj_get_group(obj)); +#endif + if(editing) { + uint8_t state = LV_STATE_FOCUSED; + state |= LV_STATE_EDITED; + + /*if using focus mode, change target to parent*/ + obj = lv_obj_get_focused_obj(obj); + + lv_obj_add_state(obj, state); + } + else { + + /*if using focus mode, change target to parent*/ + obj = lv_obj_get_focused_obj(obj); + + lv_obj_add_state(obj, LV_STATE_FOCUSED); + lv_obj_clear_state(obj, LV_STATE_EDITED); + } + } + else if(sign == LV_SIGNAL_DEFOCUS) { + + /*if using focus mode, change target to parent*/ + obj = lv_obj_get_focused_obj(obj); + + lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED); + } + else if(sign == LV_SIGNAL_CLEANUP) { + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + } + + return res; +} + +/** + * Reposition the children of an object. (Called recursively) + * @param obj pointer to an object which children will be repositioned + * @param x_diff x coordinate shift + * @param y_diff y coordinate shift + */ +static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff) +{ + lv_obj_t * i; + _LV_LL_READ(obj->child_ll, i) { + i->coords.x1 += x_diff; + i->coords.y1 += y_diff; + i->coords.x2 += x_diff; + i->coords.y2 += y_diff; + + refresh_children_position(i, x_diff, y_diff); + } +} + +/** + * Refresh the style of all children of an object. (Called recursively) + * @param style refresh objects only with this style_list. + * @param obj pointer to an object + */ +static void report_style_mod_core(void * style, lv_obj_t * obj) +{ + uint8_t part; + for(part = 0; part != _LV_OBJ_PART_REAL_LAST; part++) { + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + if(list == NULL) break; + + uint8_t ci; + for(ci = 0; ci < list->style_cnt; ci++) { + /* changed class to _class to allow compilation as c++ */ + lv_style_t * _class = lv_style_list_get_style(list, ci); + if(_class == style || style == NULL) { + lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); + break; + } + } + } + + lv_obj_t * child = lv_obj_get_child(obj, NULL); + while(child) { + report_style_mod_core(style, child); + child = lv_obj_get_child(obj, child); } + +} + +/** + * Recursively refresh the style of the children. Go deeper until a not NULL style is found + * because the NULL styles are inherited from the parent + * @param obj pointer to an object + */ +static void refresh_children_style(lv_obj_t * obj) +{ + lv_obj_t * child = lv_obj_get_child(obj, NULL); + while(child != NULL) { + lv_obj_invalidate(child); + child->signal_cb(child, LV_SIGNAL_STYLE_CHG, NULL); + lv_obj_invalidate(child); + + refresh_children_style(child); /*Check children too*/ + child = lv_obj_get_child(obj, child); + } +} + +static void base_dir_refr_children(lv_obj_t * obj) +{ + lv_obj_t * child; + child = lv_obj_get_child(obj, NULL); + + while(child) { + if(child->base_dir == LV_BIDI_DIR_INHERIT) { + lv_signal_send(child, LV_SIGNAL_BASE_DIR_CHG, NULL); + base_dir_refr_children(child); + } + + child = lv_obj_get_child(obj, child); + } +} + +static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, + lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + lv_point_t new_pos; + _lv_area_align(&base->coords, &obj->coords, align, &new_pos); + + /*Bring together the coordination system of base and obj*/ + lv_obj_t * par = lv_obj_get_parent(obj); + lv_coord_t par_abs_x = par->coords.x1; + lv_coord_t par_abs_y = par->coords.y1; + new_pos.x += x_ofs; + new_pos.y += y_ofs; + new_pos.x -= par_abs_x; + new_pos.y -= par_abs_y; + + if(x_set && y_set) lv_obj_set_pos(obj, new_pos.x, new_pos.y); + else if(x_set) lv_obj_set_x(obj, new_pos.x); + else if(y_set) lv_obj_set_y(obj, new_pos.y); +} + +static void obj_align_mid_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set, + lv_coord_t x_ofs, lv_coord_t y_ofs) +{ + lv_coord_t new_x = lv_obj_get_x(obj); + lv_coord_t new_y = lv_obj_get_y(obj); + + lv_coord_t obj_w_half = lv_obj_get_width(obj) / 2; + lv_coord_t obj_h_half = lv_obj_get_height(obj) / 2; + + switch(align) { + case LV_ALIGN_CENTER: + new_x = lv_obj_get_width(base) / 2 - obj_w_half; + new_y = lv_obj_get_height(base) / 2 - obj_h_half; + break; + + case LV_ALIGN_IN_TOP_LEFT: + new_x = -obj_w_half; + new_y = -obj_h_half; + break; + case LV_ALIGN_IN_TOP_MID: + new_x = lv_obj_get_width(base) / 2 - obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_IN_TOP_RIGHT: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_IN_BOTTOM_LEFT: + new_x = -obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + case LV_ALIGN_IN_BOTTOM_MID: + new_x = lv_obj_get_width(base) / 2 - obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + + case LV_ALIGN_IN_BOTTOM_RIGHT: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + + case LV_ALIGN_IN_LEFT_MID: + new_x = -obj_w_half; + new_y = lv_obj_get_height(base) / 2 - obj_h_half; + break; + + case LV_ALIGN_IN_RIGHT_MID: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = lv_obj_get_height(base) / 2 - obj_h_half; + break; + + case LV_ALIGN_OUT_TOP_LEFT: + new_x = -obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_OUT_TOP_MID: + new_x = lv_obj_get_width(base) / 2 - obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_OUT_TOP_RIGHT: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_OUT_BOTTOM_LEFT: + new_x = -obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + + case LV_ALIGN_OUT_BOTTOM_MID: + new_x = lv_obj_get_width(base) / 2 - obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + + case LV_ALIGN_OUT_BOTTOM_RIGHT: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + + case LV_ALIGN_OUT_LEFT_TOP: + new_x = -obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_OUT_LEFT_MID: + new_x = -obj_w_half; + new_y = lv_obj_get_height(base) / 2 - obj_h_half; + break; + + case LV_ALIGN_OUT_LEFT_BOTTOM: + new_x = -obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + + case LV_ALIGN_OUT_RIGHT_TOP: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = -obj_h_half; + break; + + case LV_ALIGN_OUT_RIGHT_MID: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = lv_obj_get_height(base) / 2 - obj_h_half; + break; + + case LV_ALIGN_OUT_RIGHT_BOTTOM: + new_x = lv_obj_get_width(base) - obj_w_half; + new_y = lv_obj_get_height(base) - obj_h_half; + break; + } + + /*Bring together the coordination system of base and obj*/ + lv_obj_t * par = lv_obj_get_parent(obj); + lv_coord_t base_abs_x = base->coords.x1; + lv_coord_t base_abs_y = base->coords.y1; + lv_coord_t par_abs_x = par->coords.x1; + lv_coord_t par_abs_y = par->coords.y1; + new_x += x_ofs + base_abs_x; + new_y += y_ofs + base_abs_y; + new_x -= par_abs_x; + new_y -= par_abs_y; + if(x_set && y_set) lv_obj_set_pos(obj, new_x, new_y); + else if(x_set) lv_obj_set_x(obj, new_x); + else if(y_set) lv_obj_set_y(obj, new_y); + +} + +#if LV_USE_ANIMATION + +/** + * Allocate and initialize a transition for a property of an object if the properties value is different in the new state. + * It allocates `lv_style_trans_t` in `_lv_obj_style_trans_ll` and set only `start/end_values`. No animation will be created here. + * @param obj and object to add the transition + * @param prop the property to apply the transaction + * @param part the part of the object to apply the transaction + * @param prev_state the previous state of the objects + * @param new_state the new state of the object + * @return pointer to the allocated `the transaction` variable or `NULL` if no transition created + */ +static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state, + lv_state_t new_state) +{ + lv_style_trans_t * tr; + lv_style_list_t * style_list = lv_obj_get_style_list(obj, part); + lv_style_t * style_trans = _lv_style_list_get_transition_style(style_list); + + bool cache_ori = style_list->ignore_cache; + + /*Get the previous and current values*/ + if((prop & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/ + style_list->skip_trans = 1; + style_list->ignore_cache = 1; + obj->state = prev_state; + lv_style_int_t int1 = _lv_obj_get_style_int(obj, part, prop); + obj->state = new_state; + lv_style_int_t int2 = _lv_obj_get_style_int(obj, part, prop); + style_list->skip_trans = 0; + style_list->ignore_cache = cache_ori; + + if(int1 == int2) return NULL; + obj->state = prev_state; + int1 = _lv_obj_get_style_int(obj, part, prop); + obj->state = new_state; + _lv_style_set_int(style_trans, prop, int1); /*Be sure `trans_style` has a valid value */ + + if(prop == LV_STYLE_RADIUS) { + if(int1 == LV_RADIUS_CIRCLE || int2 == LV_RADIUS_CIRCLE) { + lv_coord_t whalf = lv_obj_get_width(obj) / 2; + lv_coord_t hhalf = lv_obj_get_width(obj) / 2; + if(int1 == LV_RADIUS_CIRCLE) int1 = LV_MATH_MIN(whalf + 1, hhalf + 1); + if(int2 == LV_RADIUS_CIRCLE) int2 = LV_MATH_MIN(whalf + 1, hhalf + 1); + } + } + + tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); + LV_ASSERT_MEM(tr); + if(tr == NULL) return NULL; + tr->start_value._int = int1; + tr->end_value._int = int2; + } + else if((prop & 0xF) < LV_STYLE_ID_OPA) { /*Color*/ + style_list->skip_trans = 1; + style_list->ignore_cache = 1; + obj->state = prev_state; + lv_color_t c1 = _lv_obj_get_style_color(obj, part, prop); + obj->state = new_state; + lv_color_t c2 = _lv_obj_get_style_color(obj, part, prop); + style_list->skip_trans = 0; + style_list->ignore_cache = cache_ori; + + if(c1.full == c2.full) return NULL; + obj->state = prev_state; + c1 = _lv_obj_get_style_color(obj, part, prop); + obj->state = new_state; + _lv_style_set_color(style_trans, prop, c1); /*Be sure `trans_style` has a valid value */ + + tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); + LV_ASSERT_MEM(tr); + if(tr == NULL) return NULL; + tr->start_value._color = c1; + tr->end_value._color = c2; + } + else if((prop & 0xF) < LV_STYLE_ID_PTR) { /*Opa*/ + style_list->skip_trans = 1; + style_list->ignore_cache = 1; + obj->state = prev_state; + lv_opa_t o1 = _lv_obj_get_style_opa(obj, part, prop); + obj->state = new_state; + lv_opa_t o2 = _lv_obj_get_style_opa(obj, part, prop); + style_list->skip_trans = 0; + style_list->ignore_cache = cache_ori; + + if(o1 == o2) return NULL; + + obj->state = prev_state; + o1 = _lv_obj_get_style_opa(obj, part, prop); + obj->state = new_state; + _lv_style_set_opa(style_trans, prop, o1); /*Be sure `trans_style` has a valid value */ + + tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); + LV_ASSERT_MEM(tr); + if(tr == NULL) return NULL; + tr->start_value._opa = o1; + tr->end_value._opa = o2; + } + else { /*Ptr*/ + obj->state = prev_state; + style_list->skip_trans = 1; + style_list->ignore_cache = 1; + const void * p1 = _lv_obj_get_style_ptr(obj, part, prop); + obj->state = new_state; + const void * p2 = _lv_obj_get_style_ptr(obj, part, prop); + style_list->skip_trans = 0; + style_list->ignore_cache = cache_ori; + + if(memcmp(&p1, &p2, sizeof(const void *)) == 0) return NULL; + obj->state = prev_state; + p1 = _lv_obj_get_style_ptr(obj, part, prop); + obj->state = new_state; + _lv_style_set_ptr(style_trans, prop, p1); /*Be sure `trans_style` has a valid value */ + + tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); + LV_ASSERT_MEM(tr); + if(tr == NULL) return NULL; + tr->start_value._ptr = p1; + tr->end_value._ptr = p2; + } + + return tr; +} + +/** + * Remove the transition from object's part's property. + * - Remove the transition from `_lv_obj_style_trans_ll` and free it + * - Delete pending transitions + * @param obj pointer to an object which transition(s) should be removed + * @param part a part of object or 0xFF to remove from all parts + * @param prop a property or 0xFF to remove all properties + * @param tr_limit delete transitions only "older" then this. `NULL` is not used + */ +static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_trans_t * tr_limit) +{ + lv_style_trans_t * tr; + lv_style_trans_t * tr_prev; + tr = _lv_ll_get_tail(&LV_GC_ROOT(_lv_obj_style_trans_ll)); + while(tr != NULL) { + if(tr == tr_limit) break; + + /*'tr' might be deleted, so get the next object while 'tr' is valid*/ + tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); + + if(tr->obj == obj && (part == tr->part || part == 0xFF) && (prop == tr->prop || prop == 0xFF)) { + /* Remove the transitioned property from trans. style + * to allow changing it by normal styles*/ + lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part); + lv_style_t * style_trans = _lv_style_list_get_transition_style(list); + lv_style_remove_prop(style_trans, tr->prop); + + lv_anim_del(tr, NULL); + _lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); + lv_mem_free(tr); + } + tr = tr_prev; + } +} + +static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v) +{ + lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part); + lv_style_t * style = _lv_style_list_get_transition_style(list); + + if((tr->prop & 0xF) < LV_STYLE_ID_COLOR) { /*Value*/ + lv_style_int_t x; + if(v == 0) x = tr->start_value._int; + else if(v == 255) x = tr->end_value._int; + else x = tr->start_value._int + ((int32_t)((int32_t)(tr->end_value._int - tr->start_value._int) * v) >> 8); + _lv_style_set_int(style, tr->prop, x); + } + else if((tr->prop & 0xF) < LV_STYLE_ID_OPA) { /*Color*/ + lv_color_t x; + if(v <= 0) x = tr->start_value._color; + else if(v >= 255) x = tr->end_value._color; + else x = lv_color_mix(tr->end_value._color, tr->start_value._color, v); + _lv_style_set_color(style, tr->prop, x); + } + else if((tr->prop & 0xF) < LV_STYLE_ID_PTR) { /*Opa*/ + lv_opa_t x; + if(v <= 0) x = tr->start_value._opa; + else if(v >= 255) x = tr->end_value._opa; + else x = tr->start_value._opa + (((tr->end_value._opa - tr->start_value._opa) * v) >> 8); + _lv_style_set_opa(style, tr->prop, x); + } + else { + const void * x; + if(v < 128) x = tr->start_value._ptr; + else x = tr->end_value._ptr; + _lv_style_set_ptr(style, tr->prop, x); + } + lv_obj_refresh_style(tr->obj, tr->part, tr->prop); + +} + +static void trans_anim_start_cb(lv_anim_t * a) +{ + lv_style_trans_t * tr = a->var; + + lv_style_property_t prop_tmp = tr->prop; + + /*Start the animation from the current value*/ + if((prop_tmp & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/ + tr->start_value._int = _lv_obj_get_style_int(tr->obj, tr->part, prop_tmp); + } + else if((prop_tmp & 0xF) < LV_STYLE_ID_OPA) { /*Color*/ + tr->start_value._color = _lv_obj_get_style_color(tr->obj, tr->part, prop_tmp); + } + else if((prop_tmp & 0xF) < LV_STYLE_ID_PTR) { /*Opa*/ + tr->start_value._opa = _lv_obj_get_style_opa(tr->obj, tr->part, prop_tmp); + } + else { /*Ptr*/ + tr->start_value._ptr = _lv_obj_get_style_ptr(tr->obj, tr->part, prop_tmp); + } + + /*Init prop to an invalid values to be sure `trans_del` won't delete this added `tr`*/ + tr->prop = 0; + /*Delete the relate transition if any*/ + trans_del(tr->obj, tr->part, prop_tmp, tr); + + tr->prop = prop_tmp; + +} + +static void trans_anim_ready_cb(lv_anim_t * a) +{ + lv_style_trans_t * tr = a->var; + + /* Remove the transitioned property from trans. style + * if there no more transitions for this property + * It allows changing it by normal styles*/ + + bool running = false; + lv_style_trans_t * tr_i; + _LV_LL_READ(LV_GC_ROOT(_lv_obj_style_trans_ll), tr_i) { + if(tr_i != tr && tr_i->obj == tr->obj && tr_i->part == tr->part && tr_i->prop == tr->prop) { + running = true; + } + } + + if(!running) { + lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part); + lv_style_t * style_trans = _lv_style_list_get_transition_style(list); + lv_style_remove_prop(style_trans, tr->prop); + } + + _lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); + lv_mem_free(tr); +} + +static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v) +{ + lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v); +} + +static void fade_in_anim_ready(lv_anim_t * a) +{ + lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE); +} + +#endif + +static void lv_event_mark_deleted(lv_obj_t * obj) +{ + lv_event_temp_data_t * t = event_temp_data_head; + + while(t) { + if(t->obj == obj) t->deleted = true; + t = t->prev; + } +} + +static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find) +{ + /*Check all children of `parent`*/ + lv_obj_t * child; + _LV_LL_READ(parent->child_ll, child) { + if(child == obj_to_find) return true; + + /*Check the children*/ + bool found = obj_valid_child(child, obj_to_find); + if(found) return true; + } + + return false; +} + +static bool style_prop_is_cacheble(lv_style_property_t prop) +{ + + switch(prop) { + case LV_STYLE_PROP_ALL: + case LV_STYLE_CLIP_CORNER: + case LV_STYLE_TEXT_LETTER_SPACE: + case LV_STYLE_TEXT_LINE_SPACE: + case LV_STYLE_TEXT_FONT: + case LV_STYLE_TRANSFORM_ANGLE: + case LV_STYLE_TRANSFORM_WIDTH: + case LV_STYLE_TRANSFORM_HEIGHT: + case LV_STYLE_TRANSFORM_ZOOM: + case LV_STYLE_BORDER_WIDTH: + case LV_STYLE_OUTLINE_WIDTH: + case LV_STYLE_RADIUS: + case LV_STYLE_SHADOW_WIDTH: + case LV_STYLE_OPA_SCALE: + case LV_STYLE_BG_OPA: + case LV_STYLE_BORDER_SIDE: + case LV_STYLE_BORDER_POST: + case LV_STYLE_IMAGE_RECOLOR_OPA: + case LV_STYLE_VALUE_STR: + case LV_STYLE_PATTERN_IMAGE: + case LV_STYLE_PAD_TOP: + case LV_STYLE_PAD_BOTTOM: + case LV_STYLE_PAD_LEFT: + case LV_STYLE_PAD_RIGHT: + case LV_STYLE_MARGIN_TOP: + case LV_STYLE_MARGIN_BOTTOM: + case LV_STYLE_MARGIN_LEFT: + case LV_STYLE_MARGIN_RIGHT: + case LV_STYLE_BG_BLEND_MODE: + case LV_STYLE_BORDER_BLEND_MODE: + case LV_STYLE_IMAGE_BLEND_MODE: + case LV_STYLE_LINE_BLEND_MODE: + case LV_STYLE_OUTLINE_BLEND_MODE: + case LV_STYLE_PATTERN_BLEND_MODE: + case LV_STYLE_SHADOW_BLEND_MODE: + case LV_STYLE_TEXT_BLEND_MODE: + case LV_STYLE_VALUE_BLEND_MODE: + return true; + break; + default: + return false; + } +} + +/** + * Update the cache of style list + * @param obj pointer to an object + * @param part the part of the object + * @param prop the property which triggered the update + */ +static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop) +{ + if(style_prop_is_cacheble(prop) == false) return; + + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + + bool ignore_cache_ori = list->ignore_cache; + list->ignore_cache = 1; + +#if LV_USE_OPA_SCALE + list->opa_scale_cover = lv_obj_get_style_opa_scale(obj, part) == LV_OPA_COVER ? 1 : 0; +#else + list->opa_scale_cover = 1; +#endif + list->text_decor_none = lv_obj_get_style_text_decor(obj, part) == LV_TEXT_DECOR_NONE ? 1 : 0; + list->text_font_normal = lv_obj_get_style_text_font(obj, part) == LV_THEME_DEFAULT_FONT_NORMAL ? 1 : 0; + + list->text_space_zero = 1; + if(lv_obj_get_style_text_letter_space(obj, part) != 0 || + lv_obj_get_style_text_line_space(obj, part) != 0) { + list->text_space_zero = 0; + } + + lv_opa_t bg_opa = lv_obj_get_style_bg_opa(obj, part); + list->bg_opa_transp = bg_opa == LV_OPA_TRANSP ? 1 : 0; + list->bg_opa_cover = bg_opa == LV_OPA_COVER ? 1 : 0; + + list->border_width_zero = lv_obj_get_style_border_width(obj, part) == 0 ? 1 : 0; + list->border_side_full = lv_obj_get_style_border_side(obj, part) == LV_BORDER_SIDE_FULL ? 1 : 0; + list->border_post_off = lv_obj_get_style_border_post(obj, part) == 0 ? 1 : 0; + list->clip_corner_off = lv_obj_get_style_clip_corner(obj, part) == false ? 1 : 0; + list->img_recolor_opa_transp = lv_obj_get_style_image_recolor_opa(obj, part) == LV_OPA_TRANSP ? 1 : 0; + list->outline_width_zero = lv_obj_get_style_outline_width(obj, part) == 0 ? 1 : 0; + list->pattern_img_null = lv_obj_get_style_pattern_image(obj, part) == NULL ? 1 : 0; + list->radius_zero = lv_obj_get_style_radius(obj, part) == 0 ? 1 : 0; + list->shadow_width_zero = lv_obj_get_style_shadow_width(obj, part) == 0 ? 1 : 0; + list->value_txt_str = lv_obj_get_style_value_str(obj, part) == NULL ? 1 : 0; + + list->transform_all_zero = 1; + if(lv_obj_get_style_transform_angle(obj, part) != 0 || + lv_obj_get_style_transform_width(obj, part) != 0 || + lv_obj_get_style_transform_height(obj, part) != 0 || + lv_obj_get_style_transform_zoom(obj, part) != LV_IMG_ZOOM_NONE) { + list->transform_all_zero = 0; + } + + list->pad_all_zero = 1; + if(lv_obj_get_style_pad_top(obj, part) != 0 || + lv_obj_get_style_pad_bottom(obj, part) != 0 || + lv_obj_get_style_pad_left(obj, part) != 0 || + lv_obj_get_style_pad_right(obj, part) != 0) { + list->pad_all_zero = 0; + } + + list->margin_all_zero = 1; + if(lv_obj_get_style_margin_top(obj, part) != 0 || + lv_obj_get_style_margin_bottom(obj, part) != 0 || + lv_obj_get_style_margin_left(obj, part) != 0 || + lv_obj_get_style_margin_right(obj, part) != 0) { + list->margin_all_zero = 0; + } + + list->blend_mode_all_normal = 1; +#if LV_USE_BLEND_MODES + if(lv_obj_get_style_bg_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_border_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_pattern_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_outline_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_value_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_text_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_line_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_image_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL || + lv_obj_get_style_shadow_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL) { + list->blend_mode_all_normal = 0; + } +#endif + list->ignore_cache = ignore_cache_ori; + list->valid_cache = 1; +} + +/** + * Update the cache of style list + * @param obj pointer to an object + * @param part the part of the object + */ +static void update_style_cache_children(lv_obj_t * obj) +{ + uint8_t part; + for(part = 0; part != _LV_OBJ_PART_REAL_LAST; part++) { + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + if(list == NULL) break; + + bool ignore_cache_ori = list->ignore_cache; + list->ignore_cache = 1; + + list->opa_scale_cover = lv_obj_get_style_opa_scale(obj, part) == LV_OPA_COVER ? 1 : 0; + list->text_decor_none = lv_obj_get_style_text_decor(obj, part) == LV_TEXT_DECOR_NONE ? 1 : 0; + list->text_font_normal = lv_obj_get_style_text_font(obj, part) == lv_theme_get_font_normal() ? 1 : 0; + list->img_recolor_opa_transp = lv_obj_get_style_image_recolor_opa(obj, part) == LV_OPA_TRANSP ? 1 : 0; + + list->text_space_zero = 1; + if(lv_obj_get_style_text_letter_space(obj, part) != 0 || + lv_obj_get_style_text_line_space(obj, part) != 0) { + list->text_space_zero = 0; + } + + list->ignore_cache = ignore_cache_ori; + } + + lv_obj_t * child = lv_obj_get_child(obj, NULL); + while(child) { + update_style_cache_children(child); + child = lv_obj_get_child(obj, child); + } + +} + +/** + * Mark the object and all of it's children's style lists as invalid. + * The cache will be updated when a cached property asked nest time + * @param obj pointer to an object + */ +static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_property_t prop) +{ + if(style_prop_is_cacheble(prop) == false) return; + + for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) { + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + if(list == NULL) break; + list->valid_cache = 0; + } + + for(part = _LV_OBJ_PART_REAL_FIRST; part < 0xFF; part++) { + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + if(list == NULL) break; + list->valid_cache = 0; + } + + lv_obj_t * child = lv_obj_get_child(obj, NULL); + while(child) { + update_style_cache_children(child); + child = lv_obj_get_child(obj, child); + } +} + +static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot) +{ + _lv_obj_disable_style_caching(obj, true); + _lv_memset_00(shot, sizeof(style_snapshot_t)); + lv_draw_rect_dsc_init(&shot->rect); + lv_draw_label_dsc_init(&shot->label); + lv_draw_img_dsc_init(&shot->img); + lv_draw_line_dsc_init(&shot->line); + + lv_style_list_t * list = lv_obj_get_style_list(obj, part); + bool trans_ori = list->skip_trans; + list->skip_trans = 1; + + lv_obj_init_draw_rect_dsc(obj, part, &shot->rect); + lv_obj_init_draw_label_dsc(obj, part, &shot->label); + lv_obj_init_draw_img_dsc(obj, part, &shot->img); + lv_obj_init_draw_line_dsc(obj, part, &shot->line); + + shot->pad_top = lv_obj_get_style_pad_top(obj, part); + shot->pad_bottom = lv_obj_get_style_pad_bottom(obj, part); + shot->pad_right = lv_obj_get_style_pad_right(obj, part); + shot->pad_left = lv_obj_get_style_pad_left(obj, part); + shot->pad_inner = lv_obj_get_style_pad_inner(obj, part); + shot->margin_top = lv_obj_get_style_margin_top(obj, part); + shot->margin_bottom = lv_obj_get_style_margin_bottom(obj, part); + shot->margin_left = lv_obj_get_style_margin_left(obj, part); + shot->margin_right = lv_obj_get_style_margin_right(obj, part); + shot->size = lv_obj_get_style_size(obj, part); + shot->transform_width = lv_obj_get_style_transform_width(obj, part); + shot->transform_height = lv_obj_get_style_transform_height(obj, part); + shot->transform_angle = lv_obj_get_style_transform_angle(obj, part); + shot->transform_zoom = lv_obj_get_style_transform_zoom(obj, part); + shot->scale_width = lv_obj_get_style_scale_width(obj, part); + shot->scale_border_width = lv_obj_get_style_scale_border_width(obj, part); + shot->scale_end_border_width = lv_obj_get_style_scale_end_border_width(obj, part); + shot->scale_end_line_width = lv_obj_get_style_scale_end_line_width(obj, part); + shot->scale_grad_color = lv_obj_get_style_scale_grad_color(obj, part); + shot->scale_end_color = lv_obj_get_style_scale_end_color(obj, part); + shot->opa_scale = lv_obj_get_style_opa_scale(obj, part); + shot->clip_corner = lv_obj_get_style_clip_corner(obj, part); + shot->border_post = lv_obj_get_style_border_post(obj, part); + + _lv_obj_disable_style_caching(obj, false); + list->skip_trans = trans_ori; +} + +static style_snapshot_res_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2) +{ + if(memcmp(shot1, shot2, sizeof(style_snapshot_t)) == 0) return STYLE_COMPARE_SAME; + + if(shot1->pad_top != shot2->pad_top) return STYLE_COMPARE_DIFF; + if(shot1->pad_bottom != shot2->pad_bottom) return STYLE_COMPARE_DIFF; + if(shot1->pad_left != shot2->pad_right) return STYLE_COMPARE_DIFF; + if(shot1->pad_right != shot2->pad_right) return STYLE_COMPARE_DIFF; + if(shot1->pad_top != shot2->pad_top) return STYLE_COMPARE_DIFF; + if(shot1->pad_inner != shot2->pad_inner) return STYLE_COMPARE_DIFF; + if(shot1->margin_top != shot2->margin_top) return STYLE_COMPARE_DIFF; + if(shot1->margin_bottom != shot2->margin_bottom) return STYLE_COMPARE_DIFF; + if(shot1->margin_left != shot2->margin_right) return STYLE_COMPARE_DIFF; + if(shot1->margin_right != shot2->margin_right) return STYLE_COMPARE_DIFF; + if(shot1->margin_top != shot2->margin_top) return STYLE_COMPARE_DIFF; + if(shot1->transform_width != shot2->transform_width) return STYLE_COMPARE_DIFF; + if(shot1->transform_height != shot2->transform_height) return STYLE_COMPARE_DIFF; + if(shot1->transform_angle != shot2->transform_angle) return STYLE_COMPARE_DIFF; + if(shot1->transform_zoom != shot2->transform_zoom) return STYLE_COMPARE_DIFF; + if(shot1->rect.outline_width != shot2->rect.outline_width) return STYLE_COMPARE_DIFF; + if(shot1->rect.outline_pad != shot2->rect.outline_pad) return STYLE_COMPARE_DIFF; + if(shot1->rect.value_font != shot2->rect.value_font) return STYLE_COMPARE_DIFF; + if(shot1->rect.value_align != shot2->rect.value_align) return STYLE_COMPARE_DIFF; + if(shot1->rect.value_font != shot2->rect.value_font) return STYLE_COMPARE_DIFF; + if(shot1->rect.shadow_spread != shot2->rect.shadow_spread) return STYLE_COMPARE_DIFF; + if(shot1->rect.shadow_width != shot2->rect.shadow_width) return STYLE_COMPARE_DIFF; + if(shot1->rect.shadow_ofs_x != shot2->rect.shadow_ofs_x) return STYLE_COMPARE_DIFF; + if(shot1->rect.shadow_ofs_y != shot2->rect.shadow_ofs_y) return STYLE_COMPARE_DIFF; + + /*If not returned earlier its just a visual difference, a simple redraw is enough*/ + return STYLE_COMPARE_VISUAL_DIFF; } diff --git a/src/libs/lvgl/src/lv_core/lv_obj.h b/src/libs/lvgl/src/lv_core/lv_obj.h index 24517241..4f00dcda 100644 --- a/src/libs/lvgl/src/lv_core/lv_obj.h +++ b/src/libs/lvgl/src/lv_core/lv_obj.h @@ -13,23 +13,20 @@ extern "C" { /********************* * INCLUDES *********************/ -#ifdef LV_CONF_INCLUDE_SIMPLE -#include "lv_conf.h" -#else -#include "../../../lv_conf.h" -#endif +#include "../lv_conf_internal.h" #include #include #include "lv_style.h" #include "../lv_misc/lv_types.h" #include "../lv_misc/lv_area.h" -#include "../lv_misc/lv_mem.h" -#include "../lv_misc/lv_ll.h" #include "../lv_misc/lv_color.h" -#include "../lv_misc/lv_log.h" -#include "../lv_misc/lv_bidi.h" +#include "../lv_misc/lv_debug.h" #include "../lv_hal/lv_hal.h" +#include "../lv_draw/lv_draw_rect.h" +#include "../lv_draw/lv_draw_label.h" +#include "../lv_draw/lv_draw_line.h" +#include "../lv_draw/lv_draw_img.h" /********************* * DEFINES @@ -37,26 +34,28 @@ extern "C" { /*Error check of lv_conf.h*/ #if LV_HOR_RES_MAX == 0 || LV_VER_RES_MAX == 0 -#error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0" +#error "LVGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0" #endif #if LV_ANTIALIAS > 1 -#error "LittlevGL: LV_ANTIALIAS can be only 0 or 1" +#error "LVGL: LV_ANTIALIAS can be only 0 or 1" #endif #define LV_MAX_ANCESTOR_NUM 8 -#define LV_EXT_CLICK_AREA_OFF 0 +#define LV_EXT_CLICK_AREA_OFF 0 #define LV_EXT_CLICK_AREA_TINY 1 #define LV_EXT_CLICK_AREA_FULL 2 +#define _LV_OBJ_PART_VIRTUAL_FIRST 0x01 +#define _LV_OBJ_PART_REAL_FIRST 0x40 + /********************** * TYPEDEFS **********************/ struct _lv_obj_t; - /** Design modes */ enum { LV_DESIGN_DRAW_MAIN, /**< Draw the main portion of the object */ @@ -65,11 +64,20 @@ enum { }; typedef uint8_t lv_design_mode_t; +/** Design results */ +enum { + LV_DESIGN_RES_OK, /**< Draw ready */ + LV_DESIGN_RES_COVER, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is fully covered*/ + LV_DESIGN_RES_NOT_COVER, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is not covered*/ + LV_DESIGN_RES_MASKED, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is masked out (children also not cover)*/ +}; +typedef uint8_t lv_design_res_t; + /** * The design callback is used to draw the object on the screen. * It accepts the object, a mask area, and the mode in which to draw the object. */ -typedef bool (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode); +typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode); enum { LV_EVENT_PRESSED, /**< The object has been pressed*/ @@ -80,19 +88,22 @@ enum { LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every `LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if dragged.*/ LV_EVENT_CLICKED, /**< Called on release if not dragged (regardless to long press)*/ - LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/ - LV_EVENT_DRAG_BEGIN, + LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/ + LV_EVENT_DRAG_BEGIN, LV_EVENT_DRAG_END, LV_EVENT_DRAG_THROW_BEGIN, + LV_EVENT_GESTURE, /**< The object has been gesture*/ LV_EVENT_KEY, LV_EVENT_FOCUSED, LV_EVENT_DEFOCUSED, - LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved) */ + LV_EVENT_LEAVE, + LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved) */ LV_EVENT_INSERT, LV_EVENT_REFRESH, LV_EVENT_APPLY, /**< "Ok", "Apply" or similar specific button has clicked*/ LV_EVENT_CANCEL, /**< "Close", "Cancel" or similar specific button has clicked*/ LV_EVENT_DELETE, /**< Object is being deleted */ + _LV_EVENT_LAST /** Number of events*/ }; typedef uint8_t lv_event_t; /**< Type of event being sent to the object. */ @@ -110,22 +121,28 @@ enum { /*General signals*/ LV_SIGNAL_CLEANUP, /**< Object is being deleted */ LV_SIGNAL_CHILD_CHG, /**< Child was removed/added */ - LV_SIGNAL_CORD_CHG, /**< Object coordinates/size have changed */ + LV_SIGNAL_COORD_CHG, /**< Object coordinates/size have changed */ LV_SIGNAL_PARENT_SIZE_CHG, /**< Parent's size has changed */ LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */ LV_SIGNAL_BASE_DIR_CHG, /**