diff --git a/.github/workflows/build_micropython.yml b/.github/workflows/build_micropython.yml new file mode 100644 index 000000000..b7097d5b3 --- /dev/null +++ b/.github/workflows/build_micropython.yml @@ -0,0 +1,40 @@ +name: Build Micropython with LVGL submodule + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +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 lv_bindings + working-directory: ./lib/lv_bindings/lvgl + run: | + git fetch + git checkout $GITHUB_SHA + - 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/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index eb40232e2..46a81c62c 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -14,4 +14,4 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run tests - run: cd tests; python ./build.py + run: sudo apt-get install libpng-dev; cd tests; python ./build.py diff --git a/CHANGELOG.md b/CHANGELOG.md index d5cff76ee..69d1f8623 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,32 @@ # Changelog -## v7.4.0 (planned on 01.09.2020) +## v7.6.0 (TBD) + +### New features +- Check wheter the any style property has changed on a state change to decide if any redraw is required + +## v7.5.0 (planned at 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. + +### Bugfixes +- Fix unexpeted 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. + +## 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 -- arc: add set value by click feature -- arc: add `LV_ARC_PART_KNOB` similarly to slider -- send gestures even is the the obejct was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function. - 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 acces time of properties with default value +- arc: add set value by click feature +- arc: add `LV_ARC_PART_KNOB` similarly to slider +- send gestures even is the the obejct 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 @@ -17,6 +35,7 @@ - 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) diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 9b5914e58..1c4cdac93 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -12,28 +12,31 @@ Planned to September/October 2020 - 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 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 Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support - - Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`. + - [CSS Grid](https://css-tricks.com/snippets/css/a-guide-to-grid/)-like layout support - Work in progress - 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 -- Add new label alignment modes - - See [#1656](https://github.com/lvgl/lvgl/issues/1656) - Remove the align parameter from `lv_canvas_draw_text` +- RGB888 support [#1722](https://github.com/lvgl/lvgl/issues/1722) + +## v8.1 +- Add radio button widget ## v9 -- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3). - -## Ideas +- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).7 - Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658) - Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660) + +## Ideas - CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736) - Optmize font decompression - Switch to RGBA colors in styles - Need coverage report for tests - Need static analize (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) diff --git a/examples/porting/lv_port_disp_template.c b/examples/porting/lv_port_disp_template.c index b26c34e53..7bb9c3d70 100644 --- a/examples/porting/lv_port_disp_template.c +++ b/examples/porting/lv_port_disp_template.c @@ -54,7 +54,9 @@ void lv_port_disp_init(void) * Create a buffer for drawing *----------------------------*/ - /* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row + /* 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 dispay. + * The buffer has to be greater than 1 display row * * There are three buffering configurations: * 1. Create ONE buffer with some rows: @@ -73,21 +75,21 @@ void lv_port_disp_init(void) * */ /* 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*/ + 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 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*/ + 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 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*/ + 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*/ /*----------------------------------- @@ -107,7 +109,7 @@ void lv_port_disp_init(void) disp_drv.flush_cb = disp_flush; /*Set a display buffer*/ - disp_drv.buffer = &disp_buf_2; + 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)*/ diff --git a/library.json b/library.json index a6eb48edf..5f6adb3ed 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "7.3.1", + "version": "7.4.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": { diff --git a/library.properties b/library.properties index 44897bb54..4a160a47f 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=lvgl -version=7.3.1 +version=7.4.0 author=kisvegabor maintainer=kisvegabor,embeddedt,pete-pjb sentence=Full-featured Graphics Library for Embedded Systems diff --git a/lv_conf_template.h b/lv_conf_template.h index 6faeafad3..236daf929 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * Configuration file for v7.6.0-dev-dev + * Configuration file for v7.6.0-dev */ /* @@ -430,11 +430,11 @@ typedef void * lv_font_user_data_t; /* No theme, you can apply your styles as you need * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ - #define LV_USE_THEME_EMPTY 1 +#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 +#define LV_USE_THEME_TEMPLATE 1 /* A fast and impressive theme. * Flags: @@ -443,14 +443,14 @@ typedef void * lv_font_user_data_t; * 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 +#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_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 @@ -653,7 +653,7 @@ typedef void * lv_obj_user_data_t; * 1: Some extra precision * 2: Best precision */ -# define LV_LINEMETER_PRECISE 0 +# define LV_LINEMETER_PRECISE 1 #endif /*Mask (dependencies: -)*/ @@ -687,9 +687,6 @@ typedef void * lv_obj_user_data_t; # define LV_ROLLER_INF_PAGES 7 #endif -/*Rotary (dependencies: lv_arc, lv_btn)*/ -#define LV_USE_ROTARY 1 - /*Slider (dependencies: lv_bar)*/ #define LV_USE_SLIDER 1 diff --git a/lvgl.h b/lvgl.h index 0cc2f8fae..1ab541ea0 100644 --- a/lvgl.h +++ b/lvgl.h @@ -14,9 +14,9 @@ extern "C" { /*************************** * CURRENT VERSION OF LVGL ***************************/ -#define LVGL_VERSION_MAJOR 7 -#define LVGL_VERSION_MINOR 4 -#define LVGL_VERSION_PATCH 0 +#define LVGL_VERSION_MAJOR 7 +#define LVGL_VERSION_MINOR 6 +#define LVGL_VERSION_PATCH 0 #define LVGL_VERSION_INFO "dev" /********************* @@ -82,6 +82,8 @@ extern "C" { #include "src/lv_api_map.h" +//#define LV_BUILD_TEST 1 + /********************* * DEFINES *********************/ diff --git a/r.patch b/r.patch new file mode 100644 index 000000000..e3f80d539 --- /dev/null +++ b/r.patch @@ -0,0 +1,62 @@ +diff --git a/scripts/release.py b/scripts/release.py +index c06bf529..3a7f27b8 100755 +--- a/scripts/release.py ++++ b/scripts/release.py +@@ -59,6 +59,9 @@ proj_list = [ "lv_sim_eclipse_sdl"] + ver_major = -1 + ver_minor = -1 + ver_patch = -1 ++dev_ver_major = -1 ++dev_ver_minor = -1 ++dev_ver_patch = -1 + + ver_str = "" + dev_ver_str = "" +@@ -309,7 +312,7 @@ def publish_master(): + #Merge LVGL master to dev first to avoid "merge-to-dev.yml" running asynchronous + os.chdir("./lvgl") + cmd("git checkout dev") +- cmd("git merge master -X theirs") ++ cmd("git merge master -X ours") # Use ours to keep the version numbers + cmd("git add .") + cmd("git commit -am 'Merge master'", False) + cmd("git push origin dev") +@@ -473,6 +476,11 @@ if __name__ == '__main__': + exit(1) + + clone_repos() ++ get_lvgl_version("dev") ++ dev_ver_major = ver_major ++ dev_ver_minor = ver_minor ++ dev_ver_patch = ver_patch ++ + get_lvgl_version("master") + lvgl_prepare() + lv_examples_prepare() +@@ -483,16 +491,17 @@ if __name__ == '__main__': + update_release_branches() + publish_master() + ++ projs_update() ++ + if dev_prepare == 'bugfix': + ver_patch = str(int(ver_patch) + 1) +- ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" ++ ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) + "-dev" + + print("Prepare bugfix version " + ver_str) + + lvgl_update_master_version() + docs_update_latest_version() + +- get_lvgl_version("dev") + dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" + merge_to_dev() + +@@ -520,6 +529,5 @@ if __name__ == '__main__': + docs_update_dev_version() + publish_dev_and_master() + +- projs_update() + cleanup() + diff --git a/scripts/lv_conf_checker.py b/scripts/lv_conf_checker.py index 6823f4e55..c272146c8 100755 --- a/scripts/lv_conf_checker.py +++ b/scripts/lv_conf_checker.py @@ -29,16 +29,19 @@ fout.write( #include -#if defined(LV_CONF_PATH) -#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) -#include "lv_conf.h" -#else -#include "../../lv_conf.h" +/*If lv_conf.h is not skipped include it*/ +#if !defined(LV_CONF_SKIP) && !defined(CONFIG_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 ''' @@ -58,12 +61,28 @@ for i in fin.read().splitlines(): 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}\n' + f'# define {line} CONFIG_{line}\n' + f'# else\n' + f'{d}\n' + f'# endif\n' + f'#endif\n' ) elif re.search('^ *typedef .*;.*$', i): continue #ignore typedefs to avoide redeclaration @@ -73,7 +92,40 @@ for i in fin.read().splitlines(): fout.write( ''' -#endif /*LV_CONF_CHECKER_H*/ + +/*If running without lv_conf.h add typdesf with default value*/ +#if !defined(LV_CONF_SKIP) && !defined(CONFIG_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/scripts/release.py b/scripts/release.py index feaa3707b..c06bf5292 100755 --- a/scripts/release.py +++ b/scripts/release.py @@ -54,6 +54,7 @@ import sys upstream_org_url = "https://github.com/lvgl/" workdir = "./release_tmp" +proj_list = [ "lv_sim_eclipse_sdl"] ver_major = -1 ver_minor = -1 @@ -81,11 +82,12 @@ def cmd(c, exit_on_err = True): def define_set(fn, name, value): print("In " + fn + " set " + name + " to " + value) - new_content = "" + new_content = "" + s = r'^ *# *define +' + str(name).rstrip() + f = open(fn, "r") - for i in f.read().splitlines(): - r = re.search(r'^ *# *define +' + name, i) + r = re.search(s, i) if r: d = i.split("define") i = d[0] + "define " + name + " " + value @@ -106,12 +108,16 @@ def clone_repos(): #cmd("cp -a ../repos/. .") #return - cmd("git clone " + upstream("lvgl") + " lvgl; cd lvgl; git checkout master") + cmd("git clone " + upstream("lvgl") + "; cd lvgl; git checkout master") cmd("git clone " + upstream("lv_examples") + "; cd lv_examples; git checkout master") cmd("git clone " + upstream("lv_drivers") + "; cd lv_drivers; git checkout master") cmd("git clone --recurse-submodules " + upstream("docs") + "; cd docs; git checkout master") cmd("git clone " + upstream("blog") + "; cd blog; git checkout master") + for p in proj_list: + cmd("git clone " + upstream(p) + " --recurse-submodules ; cd " + p + "; git checkout master") + + def get_lvgl_version(br): print("Get LVGL's version") @@ -299,14 +305,25 @@ def update_release_branches(): cmd("cd docs; " + merge_cmd) def publish_master(): + + #Merge LVGL master to dev first to avoid "merge-to-dev.yml" running asynchronous + os.chdir("./lvgl") + cmd("git checkout dev") + cmd("git merge master -X theirs") + cmd("git add .") + cmd("git commit -am 'Merge master'", False) + cmd("git push origin dev") + cmd("git checkout master") + os.chdir("../") + pub_cmd = "git push origin master; git push origin " + ver_str cmd("cd lvgl; " + pub_cmd) cmd("cd lv_examples; " + pub_cmd) cmd("cd lv_drivers; " + pub_cmd) pub_cmd = "git push origin latest; git push origin " + ver_str - cmd("cd docs; " + pub_cmd) - cmd("cd docs; git checkout master; ./update.py " + release_br) + cmd("cd docs; " + pub_cmd) + cmd("cd docs; git checkout master; python 2.7 ./update.py " + release_br) pub_cmd = "git push origin master" cmd("cd blog; " + pub_cmd) @@ -342,7 +359,7 @@ def lvgl_update_master_version(): templ = fnmatch.filter(os.listdir('.'), '*templ*') if templ[0]: print("Updating version in " + templ[0]) - cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0]) + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ ver_str +"/' " + templ[0]) cmd("git commit -am 'Update version'") @@ -367,15 +384,15 @@ def lvgl_update_dev_version(): os.chdir("./lvgl") cmd("git checkout dev") - define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major) - define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor) - define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch) + define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver_major)) + define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver_minor)) + define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver_patch)) define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"") templ = fnmatch.filter(os.listdir('.'), '*templ*') if templ[0]: print("Updating version in " + templ[0]) - cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ dev_ver_str +"/' " + templ[0]) + cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ dev_ver_str +"/' " + templ[0]) cmd("git commit -am 'Update dev version'") @@ -401,22 +418,60 @@ def publish_dev_and_master(): pub_cmd = "git checkout master; git push origin master" cmd("cd lvgl; " + pub_cmd) - cmd("cd docs; git checkout master; ./update.py latest dev") + cmd("cd docs; git checkout master; python 2.7 ./update.py latest dev") + +def projs_update(): + global proj_list, release_br, ver_str + for p in proj_list: + os.chdir("./" + p) + cmd('git checkout master') + print(p + ": upadte lvgl"); + cmd("cd lvgl; git co " + release_br + "; git pull origin " + release_br) + cmd("cp -f lvgl/lv_conf_template.h lv_conf.h") + cmd("sed -i -r 's/#if 0/#if 1/' lv_conf.h") # Enable lv_conf.h + d = {} + with open("confdef.txt") as f: + for line in f: + (key, val) = line.rstrip().split('\t') + d[key] = val + + for k,v in d.items(): + define_set("lv_conf.h", str(k), str(v)) + + if os.path.exists("lv_examples"): + print(p + ": upadte lv_examples"); + cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br) + + if os.path.exists("lv_drivers"): + print(p + ": upadte lv_drivers"); + cmd("cd lv_drivers " + release_br + "; git pull origin " + release_br) + + msg = 'Update to ' + ver_str + cmd("git add .") + cmd('git commit -am "' + msg + '"') + cmd('git push origin master') + cmd("git tag -a " + ver_str + " -m '" + msg + "' " ) + cmd('git push origin ' + ver_str) + + os.chdir("../") + def cleanup(): os.chdir("../") cmd("rm -fr " + workdir) if __name__ == '__main__': + dev_prepare = 'minor' if(len(sys.argv) != 2): - print("Argument error. Usage ./release.py bugfix | minor | major") - exit(1) - - dev_prepare = sys.argv[1] + print("Missing argument. Usage ./release.py bugfix | minor | major") + print("Use minor by deafult") + else: + dev_prepare = sys.argv[1] + if not (dev_prepare in prepare_type): print("Invalid argument. Usage ./release.py bugfix | minor | major") exit(1) - + clone_repos() get_lvgl_version("master") lvgl_prepare() @@ -454,9 +509,9 @@ if __name__ == '__main__': ver_minor = "0" ver_patch = "0" - dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" + dev_ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) + "-dev" - print("Prepare minor version " + ver_str) + print("Prepare minor version " + dev_ver_str) merge_to_dev() merge_from_dev() @@ -465,5 +520,6 @@ if __name__ == '__main__': docs_update_dev_version() publish_dev_and_master() + projs_update() cleanup() diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 8a031535f..5e6a9a15e 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -10,16 +10,19 @@ #include -#if defined(LV_CONF_PATH) -#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) -#include "lv_conf.h" -#else -#include "../../lv_conf.h" +/*If lv_conf.h is not skipped include it*/ +#if !defined(LV_CONF_SKIP) && !defined(CONFIG_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 */ @@ -32,10 +35,18 @@ /* Maximal horizontal and vertical resolution to support by the library.*/ #ifndef LV_HOR_RES_MAX -#define LV_HOR_RES_MAX (480) +# 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 -#define LV_VER_RES_MAX (320) +# 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: @@ -45,43 +56,71 @@ * - 32: ARGB8888 */ #ifndef LV_COLOR_DEPTH -#define LV_COLOR_DEPTH 16 +# 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 -#define LV_COLOR_16_SWAP 0 +# 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 -#define LV_COLOR_SCREEN_TRANSP 0 +# 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 -#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ +# 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 -#define LV_ANTIALIAS 1 +# 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 -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ +# 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 -#define LV_DPI 130 /*[px]*/ +# 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: @@ -92,13 +131,25 @@ * The upper limit of the categories are set below in 0.1 inch unit. */ #ifndef LV_DISP_SMALL_LIMIT -#define LV_DISP_SMALL_LIMIT 30 +# 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 -#define LV_DISP_MEDIUM_LIMIT 50 +# 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 -#define LV_DISP_LARGE_LIMIT 70 +# 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) */ @@ -112,61 +163,113 @@ /* 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 +# 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 -# define LV_MEM_SIZE (32U * 1024U) +# ifdef CONFIG_LV_MEM_SIZE +# define LV_MEM_SIZE CONFIG_LV_MEM_SIZE +# else +# define LV_MEM_SIZE (32U * 1024U) +# endif #endif /* Complier prefix for a big array declaration */ #ifndef LV_MEM_ATTR -# define 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 -# define LV_MEM_ADR 0 +# 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 -# define LV_MEM_AUTO_DEFRAG 1 +# 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 -# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ +# 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 -# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ +# 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 -# define LV_MEM_CUSTOM_FREE free /*Wrapper to 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 -#define LV_MEMCPY_MEMSET_STD 0 +# 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 -#define LV_ENABLE_GC 0 +# 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 -# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +# 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 -# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to 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 -# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_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 */ @@ -179,40 +282,68 @@ /* Input device read period in milliseconds */ #ifndef LV_INDEV_DEF_READ_PERIOD -#define LV_INDEV_DEF_READ_PERIOD 30 +# 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 -#define LV_INDEV_DEF_DRAG_LIMIT 10 +# 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 -#define LV_INDEV_DEF_DRAG_THROW 10 +# 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_PRESSSED`) */ #ifndef LV_INDEV_DEF_LONG_PRESS_TIME -#define LV_INDEV_DEF_LONG_PRESS_TIME 400 +# 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 -#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 +# 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 -#define LV_INDEV_DEF_GESTURE_LIMIT 50 +# 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 -#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3 +# 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 /*================== @@ -221,7 +352,11 @@ /*1: Enable the Animations */ #ifndef LV_USE_ANIMATION -#define LV_USE_ANIMATION 1 +# 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 @@ -231,7 +366,11 @@ /* 1: Enable shadow drawing on rectangles*/ #ifndef LV_USE_SHADOW -#define LV_USE_SHADOW 1 +# 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 @@ -239,63 +378,111 @@ * where shadow size is `shadow_width + radius` * Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ #ifndef LV_SHADOW_CACHE_SIZE -#define LV_SHADOW_CACHE_SIZE 0 +# 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 -#define LV_USE_OUTLINE 1 +# 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 -#define LV_USE_PATTERN 1 +# 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 -#define LV_USE_VALUE_STR 1 +# 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 -#define LV_USE_BLEND_MODES 1 +# 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 -#define LV_USE_OPA_SCALE 1 +# 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 -#define LV_USE_IMG_TRANSFORM 1 +# 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 -#define LV_USE_GROUP 1 +# 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 -#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */ +# 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 -#define LV_USE_GPU_STM32_DMA2D 0 +# 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 -#define 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: Enable file system (might be required for images */ #ifndef LV_USE_FILESYSTEM -#define LV_USE_FILESYSTEM 1 +# 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`)*/ @@ -303,20 +490,36 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /*1: Add a `user_data` to drivers and objects*/ #ifndef LV_USE_USER_DATA -#define LV_USE_USER_DATA 0 +# 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 -#define LV_USE_PERF_MONITOR 0 +# 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 -#define LV_USE_API_EXTENSION_V6 1 +# 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 -#define LV_USE_API_EXTENSION_V7 1 +# 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 /*======================== @@ -325,12 +528,20 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* 1: Enable indexed (palette) images */ #ifndef LV_IMG_CF_INDEXED -#define LV_IMG_CF_INDEXED 1 +# 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 -#define LV_IMG_CF_ALPHA 1 +# 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. @@ -340,7 +551,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * 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 +# 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`)*/ @@ -351,41 +566,69 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* For big endian systems set to 1 */ #ifndef LV_BIG_ENDIAN_SYSTEM -#define LV_BIG_ENDIAN_SYSTEM 0 +# 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 -#define 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 -#define 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 -#define 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 /* 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 +# 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 -#define 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 -#define 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. @@ -395,13 +638,21 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * The default value just prevents a GCC warning. */ #ifndef LV_EXPORT_CONST_INT -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning +# 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 -#define LV_ATTRIBUTE_DMA +# ifdef CONFIG_LV_ATTRIBUTE_DMA +# define LV_ATTRIBUTE_DMA CONFIG_LV_ATTRIBUTE_DMA +# else +# define LV_ATTRIBUTE_DMA +# endif #endif /*=================== @@ -411,14 +662,26 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* 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 +# 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 -#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +# 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 -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ +# 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*/ @@ -429,7 +692,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /*1: Enable the log module*/ #ifndef LV_USE_LOG -#define LV_USE_LOG 0 +# 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: @@ -440,13 +707,21 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * LV_LOG_LEVEL_NONE Do not log anything */ #ifndef LV_LOG_LEVEL -# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN +# 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 -# define LV_LOG_PRINTF 0 +# 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*/ @@ -464,41 +739,69 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * E.g. #define LV_ASSERT_MEM(p) */ #ifndef LV_USE_DEBUG -#define LV_USE_DEBUG 1 +# 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 -#define LV_USE_ASSERT_NULL 1 +# 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 -#define LV_USE_ASSERT_MEM 1 +# 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 -#define LV_USE_ASSERT_MEM_INTEGRITY 0 +# 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 -#define LV_USE_ASSERT_STR 0 +# 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 -#define LV_USE_ASSERT_OBJ 0 +# 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 -#define LV_USE_ASSERT_STYLE 0 +# 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*/ @@ -516,81 +819,177 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* Montserrat fonts with bpp = 4 * https://fonts.google.com/specimen/Montserrat */ #ifndef LV_FONT_MONTSERRAT_12 -#define LV_FONT_MONTSERRAT_12 0 +# 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 -#define LV_FONT_MONTSERRAT_14 1 +# 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 -#define LV_FONT_MONTSERRAT_16 0 +# 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 -#define LV_FONT_MONTSERRAT_18 0 +# 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 -#define LV_FONT_MONTSERRAT_20 0 +# 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 -#define LV_FONT_MONTSERRAT_22 0 +# 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 -#define LV_FONT_MONTSERRAT_24 0 +# 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 -#define LV_FONT_MONTSERRAT_26 0 +# 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 -#define LV_FONT_MONTSERRAT_28 0 +# 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 -#define LV_FONT_MONTSERRAT_30 0 +# 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 -#define LV_FONT_MONTSERRAT_32 0 +# 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 -#define LV_FONT_MONTSERRAT_34 0 +# 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 -#define LV_FONT_MONTSERRAT_36 0 +# 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 -#define LV_FONT_MONTSERRAT_38 0 +# 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 -#define LV_FONT_MONTSERRAT_40 0 +# 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 -#define LV_FONT_MONTSERRAT_42 0 +# 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 -#define LV_FONT_MONTSERRAT_44 0 +# 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 -#define LV_FONT_MONTSERRAT_46 0 +# 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 -#define LV_FONT_MONTSERRAT_48 0 +# 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 -#define LV_FONT_MONTSERRAT_12_SUBPX 0 +# 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 -#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +# 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 -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/ +# 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 -#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ +# 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 -#define LV_FONT_UNSCII_8 0 +# 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 /* Optionally declare your custom fonts here. @@ -600,26 +999,42 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * LV_FONT_DECLARE(my_font_2) */ #ifndef LV_FONT_CUSTOM_DECLARE -#define 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 -#define LV_FONT_FMT_TXT_LARGE 0 +# 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 -#define LV_USE_FONT_COMPRESSED 1 +# 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 -#define LV_USE_FONT_SUBPX 1 +# 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. @@ -627,7 +1042,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * With "normal" font it doesn't matter. */ #ifndef LV_FONT_SUBPX_BGR -#define LV_FONT_SUBPX_BGR 0 +# 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 @@ -642,13 +1061,21 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* No theme, you can apply your styles as you need * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ #ifndef LV_USE_THEME_EMPTY - #define LV_USE_THEME_EMPTY 1 +# 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 - #define LV_USE_THEME_TEMPLATE 1 +# 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. @@ -659,7 +1086,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state) * */ #ifndef LV_USE_THEME_MATERIAL - #define LV_USE_THEME_MATERIAL 1 +# 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. @@ -668,35 +1099,75 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * white. Else the colors are inverted. * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ #ifndef LV_USE_THEME_MONO - #define LV_USE_THEME_MONO 1 +# 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 -#define LV_THEME_DEFAULT_INCLUDE /*Include a header for the init. function*/ +# 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 -#define LV_THEME_DEFAULT_INIT lv_theme_material_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 -#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1) +# 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 -#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6) +# 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 -#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT +# 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 -#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14 +# 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 -#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14 +# 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 -#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14 +# 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 -#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14 +# 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 /*================= @@ -709,35 +1180,59 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * - LV_TXT_ENC_ASCII * */ #ifndef LV_TXT_ENC -#define LV_TXT_ENC LV_TXT_ENC_UTF8 +# 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 -#define 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 -#define LV_TXT_LINE_BREAK_LONG_LEN 0 +# 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 -#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 +# 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 -#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 +# 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 -#define 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. @@ -745,7 +1240,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * 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 +# 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: @@ -753,7 +1252,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * `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 +# 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 @@ -761,26 +1264,50 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * In these languages characters should be replaced with * an other form based on their position in the text */ #ifndef LV_USE_ARABIC_PERSIAN_CHARS -#define LV_USE_ARABIC_PERSIAN_CHARS 0 +# 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 -#define LV_SPRINTF_CUSTOM 0 +# 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 -# define 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 -# define lv_snprintf snprintf +# ifdef CONFIG_lv_snprintf +# define lv_snprintf CONFIG_lv_snprintf +# else +# define lv_snprintf snprintf +# endif #endif #ifndef lv_vsnprintf -# define lv_vsnprintf 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 -# define LV_SPRINTF_DISABLE_FLOAT 1 +# 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*/ @@ -792,22 +1319,38 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /*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 -#define LV_USE_USER_DATA_FREE 0 +# 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 -# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/ +# 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 -# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/ +# 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 -#define LV_USE_OBJ_REALIGN 1 +# 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. @@ -816,7 +1359,11 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * 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_TINY +# 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 /*================== @@ -828,159 +1375,283 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /*Arc (dependencies: -)*/ #ifndef LV_USE_ARC -#define LV_USE_ARC 1 +# 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 -#define LV_USE_BAR 1 +# 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 -#define LV_USE_BTN 1 +# 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 -#define LV_USE_BTNMATRIX 1 +# 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 -#define LV_USE_CALENDAR 1 +# 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 -# define LV_CALENDAR_WEEK_STARTS_MONDAY 0 +# 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 -#define LV_USE_CANVAS 1 +# 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 -#define LV_USE_CHECKBOX 1 +# 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 -#define LV_USE_CHART 1 +# 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 -# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256 +# 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 -#define LV_USE_CONT 1 +# 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 -#define LV_USE_CPICKER 1 +# 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 -#define LV_USE_DROPDOWN 1 +# 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 -# define LV_DROPDOWN_DEF_ANIM_TIME 200 +# 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 -#define LV_USE_GAUGE 1 +# 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 -#define LV_USE_IMG 1 +# 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 -#define LV_USE_IMGBTN 1 +# 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 -# define LV_IMGBTN_TILED 0 +# 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 -#define LV_USE_KEYBOARD 1 +# 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 -#define LV_USE_LABEL 1 +# 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 -# define LV_LABEL_DEF_SCROLL_SPEED 25 +# 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 -# define LV_LABEL_WAIT_CHAR_COUNT 3 +# 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 -# define LV_LABEL_TEXT_SEL 0 +# 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 -# define LV_LABEL_LONG_TXT_HINT 0 +# 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 -#define LV_USE_LED 1 +# 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 -# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/ +# 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 -# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/ +# 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 -#define LV_USE_LINE 1 +# 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 -#define LV_USE_LIST 1 +# 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 -# define LV_LIST_DEF_ANIM_TIME 100 +# 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 -#define LV_USE_LINEMETER 1 +# 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. @@ -990,130 +1661,226 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * 2: Best precision */ #ifndef LV_LINEMETER_PRECISE -# define LV_LINEMETER_PRECISE 0 +# 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 -#define LV_USE_OBJMASK 1 +# 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 -#define LV_USE_MSGBOX 1 +# 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 -#define LV_USE_PAGE 1 +# 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 -# define LV_PAGE_DEF_ANIM_TIME 400 +# 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 -#define LV_USE_SPINNER 1 +# 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 -# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/ +# 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 -# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/ +# 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 -# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC +# 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 -#define LV_USE_ROLLER 1 +# 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 -# define LV_ROLLER_DEF_ANIM_TIME 200 +# 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 -# define LV_ROLLER_INF_PAGES 7 +# 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 -/*Rotary (dependencies: lv_arc, lv_btn)*/ -#ifndef LV_USE_ROTARY -#define LV_USE_ROTARY 1 -#endif /*Slider (dependencies: lv_bar)*/ #ifndef LV_USE_SLIDER -#define LV_USE_SLIDER 1 +# 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 -#define LV_USE_SPINBOX 1 +# 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 -#define LV_USE_SWITCH 1 +# 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 -#define LV_USE_TEXTAREA 1 +# 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 -# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ +# 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 -# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +# 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 -#define LV_USE_TABLE 1 +# 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 -# define LV_TABLE_COL_MAX 12 +# 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 #endif /*Tab (dependencies: lv_page, lv_btnm)*/ #ifndef LV_USE_TABVIEW -#define LV_USE_TABVIEW 1 +# 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 -# define LV_TABVIEW_DEF_ANIM_TIME 300 +# 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 -#define LV_USE_TILEVIEW 1 +# 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 -# define LV_TILEVIEW_DEF_ANIM_TIME 300 +# 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 -#define LV_USE_WIN 1 +# ifdef CONFIG_LV_USE_WIN +# define LV_USE_WIN CONFIG_LV_USE_WIN +# else +# define LV_USE_WIN 1 +# endif #endif /*================== @@ -1122,9 +1889,46 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ #ifndef _CRT_SECURE_NO_WARNINGS -# define _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 -#endif /*LV_CONF_CHECKER_H*/ + +/*If running without lv_conf.h add typdesf with default value*/ +#if defined(LV_CONF_SKIP) || defined(CONFIG_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/lv_core/lv_disp.c b/src/lv_core/lv_disp.c index 14f480dd0..3f10a9053 100644 --- a/src/lv_core/lv_disp.c +++ b/src/lv_core/lv_disp.c @@ -352,6 +352,21 @@ 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 diff --git a/src/lv_core/lv_disp.h b/src/lv_core/lv_disp.h index 888a0c093..3083c46d2 100644 --- a/src/lv_core/lv_disp.h +++ b/src/lv_core/lv_disp.h @@ -133,6 +133,12 @@ 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. diff --git a/src/lv_core/lv_group.c b/src/lv_core/lv_group.c index d5567b1ab..e3dc1ac2e 100644 --- a/src/lv_core/lv_group.c +++ b/src/lv_core/lv_group.c @@ -328,9 +328,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); + } } /** diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 24c5c0d94..119fea2c2 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -1111,9 +1111,9 @@ static void indev_click_focus(lv_indev_proc_t * proc) if(indev_reset_check(proc)) return; } - lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL); + lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL); if(indev_reset_check(proc)) return; - lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL); + lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL); if(indev_reset_check(proc)) return; } } @@ -1152,9 +1152,9 @@ static void indev_click_focus(lv_indev_proc_t * proc) if(indev_reset_check(proc)) return; } else { - lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL); + lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL); if(indev_reset_check(proc)) return; - lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL); + lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL); if(indev_reset_check(proc)) return; } } diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index 78f400ed3..d440179e6 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -59,7 +59,6 @@ typedef struct _lv_event_temp_data { struct _lv_event_temp_data * prev; } lv_event_temp_data_t; - /********************** * STATIC PROTOTYPES **********************/ @@ -418,13 +417,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*/ } } @@ -727,6 +722,8 @@ void lv_obj_clear_flag(lv_obj_t * obj, lv_obj_flag_t f) obj->flags &= (~f); } + + /** * Set the state (fully overwrite) of an object. * If specified in the styles a transition animation will be started @@ -745,10 +742,16 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) _lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); #else lv_state_t prev_state = obj->state; + + _lv_style_state_cmp_t cmp_res = _lv_obj_style_state_compare(obj, prev_state, new_state); + obj->state = new_state; + /*If there is no difference in styles there is nothing else to do*/ + if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return; + uint8_t part; - for(part = 0; part < _LV_OBJ_PART_REAL_LAST; 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*/ if(style_list->ignore_trans) continue; @@ -773,8 +776,12 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) } } - _lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); + + if(cmp_res == _LV_STYLE_STATE_CMP_DIFF) _lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); } + + if(cmp_res == _LV_STYLE_STATE_CMP_VISUAL_DIFF) lv_obj_invalidate(obj); + #endif @@ -946,6 +953,7 @@ lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t if(obj) { if(lv_obj_has_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE) && obj->parent) { + lv_res_t res = lv_event_send(obj->parent, event, data); if(res != LV_RES_OK) { return LV_RES_INV; @@ -1587,17 +1595,13 @@ static void obj_del_core(lv_obj_t * obj) /*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*/ + /*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)); } lv_event_mark_deleted(obj); diff --git a/src/lv_core/lv_obj_style.c b/src/lv_core/lv_obj_style.c index 7516837e3..ae50d2545 100644 --- a/src/lv_core/lv_obj_style.c +++ b/src/lv_core/lv_obj_style.c @@ -42,6 +42,38 @@ typedef struct { } 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_corder :1; + uint32_t border_post :1; +}style_snapshot_t; + + /********************** * STATIC PROTOTYPES **********************/ @@ -52,6 +84,8 @@ static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv 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 style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot); +static _lv_style_state_cmp_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2); #endif #if LV_STYLE_CACHE_LEVEL >= 1 @@ -981,6 +1015,37 @@ void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, u #endif +/** + * Compare the style properties of an object in 2 different states + * @param obj pointer to an object + * @param state1 a state + * @param state2 an other state + * @return an element of `_lv_style_state_cmp_t` + */ +_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2) +{ + _lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_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*/ + + style_snapshot_t shot1; + style_snapshot_t shot2; + + obj->state = state1; + style_snapshot(obj, part, &shot1); + + obj->state = state2; + style_snapshot(obj, part, &shot2); + + _lv_style_state_cmp_t res_part = style_snapshot_compare(&shot1, &shot2); + if(res_part == _LV_STYLE_STATE_CMP_DIFF) return _LV_STYLE_STATE_CMP_DIFF; + if(res_part == _LV_STYLE_STATE_CMP_VISUAL_DIFF) res = _LV_STYLE_STATE_CMP_VISUAL_DIFF; + } + return res; +} + /********************** * STATIC FUNCTIONS **********************/ @@ -1159,6 +1224,81 @@ static void trans_anim_ready_cb(lv_anim_t * a) lv_mem_free(tr); } +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_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_corder = 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); +} + +static _lv_style_state_cmp_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2) +{ + if(memcmp(shot1, shot2, sizeof(style_snapshot_t)) == 0) return _LV_STYLE_STATE_CMP_SAME; + + + if(shot1->pad_top != shot2->pad_top) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->pad_bottom != shot2->pad_bottom) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->pad_left != shot2->pad_right) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->pad_right != shot2->pad_right) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->pad_top != shot2->pad_top) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->pad_inner != shot2->pad_inner) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->margin_top != shot2->margin_top) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->margin_bottom != shot2->margin_bottom) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->margin_left != shot2->margin_right) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->margin_right != shot2->margin_right) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->margin_top != shot2->margin_top) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->transform_width != shot2->transform_width) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->transform_height != shot2->transform_height) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->transform_angle != shot2->transform_angle) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->transform_zoom != shot2->transform_zoom) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.outline_width != shot2->rect.outline_width) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.outline_pad != shot2->rect.outline_pad) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.value_font != shot2->rect.value_font) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.value_align != shot2->rect.value_align) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.value_font != shot2->rect.value_font) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.shadow_spread != shot2->rect.shadow_spread) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.shadow_width != shot2->rect.shadow_width) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.shadow_ofs_x != shot2->rect.shadow_ofs_x) return _LV_STYLE_STATE_CMP_DIFF; + if(shot1->rect.shadow_ofs_y != shot2->rect.shadow_ofs_y) return _LV_STYLE_STATE_CMP_DIFF; + + /*If not returned earlier its just a visual difference, a simple redraw is enough*/ + return _LV_STYLE_STATE_CMP_VISUAL_DIFF; +} #endif #if LV_STYLE_CACHE_LEVEL >= 1 @@ -1218,7 +1358,9 @@ static bool style_prop_is_cacheable(lv_style_property_t prop) */ static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop) { - printf("update cache\n"); + static uint32_t cnt = 0; + cnt++; + printf("update cache: %d\n", cnt); if(style_prop_is_cacheable(prop) == false) return; diff --git a/src/lv_core/lv_obj_style.h b/src/lv_core/lv_obj_style.h index fddf35f93..6bc91481b 100644 --- a/src/lv_core/lv_obj_style.h +++ b/src/lv_core/lv_obj_style.h @@ -26,7 +26,12 @@ extern "C" { **********************/ /* Can't include lv_obj.h because it includes this header file */ struct _lv_obj_t; -typedef struct _lv_obj_t lv_obj_t; + +typedef enum { + _LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/ + _LV_STYLE_STATE_CMP_VISUAL_DIFF, /*The differences can be shown with a simple redraw*/ + _LV_STYLE_STATE_CMP_DIFF, /*There are larger differences, the objects need to ne notfied*/ +} _lv_style_state_cmp_t; /********************** * GLOBAL PROTOTYPES @@ -292,6 +297,16 @@ void _lv_obj_remove_style_trans(lv_obj_t * obj); */ void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state, lv_state_t new_state, uint32_t time, uint32_t delay, lv_anim_path_t * path); + +/** + * Compare the style properties of an object in 2 different states + * @param obj pointer to an object + * @param state1 a state + * @param state2 an other state + * @return an element of `_lv_style_state_cmp_t` + */ +_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2); + #endif diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c index 15079291c..43e87b0f6 100644 --- a/src/lv_core/lv_refr.c +++ b/src/lv_core/lv_refr.c @@ -571,11 +571,16 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj) lv_obj_t * found_p = NULL; /*If this object is fully cover the draw area check the children too */ - if(_lv_area_is_in(area_p, &obj->coords, 0) && (obj->flags & LV_OBJ_FLAG_HIDDEN) == 0) { - lv_design_res_t design_res = obj->design_cb ? obj->design_cb(obj, area_p, - LV_DESIGN_COVER_CHK) : LV_DESIGN_RES_NOT_COVER; + if(_lv_area_is_in(area_p, &obj->coords, 0) && lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) == false) { + lv_design_res_t design_res = obj->design_cb(obj, area_p, LV_DESIGN_COVER_CHK); if(design_res == LV_DESIGN_RES_MASKED) return NULL; +#if LV_USE_OPA_SCALE + if(design_res == LV_DESIGN_RES_COVER && lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN) != LV_OPA_COVER) { + design_res = LV_DESIGN_RES_NOT_COVER; + } +#endif + lv_obj_t * i; _LV_LL_READ(obj->child_ll, i) { found_p = lv_refr_get_top_obj(area_p, i); @@ -741,6 +746,8 @@ static void lv_refr_vdb_flush(void) /*Flush the rendered content to the display*/ lv_disp_t * disp = _lv_refr_get_disp_refreshing(); + if (disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver); + if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act); if(vdb->buf1 && vdb->buf2) { diff --git a/src/lv_draw/lv_draw_blend.c b/src/lv_draw/lv_draw_blend.c index a7d9e0d1d..f4de48e7e 100644 --- a/src/lv_draw/lv_draw_blend.c +++ b/src/lv_draw/lv_draw_blend.c @@ -138,7 +138,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_ const lv_area_t * disp_area = &vdb->area; lv_color_t * disp_buf = vdb->buf_act; - + if (disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver); + /* Get clipped fill area which is the real draw area. * It is always the same or inside `fill_area` */ lv_area_t draw_area; @@ -212,6 +213,8 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a const lv_area_t * disp_area = &vdb->area; lv_color_t * disp_buf = vdb->buf_act; + if (disp->driver.gpu_wait_cb) disp->driver.gpu_wait_cb(&disp->driver); + /* Now `draw_area` has absolute coordinates. * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ draw_area.x1 -= disp_area->x1; diff --git a/src/lv_gpu/lv_gpu_stm32_dma2d.c b/src/lv_gpu/lv_gpu_stm32_dma2d.c index d5c8e40dc..f11c4c6a4 100644 --- a/src/lv_gpu/lv_gpu_stm32_dma2d.c +++ b/src/lv_gpu/lv_gpu_stm32_dma2d.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ #include "lv_gpu_stm32_dma2d.h" +#include "../lv_core/lv_disp.h" #include "../lv_core/lv_refr.h" #if LV_USE_GPU_STM32_DMA2D @@ -216,11 +217,10 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color static void invalidate_cache(void) { -#if __DCACHE_PRESENT - if(SCB->CCR & (uint32_t)SCB_CCR_DC_Msk) { + lv_disp_t * disp = _lv_refr_get_disp_refreshing(); + if(disp->driver.clean_dcache_cb) disp->driver.clean_dcache_cb(&disp->driver); + else SCB_CleanInvalidateDCache(); - } -#endif } static void dma2d_wait(void) diff --git a/src/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h index e99830b19..7a1eef6b0 100644 --- a/src/lv_hal/lv_hal_disp.h +++ b/src/lv_hal/lv_hal_disp.h @@ -111,7 +111,14 @@ typedef struct _disp_drv_t { * User can execute very simple tasks here or yield the task */ void (*wait_cb)(struct _disp_drv_t * disp_drv); + /** OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned */ + void (*clean_dcache_cb)(struct _disp_drv_t * disp_drv); + + /** OPTIONAL: called to wait while the gpu is working */ + void (*gpu_wait_cb)(struct _disp_drv_t * disp_drv); + #if LV_USE_GPU + /** OPTIONAL: Blend two memories using opacity (GPU only)*/ void (*gpu_blend_cb)(struct _disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); diff --git a/src/lv_misc/lv_txt.c b/src/lv_misc/lv_txt.c index a29a3c158..20c8326bb 100644 --- a/src/lv_misc/lv_txt.c +++ b/src/lv_misc/lv_txt.c @@ -436,6 +436,8 @@ void _lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt) { size_t old_len = strlen(txt_buf); size_t ins_len = strlen(ins_txt); + if(ins_len == 0) return; + size_t new_len = ins_len + old_len; pos = _lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/ diff --git a/src/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h index 3647f48f0..8297b0b53 100644 --- a/src/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -109,9 +109,6 @@ typedef enum { #if LV_USE_ROLLER LV_THEME_ROLLER, #endif -#if LV_USE_ROTARY - LV_THEME_ROTARY, -#endif #if LV_USE_SLIDER LV_THEME_SLIDER, #endif diff --git a/src/lv_widgets/lv_arc.c b/src/lv_widgets/lv_arc.c index 4afc26609..92fe9ec6c 100644 --- a/src/lv_widgets/lv_arc.c +++ b/src/lv_widgets/lv_arc.c @@ -34,6 +34,7 @@ static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part); static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle, lv_arc_part_t part); static void get_center(lv_obj_t * arc, lv_point_t * center, lv_coord_t * arc_r); static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); +static void value_update(lv_obj_t * arc); /********************** * STATIC VARIABLES @@ -87,6 +88,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy) ext->min_value = 0; ext->max_value = 100; ext->dragging = false; + ext->adjustable = false; ext->chg_rate = 540; ext->last_tick = lv_tick_get(); ext->last_angle = ext->arc_angle_end; @@ -119,6 +121,7 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy) ext->min_value = copy_ext->min_value; ext->max_value = copy_ext->max_value; ext->dragging = copy_ext->dragging; + ext->adjustable = copy_ext->adjustable; ext->chg_rate = copy_ext->chg_rate; ext->last_tick = copy_ext->last_tick; ext->last_angle = copy_ext->last_angle; @@ -397,35 +400,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value) if(ext->cur_value == new_value) return; ext->cur_value = new_value; - int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end; - if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360; - - int16_t angle; - switch(ext->type) { - case LV_ARC_TYPE_SYMMETRIC: - bg_midpoint = (ext->bg_angle_start + bg_end) / 2; - range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2; - - if(ext->cur_value < range_midpoint) { - angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint); - lv_arc_set_start_angle(arc, angle); - lv_arc_set_end_angle(arc, bg_midpoint); - } - else { - angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end); - lv_arc_set_start_angle(arc, bg_midpoint); - lv_arc_set_end_angle(arc, angle); - } - break; - case LV_ARC_TYPE_REVERSE: - angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end); - lv_arc_set_start_angle(arc, angle); - break; - default: /** LV_ARC_TYPE_NORMAL*/ - angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end); - lv_arc_set_end_angle(arc, angle); - } - ext->last_angle = angle; /*Cache angle for slew rate limiting*/ + value_update(arc); } /** @@ -451,7 +426,7 @@ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max) ext->cur_value = max; } - lv_arc_set_value(arc, ext->cur_value); + value_update(arc); /* value has changed relative to the new range */ } /** @@ -468,6 +443,24 @@ void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t rate) ext->chg_rate = rate; } +/** + * Set whether the arc is adjustable. + * @param arc pointer to a arc object + * @param adjustable whether the arc has a knob that can be dragged + */ +void lv_arc_set_adjustable(lv_obj_t * arc, bool adjustable) +{ + LV_ASSERT_OBJ(arc, LV_OBJX_NAME); + + lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc); + if(ext->adjustable == adjustable) + return; + + ext->adjustable = adjustable; + if(!adjustable) + ext->dragging = false; + lv_obj_invalidate(arc); +} /*===================== * Getter functions @@ -595,6 +588,19 @@ lv_arc_type_t lv_arc_get_type(const lv_obj_t * arc) return ext->type; } +/** + * Get whether the arc is adjustable. + * @param arc pointer to a arc object + * @return whether the arc has a knob that can be dragged + */ +bool lv_arc_get_adjustable(lv_obj_t * arc) +{ + LV_ASSERT_OBJ(arc, LV_OBJX_NAME); + + lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc); + return ext->adjustable; +} + /*===================== * Other functions *====================*/ @@ -665,14 +671,16 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area &arc_dsc); } - lv_area_t knob_area; - get_knob_area(arc, ¢er, arc_r, &knob_area); + if(ext->adjustable) { + lv_area_t knob_area; + get_knob_area(arc, ¢er, arc_r, &knob_area); - lv_draw_rect_dsc_t knob_rect_dsc; - lv_draw_rect_dsc_init(&knob_rect_dsc); - lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_KNOB, &knob_rect_dsc); + lv_draw_rect_dsc_t knob_rect_dsc; + lv_draw_rect_dsc_init(&knob_rect_dsc); + lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_KNOB, &knob_rect_dsc); - lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc); + lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc); + } } /*Post draw when the children are drawn*/ @@ -708,6 +716,9 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param) lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc); if(sign == LV_SIGNAL_PRESSING) { + /* Only adjustable arcs can be dragged */ + if(!ext->adjustable) return res; + lv_indev_t * indev = lv_indev_get_act(); if(indev == NULL) return res; @@ -803,6 +814,8 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param) } else if(sign == LV_SIGNAL_CONTROL) { + if(!ext->adjustable) return res; + char c = *((char *)param); int16_t old_value = ext->cur_value; @@ -1034,4 +1047,43 @@ static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t knob_area->y2 = center->y + knob_y + bottom_knob + indic_width_half; } +/** + * Used internally to update arc angles after a value change + * @param arc pointer to a arc object + */ +static void value_update(lv_obj_t * arc) +{ + lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc); + + int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end; + if (ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360; + + int16_t angle; + switch(ext->type) { + case LV_ARC_TYPE_SYMMETRIC: + bg_midpoint = (ext->bg_angle_start + bg_end) / 2; + range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2; + + if (ext->cur_value < range_midpoint) { + angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint); + lv_arc_set_start_angle(arc, angle); + lv_arc_set_end_angle(arc, bg_midpoint); + } else { + angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end); + lv_arc_set_start_angle(arc, bg_midpoint); + lv_arc_set_end_angle(arc, angle); + } + break; + case LV_ARC_TYPE_REVERSE: + angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end); + lv_arc_set_start_angle(arc, angle); + break; + default: /** LV_ARC_TYPE_NORMAL*/ + angle = _lv_map(ext->cur_value, ext->min_value, ext->max_value, ext->bg_angle_start, bg_end); + lv_arc_set_end_angle(arc, angle); + lv_arc_set_start_angle(arc, ext->bg_angle_start); + } + ext->last_angle = angle; /*Cache angle for slew rate limiting*/ +} + #endif diff --git a/src/lv_widgets/lv_arc.h b/src/lv_widgets/lv_arc.h index 56ed81e39..53c145c05 100644 --- a/src/lv_widgets/lv_arc.h +++ b/src/lv_widgets/lv_arc.h @@ -48,8 +48,9 @@ typedef struct { int16_t cur_value; /*Current value of the arc*/ int16_t min_value; /*Minimum value of the arc*/ int16_t max_value; /*Maximum value of the arc*/ - uint16_t dragging : 1; - uint16_t type : 2; + uint16_t dragging :1; + uint16_t type :2; + uint16_t adjustable :1; uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ uint32_t last_tick; /*Last dragging event timestamp of the arc*/ int16_t last_angle; /*Last dragging angle of the arc*/ @@ -167,6 +168,13 @@ void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max); */ void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t threshold); +/** + * Set whether the arc is adjustable. + * @param arc pointer to a arc object + * @param adjustable whether the arc has a knob that can be dragged + */ +void lv_arc_set_adjustable(lv_obj_t * arc, bool adjustable); + /*===================== * Getter functions *====================*/ @@ -234,6 +242,13 @@ int16_t lv_arc_get_max_value(const lv_obj_t * arc); */ bool lv_arc_is_dragged(const lv_obj_t * arc); +/** + * Get whether the arc is adjustable. + * @param arc pointer to a arc object + * @return whether the arc has a knob that can be dragged + */ +bool lv_arc_get_adjustable(lv_obj_t * arc); + /*===================== * Other functions *====================*/ diff --git a/src/lv_widgets/lv_btnmatrix.c b/src/lv_widgets/lv_btnmatrix.c index 9f39dd638..d4a4a5c59 100644 --- a/src/lv_widgets/lv_btnmatrix.c +++ b/src/lv_widgets/lv_btnmatrix.c @@ -208,7 +208,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[]) /*Only deal with the non empty lines*/ if(btn_cnt != 0) { /*Calculate the width of all units*/ - lv_coord_t all_unit_w = max_w - ((btn_cnt - 1) * inner); + lv_coord_t all_unit_w = max_w - ((unit_cnt - 1) * inner); /*Set the button size and positions and set the texts*/ uint16_t i; @@ -216,19 +216,20 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[]) unit_act_cnt = 0; for(i = 0; i < btn_cnt; i++) { + uint8_t btn_unit_w = get_button_width(ext->ctrl_bits[btn_i]); /* one_unit_w = all_unit_w / unit_cnt * act_unit_w = one_unit_w * button_width * do this two operations but the multiply first to divide a greater number */ - lv_coord_t act_unit_w = (all_unit_w * get_button_width(ext->ctrl_bits[btn_i])) / unit_cnt; + lv_coord_t act_unit_w = (all_unit_w * btn_unit_w) / unit_cnt + inner * (btn_unit_w - 1); act_unit_w--; /*-1 because e.g. width = 100 means 101 pixels (0..100)*/ /*Always recalculate act_x because of rounding errors */ if(base_dir == LV_BIDI_DIR_RTL) { - act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner; + act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner; act_x = lv_obj_get_width(btnm) - right - act_x - act_unit_w - 1; } else { - act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner + + act_x = (unit_act_cnt * all_unit_w) / unit_cnt + unit_act_cnt * inner + left; } /* Set the button's area. @@ -243,7 +244,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[]) lv_area_set(&ext->button_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h); } - unit_act_cnt += get_button_width(ext->ctrl_bits[btn_i]); + unit_act_cnt += btn_unit_w; i_tot++; btn_i++; diff --git a/src/lv_widgets/lv_gauge.c b/src/lv_widgets/lv_gauge.c index f7f47dc40..97ccd54f3 100644 --- a/src/lv_widgets/lv_gauge.c +++ b/src/lv_widgets/lv_gauge.c @@ -619,7 +619,6 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area) lv_draw_img_dsc_t img_dsc; lv_draw_img_dsc_init(&img_dsc); lv_obj_init_draw_img_dsc(gauge, LV_GAUGE_PART_MAIN, &img_dsc); - img_dsc.recolor_opa = LV_OPA_COVER; img_dsc.pivot.x = ext->needle_img_pivot.x; img_dsc.pivot.y = ext->needle_img_pivot.y; diff --git a/src/lv_widgets/lv_img.c b/src/lv_widgets/lv_img.c index 911db34ea..d7fb1a85d 100644 --- a/src/lv_widgets/lv_img.c +++ b/src/lv_widgets/lv_img.c @@ -580,6 +580,9 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area /*Non true color format might have "holes"*/ if(ext->cf != LV_IMG_CF_TRUE_COLOR && ext->cf != LV_IMG_CF_RAW) return LV_DESIGN_RES_NOT_COVER; + /*With not LV_OPA_COVER images acn't cover an area */ + if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER; + int32_t angle_final = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN); angle_final += ext->angle; @@ -602,7 +605,10 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area if(_lv_area_is_in(clip_area, &a, 0) == false) return LV_DESIGN_RES_NOT_COVER; } - if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER; +#if LV_USE_BLEND_MODES + if(lv_obj_get_style_bg_blend_mode(img, LV_IMG_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER; + if(lv_obj_get_style_image_blend_mode(img, LV_IMG_PART_MAIN) != LV_BLEND_MODE_NORMAL) return LV_DESIGN_RES_NOT_COVER; +#endif return LV_DESIGN_RES_COVER; } diff --git a/src/lv_widgets/lv_keyboard.c b/src/lv_widgets/lv_keyboard.c index fc41ee1ba..9138b171e 100644 --- a/src/lv_widgets/lv_keyboard.c +++ b/src/lv_widgets/lv_keyboard.c @@ -60,7 +60,7 @@ static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = { LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2 }; -static const char * const default_kb_map_spec[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", LV_SYMBOL_BACKSPACE, "\n", +static const char * const default_kb_map_spec[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", LV_SYMBOL_BACKSPACE, "\n", "abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n", "\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n", LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, "" diff --git a/src/lv_widgets/lv_linemeter.c b/src/lv_widgets/lv_linemeter.c index 73b5f3b12..eac998bb9 100644 --- a/src/lv_widgets/lv_linemeter.c +++ b/src/lv_widgets/lv_linemeter.c @@ -76,6 +76,7 @@ lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy) ext->line_cnt = 18; ext->scale_angle = 240; ext->angle_ofs = 0; + ext->mirrored = 0; /*The signal and design functions are not copied so set them here*/ lv_obj_set_signal_cb(linemeter, lv_linemeter_signal); diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index 0c81100a0..8d6ea7a09 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -118,6 +118,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new page object*/ if(copy == NULL) { ext->scrl = lv_cont_create(page, NULL); + lv_obj_set_focus_parent(ext->scrl, true); lv_obj_set_drag(ext->scrl, true); lv_obj_set_drag_throw(ext->scrl, true); lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST); @@ -131,6 +132,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_signal_cb(page, lv_page_signal); lv_obj_set_design_cb(page, lv_page_design); + lv_page_set_scrollbar_mode(page, ext->scrlbar.mode); lv_theme_apply(page, LV_THEME_PAGE); @@ -1044,32 +1046,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi } } } - else if(sign == LV_SIGNAL_FOCUS) { -#if LV_USE_GROUP - if(lv_obj_get_group(page)) { - lv_group_focus_obj(page); - } - else -#endif - { - res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL); - if(res != LV_RES_OK) return res; - res = lv_event_send(page, LV_EVENT_FOCUSED, NULL); - if(res != LV_RES_OK) return res; - } - } - else if(sign == LV_SIGNAL_DEFOCUS) { - bool in_group = false; -#if LV_USE_GROUP - in_group = lv_obj_get_group(page) ? true : false; -#endif - if(in_group == false) { - res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL); - if(res != LV_RES_OK) return res; - res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL); - if(res != LV_RES_OK) return res; - } - } else if(sign == LV_SIGNAL_CLEANUP) { page_ext->scrl = NULL; diff --git a/src/lv_widgets/lv_roller.c b/src/lv_widgets/lv_roller.c index 7b3ba4b5e..702c7ccd1 100644 --- a/src/lv_widgets/lv_roller.c +++ b/src/lv_widgets/lv_roller.c @@ -585,10 +585,8 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par /* Include the ancient signal function */ if(sign != LV_SIGNAL_CONTROL) { /*Don't let the page to scroll on keys*/ -#if LV_USE_GROUP res = ancestor_signal(roller, sign, param); if(res != LV_RES_OK) return res; -#endif } if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME); @@ -966,6 +964,18 @@ static void refr_width(lv_obj_t * roller) lv_style_int_t left = lv_obj_get_style_pad_left(roller, LV_ROLLER_PART_BG); lv_style_int_t right = lv_obj_get_style_pad_right(roller, LV_ROLLER_PART_BG); + const lv_font_t * base_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG); + const lv_font_t * sel_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_SELECTED); + + /*The selected text might be larger to get its size*/ + if(base_font != sel_font) { + lv_coord_t letter_sp = lv_obj_get_style_text_letter_space(roller, LV_ROLLER_PART_SELECTED); + lv_coord_t line_sp = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_SELECTED); + lv_point_t p; + _lv_txt_get_size(&p, lv_label_get_text(label), sel_font, letter_sp, line_sp, LV_COORD_MAX, LV_TXT_FLAG_NONE); + if(label_w < p.x)label_w = p.x; + } + lv_obj_set_width(roller, label_w + left + right); } diff --git a/src/lv_widgets/lv_spinbox.c b/src/lv_widgets/lv_spinbox.c index 1fac9de80..28f2de153 100644 --- a/src/lv_widgets/lv_spinbox.c +++ b/src/lv_widgets/lv_spinbox.c @@ -390,10 +390,8 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p /* Include the ancient signal function */ if(sign != LV_SIGNAL_CONTROL) { -#if LV_USE_GROUP res = ancestor_signal(spinbox, sign, param); if(res != LV_RES_OK) return res; -#endif } if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME); diff --git a/src/lv_widgets/lv_textarea.c b/src/lv_widgets/lv_textarea.c index 545cfaf2c..f922e2264 100644 --- a/src/lv_widgets/lv_textarea.c +++ b/src/lv_widgets/lv_textarea.c @@ -1468,6 +1468,8 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param lv_textarea_set_cursor_pos(ta, 0); else if(c == LV_KEY_END) lv_textarea_set_cursor_pos(ta, LV_TEXTAREA_CURSOR_LAST); + else if(c == LV_KEY_ENTER && lv_textarea_get_one_line(ta)) + lv_event_send(ta, LV_EVENT_APPLY, NULL); else { lv_textarea_add_char(ta, c); } diff --git a/tests/Makefile b/tests/Makefile index 429862de6..70a44c1a6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -31,6 +31,7 @@ CSRCS += lv_test_core/lv_test_core.c CSRCS += lv_test_core/lv_test_obj.c CSRCS += lv_test_core/lv_test_style.c CSRCS += lv_test_core/lv_test_font_loader.c +CSRCS += lv_test_widgets/lv_test_label.c CSRCS += lv_test_fonts/font_1.c CSRCS += lv_test_fonts/font_2.c CSRCS += lv_test_fonts/font_3.c diff --git a/tests/build.py b/tests/build.py index f014027c7..96e5bb2b8 100755 --- a/tests/build.py +++ b/tests/build.py @@ -120,7 +120,6 @@ minimal_monochrome = { "LV_USE_PAGE":0, "LV_USE_SPINNER":0, "LV_USE_ROLLER":0, - "LV_USE_ROTARY":0, "LV_USE_SLIDER":0, "LV_USE_SPINBOX":0, "LV_USE_SWITCH":0, @@ -197,7 +196,6 @@ all_obj_minimal_features = { "LV_USE_PAGE":1, "LV_USE_SPINNER":0, #Disabled beacsue needs anim "LV_USE_ROLLER":1, - "LV_USE_ROTARY":1, "LV_USE_SLIDER":1, "LV_USE_SPINBOX":1, "LV_USE_SWITCH":1, @@ -276,7 +274,6 @@ all_obj_all_features = { "LV_USE_PAGE":1, "LV_USE_SPINNER":1, "LV_USE_ROLLER":1, - "LV_USE_ROTARY":1, "LV_USE_SLIDER":1, "LV_USE_SPINBOX":1, "LV_USE_SWITCH":1, @@ -294,8 +291,8 @@ advanced_features = { "LV_MEM_CUSTOM":1, "LV_HOR_RES_MAX":800, "LV_VER_RES_MAX":480, - "LV_COLOR_DEPTH":16, - "LV_COLOR_16_SWAP":1, + "LV_COLOR_DEPTH":32, + "LV_COLOR_16_SWAP":0, "LV_COLOR_SCREEN_TRANSP":1, "LV_USE_GROUP":1, "LV_USE_ANIMATION":1, @@ -305,9 +302,6 @@ advanced_features = { "LV_USE_IMG_TRANSFORM":1, "LV_USE_API_EXTENSION_V6":1, "LV_USE_USER_DATA":1, - "LV_USE_USER_DATA_FREE":1, - "LV_USER_DATA_FREE_INCLUDE":"\\\"\\\"", - "LV_USER_DATA_FREE": "\\\"free\\\"", "LV_IMG_CACHE_DEF_SIZE":32, "LV_USE_LOG":1, "LV_USE_THEME_MATERIAL":1, @@ -368,7 +362,6 @@ advanced_features = { "LV_USE_PAGE":1, "LV_USE_SPINNER":1, "LV_USE_ROLLER":1, - "LV_USE_ROTARY":1, "LV_USE_SLIDER":1, "LV_USE_SPINBOX":1, "LV_USE_SWITCH":1, @@ -382,7 +375,8 @@ advanced_features = { build("Minimal monochrome", minimal_monochrome) build("All objects, minimal features", all_obj_minimal_features) -build("All objects, all features", all_obj_all_features) +build("All objects, all common features", all_obj_all_features) +build("All objects, with advanced features", advanced_features) diff --git a/tests/lv_test_assert.c b/tests/lv_test_assert.c index c4edc0d37..ce0d7a5ff 100644 --- a/tests/lv_test_assert.c +++ b/tests/lv_test_assert.c @@ -28,7 +28,8 @@ /********************* * DEFINES *********************/ -#define REF_IMGS_PATH "lvgl/tests/lv_test_ref_imgs/" +//#define REF_IMGS_PATH "lvgl/tests/lv_test_ref_imgs/" +#define REF_IMGS_PATH "lv_test_ref_imgs/" /********************** * TYPEDEFS @@ -177,6 +178,16 @@ void lv_test_assert_color_eq(lv_color_t c_ref, lv_color_t c_act, const char * s) void lv_test_assert_img_eq(const char * fn_ref, const char * s) { +#if LV_COLOR_DEPTH != 32 + lv_test_print(" SKIP: Can't compare '%s' because LV_COLOR_DEPTH != 32", fn_ref); + return; +#endif + +#if LV_HOR_RES_MAX != 800 || LV_VER_RES_MAX != 480 + lv_test_print(" SKIP: Can't compare '%s' because the resolution needs to be 800x480 (LV_HOR_RES_MAX, LV_VER_RES_MAX)", fn_ref); + return; +#endif + char fn_ref_full[512]; sprintf(fn_ref_full, "%s%s", REF_IMGS_PATH, fn_ref); @@ -185,16 +196,23 @@ void lv_test_assert_img_eq(const char * fn_ref, const char * s) uint8_t * screen_buf; lv_disp_t * disp = lv_disp_get_default(); + lv_obj_invalidate(lv_disp_get_scr_act(disp)); lv_refr_now(disp); - screen_buf = disp->driver.buffer->buf1; + + extern lv_color_t test_fb[]; + + screen_buf = (uint8_t *)test_fb; + + uint8_t * ptr_act = NULL; + const png_byte* ptr_ref = NULL; bool err = false; int x, y, i_buf = 0; for (y=0; yrow_pointers[y]); free(p->row_pointers); } -// + //static void process_file(png_img_t * p) //{ // if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB) diff --git a/tests/lv_test_core/lv_test_font_loader.c b/tests/lv_test_core/lv_test_font_loader.c index ea0fc2753..3b3f6321a 100644 --- a/tests/lv_test_core/lv_test_font_loader.c +++ b/tests/lv_test_core/lv_test_font_loader.c @@ -7,12 +7,12 @@ * INCLUDES *********************/ -#include "../lv_test_assert.h" +#include "lvgl/lvgl.h" #if LV_BUILD_TEST -#include "../lvgl.h" -#include "../src/lv_font/lv_font_fmt_txt.h" -#include "../src/lv_font/lv_font.h" -#include "../src/lv_font/lv_font_loader.h" +#include "../lv_test_assert.h" +#include "lvgl/src/lv_font/lv_font_fmt_txt.h" +#include "lvgl/src/lv_font/lv_font.h" +#include "lvgl/src/lv_font/lv_font_loader.h" #include "lv_test_font_loader.h" @@ -28,7 +28,7 @@ * STATIC PROTOTYPES **********************/ -#if LV_USE_FILESYSTEM +#if LV_USE_FILESYSTEM && LV_FONT_FMT_TXT_LARGE == 0 static int compare_fonts(lv_font_t * f1, lv_font_t * f2); #endif @@ -50,7 +50,7 @@ extern lv_font_t font_3; void lv_test_font_loader(void) { -#if LV_USE_FILESYSTEM +#if LV_USE_FILESYSTEM && LV_FONT_FMT_TXT_LARGE == 0 lv_font_t * font_1_bin = lv_font_load("f:font_1.fnt"); lv_font_t * font_2_bin = lv_font_load("f:font_2.fnt"); lv_font_t * font_3_bin = lv_font_load("f:font_3.fnt"); @@ -62,10 +62,12 @@ void lv_test_font_loader(void) lv_font_free(font_1_bin); lv_font_free(font_2_bin); lv_font_free(font_3_bin); +#else + lv_test_print("SKIP: font load test because it requires LV_USE_FILESYSTEM 1 and LV_FONT_FMT_TXT_LARGE 0"); #endif } -#if LV_USE_FILESYSTEM +#if LV_USE_FILESYSTEM && LV_FONT_FMT_TXT_LARGE == 0 static int compare_fonts(lv_font_t * f1, lv_font_t * f2) { lv_test_assert_true(f1 != NULL && f2 != NULL, "font not null"); diff --git a/tests/lv_test_main.c b/tests/lv_test_main.c index 13d8f14eb..f1fd224cc 100644 --- a/tests/lv_test_main.c +++ b/tests/lv_test_main.c @@ -3,12 +3,15 @@ #include #include #include "lv_test_core/lv_test_core.h" +#include "lv_test_widgets/lv_test_label.h" #if LV_BUILD_TEST static void hal_init(void); static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p); +lv_color_t test_fb[LV_HOR_RES_MAX * LV_VER_RES_MAX]; + int main(void) { printf("Call lv_init...\n"); @@ -17,6 +20,7 @@ int main(void) hal_init(); lv_test_core(); + lv_test_label(); printf("Exit with success!\n"); return 0; @@ -85,7 +89,7 @@ static void hal_init(void) static lv_disp_buf_t disp_buf; lv_color_t * disp_buf1 = (lv_color_t *)malloc(LV_HOR_RES * LV_VER_RES * sizeof(lv_color_t)); - lv_disp_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES* LV_VER_RES); + lv_disp_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES * LV_VER_RES); lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); @@ -109,11 +113,15 @@ static void hal_init(void) lv_fs_drv_register(&drv); /*Finally register the drive*/ #endif } +#include static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { LV_UNUSED(area); LV_UNUSED(color_p); + + memcpy(test_fb, color_p, lv_area_get_size(area) * sizeof(lv_color_t)); + lv_disp_flush_ready(disp_drv); } diff --git a/tests/lv_test_objx/lv_test_cont.c b/tests/lv_test_objx/lv_test_cont.c deleted file mode 100644 index 5afc75a67..000000000 --- a/tests/lv_test_objx/lv_test_cont.c +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @file lv_test_cont.c - * - */ - -/********************* - * INCLUDES - *********************/ -#include "../../lvgl.h" -#include "../lv_test_assert.h" - -#if LV_BUILD_TEST - - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ -static void create_copy(void); - -/********************** - * STATIC VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -void lv_test_cont(void) -{ - lv_test_print(""); - lv_test_print("==================="); - lv_test_print("Start lv_cont tests"); - lv_test_print("==================="); - - create_copy(); -} - - -/********************** - * STATIC FUNCTIONS - **********************/ - -static void create_copy(void) -{ - lv_test_print(""); - lv_test_print("Create and copy a container"); - lv_test_print("---------------------------"); - - lv_test_print("Create a container"); - lv_test_assert_int_eq(0, lv_obj_count_children(lv_scr_act()), "Screen's children count before creation"); - - lv_obj_t * obj = lv_cont_create(lv_scr_act(), NULL); - lv_test_assert_int_eq(1, lv_obj_count_children(lv_scr_act()), "Screen's children count after creation"); - - lv_test_print("Test the default values"); - lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_left(obj), "Default left fit"); - lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_right(obj), "Default right fit"); - lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_top(obj), "Default top fit"); - lv_test_assert_int_eq(LV_FIT_NONE, lv_cont_get_fit_bottom(obj), "Default bottom fit"); - lv_test_assert_int_eq(LV_LAYOUT_OFF, lv_cont_get_layout(obj), "Default layout"); - - lv_test_print("Delete the container"); - lv_obj_del(obj); - obj = NULL; - lv_test_assert_int_eq(0, lv_obj_count_children(lv_scr_act()), "Screen's children count after delete"); - -} -#endif diff --git a/tests/lv_test_ref_imgs/lv_test_img32_label_1.png b/tests/lv_test_ref_imgs/lv_test_img32_label_1.png new file mode 100644 index 000000000..29c84d082 Binary files /dev/null and b/tests/lv_test_ref_imgs/lv_test_img32_label_1.png differ diff --git a/tests/lv_test_ref_imgs/lv_test_obj_1_1.png b/tests/lv_test_ref_imgs/lv_test_obj_1_1.png deleted file mode 100644 index 40f187369..000000000 Binary files a/tests/lv_test_ref_imgs/lv_test_obj_1_1.png and /dev/null differ diff --git a/tests/lv_test_widgets/lv_test_label.c b/tests/lv_test_widgets/lv_test_label.c new file mode 100644 index 000000000..3d0435a2e --- /dev/null +++ b/tests/lv_test_widgets/lv_test_label.c @@ -0,0 +1,70 @@ +/** + * @file lv_test_label.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include "../../lvgl.h" +#include "../lv_test_assert.h" +#include "lv_test_label.h" + +#if LV_BUILD_TEST + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void create_copy(void); + +/********************** + * STATIC VARIABLES + **********************/ + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +void lv_test_label(void) +{ + lv_test_print(""); + lv_test_print("==================="); + lv_test_print("Start lv_label tests"); + lv_test_print("==================="); + +#if LV_USE_LABEL + create_copy(); +#else + lv_test_print("Skip label test: LV_USE_LABEL == 0"); +#endif +} + + +/********************** + * STATIC FUNCTIONS + **********************/ + +static void create_copy(void) +{ + lv_test_print(""); + lv_test_print("Create a label"); + lv_test_print("---------------------------"); + + lv_label_create(lv_scr_act(), NULL); +#if LV_COLOR_DEPTH == 32 + lv_test_assert_img_eq("lv_test_img32_label_1.png", "Create a label and leave the default settings"); +#endif +} +#endif diff --git a/tests/lv_test_objx/lv_test_cont.h b/tests/lv_test_widgets/lv_test_label.h similarity index 82% rename from tests/lv_test_objx/lv_test_cont.h rename to tests/lv_test_widgets/lv_test_label.h index 08bbd8b59..36aac4e5e 100644 --- a/tests/lv_test_objx/lv_test_cont.h +++ b/tests/lv_test_widgets/lv_test_label.h @@ -1,10 +1,10 @@ /** - * @file lv_test_obj.h + * @file lv_test_label.h * */ -#ifndef LV_TEST_CONT_H -#define LV_TEST_CONT_H +#ifndef LV_TEST_LABEL_H +#define LV_TEST_LABEL_H #ifdef __cplusplus extern "C" { @@ -25,7 +25,7 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ -void lv_test_cont(void); +void lv_test_label(void); /********************** * MACROS