diff --git a/.editorconfig b/.editorconfig index 8206d33e40..3f0bdad79a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,4 +4,3 @@ indent_size = 4 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true - diff --git a/.github/ISSUE_TEMPLATE/all-other-issues.md b/.github/ISSUE_TEMPLATE/all-other-issues.md deleted file mode 100644 index 67d5adcd8f..0000000000 --- a/.github/ISSUE_TEMPLATE/all-other-issues.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: All other issues -about: Questions and enhancement requests should go to the forum. -title: '' -labels: not-template -assignees: '' - ---- - -# All enhancement requests or questions should be directed to the Forum. - - -We use GitHub issues for development related discussions. -Please use the [forum](https://forum.littlevgl.com/) to ask questions. diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index c95affd3e8..9d9f05d8b5 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,29 +1,43 @@ --- name: Bug report -about: Create a report to help us improve +about: Create a bug report to help us improve title: '' labels: '' assignees: '' --- -> # Important: issues that don't use this template will be ignored/closed. + -**Describe the bug** +### Perform all steps below and tick them with [x] +- [ ] Check the related part of the [Documentation](https://docs.lvgl.io/) +- [ ] Update lvgl to the latest version +- [ ] Reproduce the issue in a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) +### Describe the bug + -**To Reproduce** - -Please provide a small, independent code sample that can be used to reproduce the issue. Ideally this should work in the PC simulator unless the problem is specific to one platform. - -**Expected behavior** +### To Reproduce + +### Expected behavior + -**Screenshots** +### Screenshots or video + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 0ef14eb456..2228ff12d2 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,7 +5,7 @@ contact_links: about: Be sure to read to documentation first - name: Forum url: https://forum.lvgl.io - about: For how-to questions use the forum + about: For topics like How-to, Getting started, Feature request - name: CONTIBUTING.md url: https://github.com/lvgl/lvgl/blob/master/docs/CONTRIBUTING.md#faq-about-contributing about: The basic rules of contributing diff --git a/.github/ISSUE_TEMPLATE/dev-discussion.md b/.github/ISSUE_TEMPLATE/dev-discussion.md new file mode 100644 index 0000000000..0175830129 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/dev-discussion.md @@ -0,0 +1,29 @@ +--- +name: Development discussion +about: Discussion strictly related to the develoopment of the LVGL. +title: '' +labels: '' +assignees: '' + +--- + + +### Introcude the problem + + +### Examples and cases + + +### Suggested solution + diff --git a/.github/auto-comment.yml b/.github/auto-comment.yml index 8ff0cf1e61..a141fb5480 100644 --- a/.github/auto-comment.yml +++ b/.github/auto-comment.yml @@ -1,12 +1,12 @@ # Comment to a new issue. pullRequestOpened: | Thank you for raising your pull request. - - To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin). - + + To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin). + The text of DCO can be read here: https://developercertificate.org/ For a more detailed description see the [Documentation](https://docs.lvgl.io/latest/en/html/contributing/index.html#developer-certification-of-origin-dco) site. - + By contributing to any repositories of the LVGL project you state that your contribution corresponds with the DCO. - - No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment. + + No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c53888a24d..e4e0cf8f9f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,4 +5,4 @@ A clear and concise description of what the bug or new feature is. ### Checkpoints - [ ] Follow the [styling guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md) - [ ] Update CHANGELOG.md -- [ ] Update the documentation +- [ ] Update the documentation diff --git a/.github/stale.yml b/.github/stale.yml index ea1179b76f..c3d60ea607 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -7,7 +7,7 @@ exemptLabels: - architecture - pinned # Label to use when marking an issue as stale -staleLabel: stale +staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue or pull request has been automatically marked as stale because it has not had diff --git a/.github/workflows/build_micropython.yml b/.github/workflows/build_micropython.yml index 3f8e56b438..bbc33f7b53 100644 --- a/.github/workflows/build_micropython.yml +++ b/.github/workflows/build_micropython.yml @@ -37,6 +37,5 @@ jobs: echo "import gc,utime; utime.sleep(5); gc.collect(); - utime.sleep(5)" | + utime.sleep(5)" | ports/unix/micropython -i lib/lv_bindings/examples/advanced_demo.py - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..9c4fc306a0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,16 @@ +on: + issues: + types: [opened, edited] + +jobs: + auto_close_issues: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Automatically close issues that don't follow the issue template + uses: lucasbento/auto-close-issues@v1.0.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template." # optional property + closed-issues-label: "not-template" diff --git a/CHANGELOG.md b/CHANGELOG.md index cacf00b731..ba3f295252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,23 @@ # Changelog +## v7.9.1 (Planned at 19.01.2020) + +### Bugfixes +- fix(cpicker) fix division by zero +- fix(dropdown) fix selecting options after the last one +- fix(msgbox) use the animation time provided +- fix(gpu_nxp_pxp) fix incorrect define name +- fix(indev) don't leave edit mode if there is only one object in the group +- fix(draw_rect) fix draw pattern stack-use-after-scope error + + ## v7.9.0 ### New features - feat(chart) add lv_chart_remove_series and lv_chart_hide_series -- feat(img_cahce) allow disabling image cacheing +- feat(img_cahce) allow disabling image caching - calendar: make get_day_of_week() public +- Added support for Zephyr integration ### Bugfixes - fix(draw_rect) free buffer used for arabic processing @@ -15,8 +27,11 @@ - fix(textarea) cursor position after hiding character in password mode - fix(linemeter) draw critical lines with correct color - fix(lv_conf_internal) be sure Kconfig defines are always uppercase +- fix(kconfig) handle disable sprintf float correctly. +- fix(layout) stop layout after recursion threshold is reached +- fix(gauge) fix redraw with image needle -## v7.8.1 (Plannad at 15.12.2020) +## v7.8.1 ### Bugfixes - fix(lv_scr_load_anim) fix when multiple screen are loaded at tsame time with delay @@ -43,7 +58,7 @@ - fix reference to LV_DRAW_BUF_MAX_NUM in lv_mem.c - fix(polygon draw) join adjacent points if they are on the same coordinate - fix(linemeter) fix invalidation when setting new value -- fix(table) add missing invalidation when changeing cell type +- fix(table) add missing invalidation when changing cell type - refactor(roller) rename LV_ROLLER_MODE_INIFINITE -> LV_ROLLER_MODE_INFINITE ## v7.7.2 (17.11.2020) @@ -53,7 +68,7 @@ - fix(arc) fix and improve arc dragging - label: Repair calculate back `dot` character logical error which cause infinite loop. - fix(theme_material): remove the bottom border from tabview header -- fix(imgbtn) guess a the closest availabe state with valid src +- fix(imgbtn) guess a the closest available state with valid src - fix(spinbox) update cursor position in lv_spinbox_set_step ## v7.7.1 (03.11.2020) @@ -70,7 +85,7 @@ - Allow max. 16 cell types for table - Add `lv_table_set_text_fmt()` - Use margin on calendar header to set distances and padding to the size of the header -- Add `text_sel_bg` style proeprty +- Add `text_sel_bg` style property ### Bugfixes - Theme update to support text selection background @@ -93,7 +108,6 @@ - Fix imgbtn image switching with empty style - Material theme: do not set the text font to allow easy global font change - ## v7.6.0 (22.09.2020) ### New features @@ -111,7 +125,7 @@ - Add 10px and 8ox built in fonts ### Bugfixes -- Fix unexpeted DEFOCUS on lv_page when clicking to bg after the scrollable +- Fix unexpected DEFOCUS on lv_page when clicking to bg after the scrollable - Fix `lv_obj_del` and `lv_obj_clean` if the children list changed during deletion. - Adjust button matrix button width to include padding when spanning multiple units. - Add rounding to btnmatrix line height calculation @@ -126,10 +140,10 @@ The main new features of v7.4 are run-time font loading, style caching and arc k ### New features - Add `lv_font_load()` function - Loads a `lv_font_t` object from a binary font file - Add `lv_font_free()` function - Frees the memory allocated by the `lv_font_load()` function -- Add style caching to reduce acces time of properties with default value +- Add style caching to reduce access time of properties with default value - arc: add set value by click feature - arc: add `LV_ARC_PART_KNOB` similarly to slider -- send gestures even if the the obejct was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function. +- send gestures event if the object was dragged. User can check dragging with `lv_indev_is_dragging(lv_indev_act())` in the event function. ### Bugfixes - Fix color bleeding on border drawing @@ -177,7 +191,6 @@ The main new features of v7.4 are run-time font loading, style caching and arc k - gauge: fix image needle drawing - fix using freed memory in _lv_style_list_remove_style - ## v7.2.0 (21.07.2020) ### New features @@ -214,7 +227,7 @@ The main new features of v7.4 are run-time font loading, style caching and arc k - Add lv_btnmatrix_set/get_align capability - DMA2D: Remove dependency on ST CubeMX HAL - Added `max_used` propriety to `lv_mem_monitor_t` struct -- In `lv_init` test if the the strings are UTF-8 encoded. +- In `lv_init` test if the strings are UTF-8 encoded. - Add `user_data` to themes - Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems. - Add inline function lv_checkbox_get_state(const lv_obj_t * cb) to extend the checkbox functionality. @@ -268,7 +281,7 @@ The main new features of v7.4 are run-time font loading, style caching and arc k - Remove memcpy from `lv_ll` (caused issues with some optimization settings) - `lv_chart` fix X tick drawing - Fix vertical dashed line drawing -- Some additonal minor fixes and formattings +- Some additional minor fixes and formattings ## v7.0.0 (18.05.2020) @@ -281,7 +294,6 @@ The name of the project is changed to LVGL and the new website is on https://lvg LVGL remains free under the same conditions (MIT license) and a company is created to manage LVGL and offer services. - ### New drawing system Complete rework of LVGL's draw engine to use "masks" for more advanced and higher quality graphical effects. A possible use-case of this system is to remove the overflowing content from the rounded edges. @@ -295,7 +307,6 @@ The API in this regard remained the same but some new functions were added: - `lv_img_set_angle`: set image object's angle without using canvas - `lv_img_set_pivot`: set the pivot point of rotation - The new drawing engine brought new drawing features too. They are highlighted in the "style" section. ### New style system diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f9caf7093..4f9d825706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,33 @@ if (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM) target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR") endif() +elseif(ZEPHYR_BASE) + +if(CONFIG_LVGL) + +zephyr_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl) + +target_include_directories(lvgl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +zephyr_compile_definitions(LV_CONF_KCONFIG_EXTERNAL_INCLUDE=) + +zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM + LV_MEM_CUSTOM_ALLOC=${CONFIG_LV_MEM_CUSTOM_ALLOC} + ) +zephyr_compile_definitions_ifdef(CONFIG_LV_MEM_CUSTOM + LV_MEM_CUSTOM_FREE=${CONFIG_LV_MEM_CUSTOM_FREE} + ) +zephyr_compile_definitions_ifdef(CONFIG_LV_TICK_CUSTOM + LV_TICK_CUSTOM_SYS_TIME_EXPR=${CONFIG_LV_TICK_CUSTOM_SYS_TIME_EXPR} + ) + +zephyr_library() + +file(GLOB_RECURSE SOURCES src/*.c) +zephyr_library_sources(${SOURCES}) + +endif() # CONFIG_LVGL + else() message(FATAL_ERROR "Unknown platform.") endif() diff --git a/Kconfig b/Kconfig index adddb034ef..30fbac0701 100644 --- a/Kconfig +++ b/Kconfig @@ -1,7 +1,7 @@ # Kconfig file for LVGL v7.8.1 menu "LVGL configuration" - + config LV_ATTRIBUTE_FAST_MEM_USE_IRAM bool "Set IRAM as LV_ATTRIBUTE_FAST_MEM" help @@ -47,12 +47,14 @@ menu "LVGL configuration" default 8 if LV_COLOR_DEPTH_8 default 16 if LV_COLOR_DEPTH_16 default 32 if LV_COLOR_DEPTH_32 - + config LV_COLOR_16_SWAP bool "Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)." + depends on LV_COLOR_DEPTH_16 config LV_COLOR_SCREEN_TRANSP bool "Enable screen transparency." + depends on LV_COLOR_DEPTH_32 help Useful for OSD or other overlapping GUIs. Requires `LV_COLOR_DEPTH = 32` colors and the screen's style @@ -95,7 +97,7 @@ menu "LVGL configuration" According to the width of the display (hor. res. / dpi) the displays fall in 4 categories. This is the upper limit for medium displays. - + config LV_DISP_LARGE_LIMIT int "Large display limit" default 70 @@ -103,34 +105,34 @@ menu "LVGL configuration" According to the width of the display (hor. res. / dpi) the displays fall in 4 categories. This is the upper limit for large displays. - + menu "Memory manager settings" config LV_MEM_CUSTOM - bool - prompt "If true use custom malloc/free, otherwise use the built-in `lv_mem_alloc` and `lv_mem_free`" + bool + prompt "If true use custom malloc/free, otherwise use the built-in `lv_mem_alloc` and `lv_mem_free`" config LV_MEM_CUSTOM_INCLUDE string prompt "Header to include for the custom memory function" - default stdlib.h + default "stdlib.h" depends on LV_MEM_CUSTOM config LV_MEM_CUSTOM_ALLOC string prompt "Wrapper to malloc" - default malloc + default "malloc" depends on LV_MEM_CUSTOM config LV_MEM_CUSTOM_FREE string prompt "Wrapper to free" - default free + default "free" depends on LV_MEM_CUSTOM - config LV_MEM_SIZE_BYTES - int - prompt "Size of the memory used by `lv_mem_alloc` in kilobytes (>= 2kB)" - range 2 128 + config LV_MEM_SIZE_KILOBYTES + int + prompt "Size of the memory used by `lv_mem_alloc` in kilobytes (>= 2kB)" + range 2 128 default 32 depends on !LV_MEM_CUSTOM @@ -138,7 +140,7 @@ menu "LVGL configuration" bool prompt "Use the standard memcpy and memset instead of LVGL's own functions" endmenu - + menu "Indev device settings" config LV_INDEV_DEF_READ_PERIOD int "Input device read period [ms]." @@ -163,7 +165,7 @@ menu "LVGL configuration" default 3 endmenu - + menu "Feature usage" config LV_USE_ANIMATION bool "Enable the Animations." @@ -208,6 +210,7 @@ menu "LVGL configuration" bool "Enable STM32 DMA2D." config LV_GPU_DMA2D_CMSIS_INCLUDE string "include path of CMSIS header of target processor" + depends on LV_USE_GPU_STM32_DMA2D default "" help e.g. "stm32f769xx.h" or "stm32f429xx.h" @@ -215,6 +218,7 @@ menu "LVGL configuration" bool "Use PXP for CPU off-load on NXP RTxxx platforms." config LV_USE_GPU_NXP_PXP_AUTO_INIT bool "Call lv_gpu_nxp_pxp_init() automatically or manually." + depends on LV_USE_GPU_NXP_PXP help 1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) and call @@ -251,10 +255,10 @@ menu "LVGL configuration" bool "Use the functions and types from the older (v7) API if possible." default y if !LV_CONF_MINIMAL endmenu - + menu "Image decoder and cache" config LV_IMG_CF_INDEXED - bool "Enable indexed (pallete) images." + bool "Enable indexed (palette) images." default y if !LV_CONF_MINIMAL config LV_IMG_CF_ALPHA bool "Enable alpha indexed images." @@ -280,19 +284,19 @@ menu "LVGL configuration" menu "HAL Settings" config LV_TICK_CUSTOM - bool + bool prompt "Use a custom tick source" config LV_TICK_CUSTOM_INCLUDE string prompt "Header for the system time function" - default Arduino.h + default "Arduino.h" depends on LV_TICK_CUSTOM config LV_TICK_CUSTOM_SYS_TIME_EXPR string prompt "Expression evaluating to current system time in ms" - default "(millis())" + default "millis()" depends on LV_TICK_CUSTOM endmenu @@ -308,13 +312,13 @@ menu "LVGL configuration" config LV_LOG_LEVEL_TRACE bool "Trace - Detailed information" - config LV_LOG_LEVEL_INFO + config LV_LOG_LEVEL_INFO bool "Info - Log important events" - config LV_LOG_LEVEL_WARN + config LV_LOG_LEVEL_WARN bool "Warn - Log if something unwanted happened" config LV_LOG_LEVEL_ERROR bool "Error - Only critical issues" - config LV_LOG_LEVEL_NONE + config LV_LOG_LEVEL_NONE bool "None - Do not log anything" endchoice @@ -330,15 +334,15 @@ menu "LVGL configuration" config LV_LOG_PRINTF bool "Print the log with 'printf'" if LV_USE_LOG help - Use printf for log output. + Use printf for log output. If not set the user needs to register a callback with `lv_log_register_print_cb`. endmenu - + menu "Debug Settings" config LV_USE_DEBUG bool "Enable Debug" - + config LV_USE_ASSERT_NULL bool "Check if the parameter is NULL. (Quite fast)" default y if !LV_CONF_MINIMAL @@ -349,21 +353,21 @@ menu "LVGL configuration" config LV_USE_ASSERT_MEM_INTEGRITY bool "Check the integrity of `lv_mem` after critical operations. (Slow)" - + config LV_USE_ASSERT_STR bool "Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)" - help + help If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled). - + config LV_USE_ASSERT_OBJ bool "Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)." - help + help If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) - + config LV_USE_ASSERT_STYLE bool "Check if the styles are properly initialized. (Fast)" endmenu - + menu "Font usage" config LV_FONT_FMT_TXT_LARGE bool "Enable it if you have fonts with a lot of characters." @@ -372,13 +376,17 @@ menu "LVGL configuration" but with > 10,000 characters if you see issues probably you need to enable it. + config LV_USE_FONT_SUBPX + bool "Enable subpixel rendering." + config LV_FONT_SUBPX_BGR bool "Use BGR instead RGB for sub-pixel rendering." + depends on LV_USE_FONT_SUBPX help Set the pixel order of the display. Important only if "subpx fonts" are used. With "normal" font it doesn't matter. - + menu "Enable built-in fonts" config LV_FONT_MONTSERRAT_8 bool "Enable Montserrat 8" @@ -527,7 +535,7 @@ menu "LVGL configuration" bool "Simsun 16 CJK" select LV_FONT_SIMSUN_16_CJK endchoice - + choice LV_FONT_DEFAULT_NORMAL prompt "Select theme default normal font" default LV_FONT_DEFAULT_NORMAL_MONTSERRAT_16 if !LV_CONF_MINIMAL @@ -617,7 +625,7 @@ menu "LVGL configuration" bool "Simsun 16 CJK" select LV_FONT_SIMSUN_16_CJK endchoice - + choice LV_FONT_DEFAULT_SUBTITLE prompt "Select theme default subtitle font" default LV_FONT_DEFAULT_SUBTITLE_MONTSERRAT_16 if !LV_CONF_MINIMAL @@ -707,7 +715,7 @@ menu "LVGL configuration" bool "Simsun 16 CJK" select LV_FONT_SIMSUN_16_CJK endchoice - + choice LV_FONT_DEFAULT_TITLE prompt "Select theme default title font" default LV_FONT_DEFAULT_TITLE_MONTSERRAT_16 if !LV_CONF_MINIMAL @@ -797,7 +805,7 @@ menu "LVGL configuration" endmenu menu "Theme usage" - menu "Enable theme usage, always enable at least one theme" + menu "Enable theme usage, always enable at least one theme" config LV_THEME_EMPTY bool "Empty: No theme, you can apply your styles as you need." default y if LV_CONF_MINIMAL @@ -808,7 +816,7 @@ menu "LVGL configuration" default y if !LV_CONF_MINIMAL config LV_THEME_MONO bool "Mono: Mono-color theme for monochrome displays" - endmenu + endmenu choice LV_THEME_DEFAULT_INIT prompt "Select theme default init" @@ -830,7 +838,7 @@ menu "LVGL configuration" bool "Default init for mono theme" select LV_THEME_MONO endchoice - + config LV_THEME_DEFAULT_COLOR_PRIMARY hex "Select theme default primary color" range 0x000000 0xFFFFFF @@ -849,7 +857,7 @@ menu "LVGL configuration" choice LV_THEME_DEFAULT_FLAG depends on LV_THEME_MATERIAL - + prompt "Select theme default flag" default LV_THEME_DEFAULT_FLAG_LIGHT help @@ -857,10 +865,8 @@ menu "LVGL configuration" config LV_THEME_DEFAULT_FLAG_LIGHT bool "Light theme" - depends on LV_THEME_MATERIAL config LV_THEME_DEFAULT_FLAG_DARK bool "Dark theme" - depends on LV_THEME_MATERIAL endchoice endmenu @@ -882,39 +888,39 @@ menu "LVGL configuration" config LV_TXT_BREAK_CHARS string "Can break (wrap) texts on these chars" default " ,.;:-_" - + config LV_TXT_LINE_BREAK_LONG_LEN int "Line break long length" default 0 help - If a word is at least this long, will break wherever 'prettiest'. + If a word is at least this long, will break wherever 'prettiest'. To disable, set to a value <= 0. - + config LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN int "Min num chars before break" default 3 + depends on LV_TXT_LINE_BREAK_LONG_LEN > 0 help Minimum number of characters in a long word to put on a line before a break. - Depends on LV_TXT_LINE_BREAK_LONG_LEN - + config LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN int "Min num chars after break" default 3 + depends on LV_TXT_LINE_BREAK_LONG_LEN > 0 help Minimum number of characters in a long word to put on a line after a break. - Depends on LV_TXT_LINE_BREAK_LONG_LEN - + config LV_TXT_COLOR_CMD string "The control character to use for signalling text recoloring" default "#" config LV_USE_BIDI bool "Support bidirectional texts" - help + help Allows mixing Left-to-Right and Right-to-Left texts. The direction will be processed according to the Unicode Bidirectional Algorithm: https://www.w3.org/International/articles/inline-bidi-markup/uba-basics - + choice prompt "Set the default BIDI direction" default LV_BIDI_DIR_AUTO @@ -930,7 +936,7 @@ menu "LVGL configuration" config LV_USE_ARABIC_PERSIAN_CHARS bool "Enable Arabic/Persian processing" - help + help In these languages characters should be replaced with an other form based on their position in the text. @@ -938,14 +944,14 @@ menu "LVGL configuration" bool "Change the built-in (v)snprintf functions" config LV_SPRINTF_DISABLE_FLOAT - bool "Disable float in built-in (v)snprintf functions" if !LV_SPRINTF_CUSTOM + bool "Disable float in built-in (v)snprintf functions" if !LV_SPRINTF_CUSTOM endmenu menu "Widgets" config LV_USE_OBJ_REALIGN bool "Enable `lv_obj_realign()` based on `lv_obj_align()` parameters." default y if !LV_CONF_MINIMAL - + choice prompt "Enable to make the object clickable on a larger area." default LV_USE_EXT_CLICK_AREA_TINY @@ -976,6 +982,7 @@ menu "LVGL configuration" default y if !LV_CONF_MINIMAL config LV_CALENDAR_WEEK_STARTS_MONDAY bool "Calendar week starts monday." + depends on LV_USE_CALENDAR config LV_USE_CANVAS bool "Canvas. Dependencies: lv_img." select LV_USE_IMG @@ -1005,7 +1012,7 @@ menu "LVGL configuration" default y if !LV_CONF_MINIMAL config LV_DROPDOWN_DEF_ANIM_TIME int "Drop down animation time. 0: no animation." - depends on LV_USE_DROPBOX + depends on LV_USE_DROPDOWN default 200 config LV_USE_GAUGE bool "Gauge. Dependencies: lv_bar, lv_linemeter." @@ -1033,13 +1040,17 @@ menu "LVGL configuration" config LV_LABEL_DEF_SCROLL_SPEED int "Hor. or ver. scroll speed [px/sec] in LV_LABEL_LONG_ROLL/ROLL_CIRC mode." default 25 + depends on LV_USE_LABEL config LV_LABEL_WAIT_CHAR_COUNT int "Waiting period at beginning/end of animation cycle." default 3 + depends on LV_USE_LABEL config LV_LABEL_TEXT_SEL bool "Enable selecting text of the label." + depends on LV_USE_LABEL config LV_LABEL_LONG_TXT_HINT bool "Store extra some info in labels (12 bytes) to speed up drawing of very long texts." + depends on LV_USE_LABEL config LV_USE_LED bool "LED." default y if !LV_CONF_MINIMAL @@ -1047,10 +1058,12 @@ menu "LVGL configuration" int "LED minimal brightness." range 0 255 default 120 + depends on LV_USE_LED config LV_LED_BRIGHT_MAX int "LED maximal brightness." range 0 255 default 255 + depends on LV_USE_LED config LV_USE_LINE bool "Line." default y if !LV_CONF_MINIMAL @@ -1064,12 +1077,14 @@ menu "LVGL configuration" config LV_LIST_DEF_ANIM_TIME int "List default animation time of focusing to a list element [ms]. 0: no animation." default 100 + depends on LV_USE_LIST config LV_USE_LINEMETER bool "Line meter." default y if !LV_CONF_MINIMAL choice prompt "Draw line more precisely at cost of performance." default LV_LINEMETER_PRECISE_NO_EXTRA_PRECISION + depends on LV_USE_LINEMETER config LV_LINEMETER_PRECISE_NO_EXTRA_PRECISION bool "0: No extra precision." config LV_LINEMETER_PRECISE_SOME_EXTRA_PRECISION @@ -1093,6 +1108,7 @@ menu "LVGL configuration" config LV_PAGE_DEF_ANIM_TIME int "Focus default animation time [ms]. 0: No animation." default 100 + depends on LV_USE_PAGE config LV_USE_SPINNER bool "Spinner. Dependencies: lv_arc, lv_anim." select LV_USE_ARC @@ -1101,12 +1117,15 @@ menu "LVGL configuration" config LV_SPINNER_DEF_ARC_LENGTH int "Spinner def. arc length [deg]." default 60 + depends on LV_USE_SPINNER config LV_SPINNER_DEF_SPIN_TIME int "Spinner def. spin time [ms]." default 1000 + depends on LV_USE_SPINNER choice prompt "Type of spinner (animation type)." default LV_SPINNER_TYPE_SPINNING_ARC + depends on LV_USE_SPINNER config LV_SPINNER_TYPE_SPINNING_ARC bool "0: Spinner type spinning arc." config LV_SPINNER_TYPE_FILLSPIN_ARC @@ -1121,9 +1140,11 @@ menu "LVGL configuration" config LV_ROLLER_DEF_ANIM_TIME int "Focus animation time [ms]. 0: no animation." default 200 + depends on LV_USE_ROLLER config LV_ROLLER_INF_PAGES int "Number of extra 'pages' when the controller is infinite." default 7 + depends on LV_USE_ROLLER config LV_USE_SLIDER bool "Slider. Dependencies: lv_bar." select LV_USE_BAR @@ -1144,9 +1165,11 @@ menu "LVGL configuration" config LV_TEXTAREA_DEF_CURSOR_BLINK_TIME int "Text area def. cursor blink time [ms]." default 400 + depends on LV_USE_TEXTAREA config LV_TEXTAREA_DEF_PWN_SHOW_TIME int "Text area def. pwn show time [ms]." default 1500 + depends on LV_USE_TEXTAREA config LV_USE_TABLE bool "Table. Dependencies: lv_label." select LV_USE_LABEL @@ -1154,9 +1177,11 @@ menu "LVGL configuration" config LV_TABLE_COL_MAX int "Table col max." default 12 + depends on LV_USE_TABLE config LV_TABLE_CELL_STYLE_CNT int "Table cell style count." default 4 + depends on LV_USE_TABLE config LV_USE_TABVIEW bool "Tab. Dependencies: lv_page, lv_btnm." select LV_USE_PAGE @@ -1165,6 +1190,7 @@ menu "LVGL configuration" config LV_TABVIEW_DEF_ANIM_TIME int "Time of slide animation [ms]. 0: No animation." default 300 + depends on LV_USE_TABVIEW config LV_USE_TILEVIEW bool "Tileview. Dependencies: lv_page." select LV_USE_PAGE @@ -1172,6 +1198,7 @@ menu "LVGL configuration" config LV_TILEVIEW_DEF_ANIM_TIME int "Time of slide animation [ms]. 0: No animation." default 300 + depends on LV_USE_TILEVIEW config LV_USE_WIN bool "Window. Dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page." select LV_USE_CONT diff --git a/README.md b/README.md index 1eff0d1c8d..7324fa9f16 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -

LVGL - Light and Versatile Graphics Library

+

LVGL - Light and Versatile Graphics Library

-LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. +LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.

-Website · -Online demo · -Nightly demos · -Docs · +Website · +Online demo · +Nightly demos · +Docs · Forum

@@ -53,37 +53,37 @@ Basically, every modern controller (which is able to drive a display) is suitabl > 16 MHz > 48 MHz - + Flash/ROM > 64 kB > 180 kB - + Static RAM > 2 kB > 4 kB - + Stack > 2 kB > 8 kB - + Heap > 2 kB > 8 kB - + Display buffer > 1 × hor. res. pixels > 10 × hor. res. pixels - + Compiler C99 or newer @@ -114,9 +114,9 @@ This list shows the recommended way of learning the library: 7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library (2-3 hours) 8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage 9. If you have questions go to the [Forum](http://forum.lvgl.io/) -10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes) +10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes) -## Examples +## Examples For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository. diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md index 1f7b590e92..46bc637576 100644 --- a/docs/CODING_STYLE.md +++ b/docs/CODING_STYLE.md @@ -11,19 +11,19 @@ Use [lv_misc/lv_templ.c](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv * starts with *lv* * followed by module name: *btn*, *label*, *style* etc. * followed by the action (for functions): *set*, *get*, *refr* etc. - * closed with the subject: *name*, *size*, *state* etc. + * closed with the subject: *name*, *size*, *state* etc. * Typedefs * prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name` * always end `typedef struct` and `typedef enum` type names with `_t` * Abbreviations: - * Only words longer or equal than 6 characters can be abbreviated. + * Only words longer or equal than 6 characters can be abbreviated. * Abbreviate only if it makes the word at least half as long - * Use only very straightforward and well-known abbreviations (e.g. pos: position, def: default, btn: button) + * Use only very straightforward and well-known abbreviations (e.g. pos: position, def: default, btn: button) ## Coding guide * Functions: - * Try to write function shorter than is 50 lines - * Always shorter than 200 lines (except very straightforwards) + * Try to write function shorter than is 50 lines + * Always shorter than 200 lines (except very straightforwards) * Variables: * One line, one declaration (BAD: char x, y;) * Use `` (*uint8_t*, *int32_t* etc) @@ -41,16 +41,16 @@ Before every function have a comment like this: * @param obj pointer to an object * @return pointer to a screen */ -lv_obj_t * lv_obj_get_scr(lv_obj_t * obj); +lv_obj_t * lv_obj_get_scr(lv_obj_t * obj); ``` Always use `/* Something */` format and NOT `//Something` -Write readable code to avoid descriptive comments like: -`x++; /* Add 1 to x */`. +Write readable code to avoid descriptive comments like: +`x++; /* Add 1 to x */`. The code should show clearly what you are doing. -You should write **why** have you done this: +You should write **why** have you done this: `x++; /*Because of closing '\0' of the string */` Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/` @@ -67,19 +67,19 @@ Here is example to show bracket placing and using of white spaces: */ void lv_label_set_text(lv_obj_t * label, const char * text) { /* Main brackets of functions in new line*/ - + if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/ - + lv_obj_inv(label); - + lv_label_ext_t * ext = lv_obj_get_ext(label); /*Comment before a section */ if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/ lv_label_refr_text(label); - return; + return; } - + ... } ``` diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 1a3941f428..553cfa51f6 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,5 +1,5 @@ # Contributing to LVGL -Thank you for considering contributing to LVGL. +Thank you for considering contributing to LVGL. For a detailed description of contribution opportunities, please visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation. diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index df66c671b0..a606894f91 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -1,6 +1,6 @@ # Roadmap -This is a summary for thenew fatures of the major releases and a collection of ideas. +This is a summary for thenew fatures of the major releases and a collection of ideas. This list indicates only the current intention and can be changed. @@ -27,40 +27,37 @@ Planned to November/December 2020 - Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier - Work in progress - Remove the align parameter from `lv_canvas_draw_text` -- Remove the copy paramter from create functions -- Style selectors and style-based states See [#1832](https://github.com/lvgl/lvgl/issues/1832) -- Add Object Orianted system [#1919](https://github.com/lvgl/lvgl/issues/1919) - -## v8.1 -- Add radio button widget +- Make the copy parameter obsolate in create functions +- Optimize and simplifie styles [#1832](https://github.com/lvgl/lvgl/issues/1832) +- Use a more generic inheritenace [#1919](https://github.com/lvgl/lvgl/issues/1919) ## v8.x +- Add radio button widget - Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658) - Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660) +- chart: pre-delete `X` pint after the lastly set +- chart: autoscroll to the right ## v9 - Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3). - Consider direct binary font format support -- Optimize line and cirle drawing and masking +- Optimize line and circle drawing and masking - Reconsider color format management for run time color format setting, and custom color format usage. (Also [RGB888](https://github.com/lvgl/lvgl/issues/1722)) - 9-patch support for `lv_imgbtn`. - Handle stride. See [#1858](https://github.com/lvgl/lvgl/issues/1858) - Make gradients more versatile - Make image transformations more versatile -- Allow snapshoting object to tranfrom them as images - -## v10 -- Remove property level states - +- Allow snapshoting object to tranfrom them to images ## Ideas +- Use [generate-changelog](https://github.com/lob/generate-changelog) to automatically generate changelog - lv_mem_alloc_aligned(size, align) - Text node. See [#1701](https://github.com/lvgl/lvgl/issues/1701#issuecomment-699479408) - CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736) -- Optmize font decompression +- Optimize font decompression - Switch to RGBA colors in styles - Need coverage report for tests -- Need static analize (via coverity.io or somehing else) +- Need static analyze (via coverity.io or somehing else) - Support dot_begin and dot_middle long modes for labels - Add new label alignment modes. [#1656](https://github.com/lvgl/lvgl/issues/1656) - Support larger images: [#1892](https://github.com/lvgl/lvgl/issues/1892) diff --git a/examples/porting/lv_port_disp_template.c b/examples/porting/lv_port_disp_template.c index 7bb9c3d70b..a4f95fab40 100644 --- a/examples/porting/lv_port_disp_template.c +++ b/examples/porting/lv_port_disp_template.c @@ -55,20 +55,20 @@ void lv_port_disp_init(void) *----------------------------*/ /* 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. + * Later this buffer will passed your display drivers `flush_cb` to copy its content to your display. * The buffer has to be greater than 1 display row * * There are three buffering configurations: - * 1. Create ONE buffer with some rows: + * 1. Create ONE buffer with some rows: * LVGL will draw the display's content here and writes it to your display - * - * 2. Create TWO buffer with some rows: + * + * 2. Create TWO buffer with some rows: * LVGL will draw the display's content to a buffer and writes it your display. * You should use DMA to write the buffer's content to the display. * It will enable LVGL to draw the next part of the screen to the other buffer while * the data is being sent form the first buffer. It makes rendering and flushing parallel. - * - * 3. Create TWO screen-sized buffer: + * + * 3. Create TWO screen-sized buffer: * Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the * whole frame to display. This way you only need to change the frame buffer's address instead of * copying the pixels. @@ -91,7 +91,6 @@ void lv_port_disp_init(void) static lv_color_t draw_buf_3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/ lv_disp_buf_init(&draw_buf_dsc_3, draw_buf_3_1, draw_buf_3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/ - /*----------------------------------- * Register the display in LVGL *----------------------------------*/ @@ -157,7 +156,6 @@ static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_colo lv_disp_flush_ready(disp_drv); } - /*OPTIONAL: GPU INTERFACE*/ #if LV_USE_GPU diff --git a/examples/porting/lv_port_disp_template.h b/examples/porting/lv_port_disp_template.h index eeca802b09..93e51cc260 100644 --- a/examples/porting/lv_port_disp_template.h +++ b/examples/porting/lv_port_disp_template.h @@ -34,7 +34,6 @@ extern "C" { * MACROS **********************/ - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/examples/porting/lv_port_fs_template.c b/examples/porting/lv_port_fs_template.c index 27c1ca9033..c8f5fe21be 100644 --- a/examples/porting/lv_port_fs_template.c +++ b/examples/porting/lv_port_fs_template.c @@ -36,7 +36,6 @@ typedef struct { uint32_t dummy2; }dir_t; - /********************** * STATIC PROTOTYPES **********************/ @@ -81,7 +80,7 @@ void lv_port_fs_init(void) fs_init(); /*--------------------------------------------------- - * Register the file system interface in LVGL + * Register the file system interface in LVGL *--------------------------------------------------*/ /* Add a simple drive to open images */ @@ -118,7 +117,7 @@ void lv_port_fs_init(void) /* Initialize your Storage device and File system. */ static void fs_init(void) { - /*E.g. for FatFS initalize the SD card and FatFS itself*/ + /*E.g. for FatFS initialize the SD card and FatFS itself*/ /*You code here*/ } @@ -157,7 +156,6 @@ static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, return res; } - /** * Close an opened file * @param drv pointer to a driver where this function belongs @@ -264,7 +262,7 @@ static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p) * Delete a file * @param drv pointer to a driver where this function belongs * @param path path of the file to delete - * @return LV_FS_RES_OK or any error from lv_fs_res_t enum + * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path) { diff --git a/examples/porting/lv_port_fs_template.h b/examples/porting/lv_port_fs_template.h index 7db06f658c..d18f736f66 100644 --- a/examples/porting/lv_port_fs_template.h +++ b/examples/porting/lv_port_fs_template.h @@ -34,7 +34,6 @@ extern "C" { * MACROS **********************/ - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/examples/porting/lv_port_indev_template.c b/examples/porting/lv_port_indev_template.c index 1910b74eed..98788da433 100644 --- a/examples/porting/lv_port_indev_template.c +++ b/examples/porting/lv_port_indev_template.c @@ -79,7 +79,6 @@ void lv_port_indev_init(void) * You should shape them according to your hardware */ - lv_indev_drv_t indev_drv; /*------------------ @@ -174,8 +173,6 @@ void lv_port_indev_init(void) * STATIC FUNCTIONS **********************/ - - /*------------------ * Touchpad * -----------------*/ @@ -225,7 +222,6 @@ static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y) (*y) = 0; } - /*------------------ * Mouse * -----------------*/ @@ -361,7 +357,6 @@ static void encoder_handler(void) encoder_state = LV_INDEV_STATE_REL; } - /*------------------ * Button * -----------------*/ diff --git a/examples/porting/lv_port_indev_template.h b/examples/porting/lv_port_indev_template.h index ca0274e808..b235d3093a 100644 --- a/examples/porting/lv_port_indev_template.h +++ b/examples/porting/lv_port_indev_template.h @@ -35,7 +35,6 @@ extern "C" { * MACROS **********************/ - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/library.json b/library.json index 3aec465fce..a5e8b2d5ae 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "8.0.0", + "version": "8.0.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/lv_conf_template.h b/lv_conf_template.h index f8815472f0..6cc8acb5cb 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -1,10 +1,6 @@ /** * @file lv_conf.h -<<<<<<< HEAD * Configuration file for v8.0.0-dev -======= - * Configuration file for v7.8.1-dev ->>>>>>> master */ /* @@ -138,7 +134,6 @@ typedef int16_t lv_coord_t; * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ #define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 - /* Gesture threshold in pixels */ #define LV_INDEV_DEF_GESTURE_LIMIT 50 @@ -690,6 +685,26 @@ typedef void * lv_obj_user_data_t; # define LV_TABLE_CELL_STYLE_CNT 4 #endif +<<<<<<< HEAD +======= +/*Tab (dependencies: lv_page, lv_btnm)*/ +#define LV_USE_TABVIEW 1 +# if LV_USE_TABVIEW != 0 +/*Time of slide animation [ms] (0: no animation)*/ +# define LV_TABVIEW_DEF_ANIM_TIME 300 +#endif + +/*Tileview (dependencies: lv_page) */ +#define LV_USE_TILEVIEW 1 +#if LV_USE_TILEVIEW +/*Time of slide animation [ms] (0: no animation)*/ +# define LV_TILEVIEW_DEF_ANIM_TIME 300 +#endif + +/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ +#define LV_USE_WIN 1 + +>>>>>>> master /*================== * Non-user section *==================*/ diff --git a/lvgl.h b/lvgl.h index b6678dda7c..0747c4ff0f 100644 --- a/lvgl.h +++ b/lvgl.h @@ -10,7 +10,6 @@ extern "C" { #endif - /*************************** * CURRENT VERSION OF LVGL ***************************/ @@ -106,6 +105,29 @@ extern "C" { * */ #define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH))) +/** + * Wrapper functions for VERSION macros + */ + +static inline int lv_version_major() +{ + return LVGL_VERSION_MAJOR; +} + +static inline int lv_version_minor() +{ + return LVGL_VERSION_MINOR; +} + +static inline int lv_version_patch() +{ + return LVGL_VERSION_PATCH; +} + +static inline const char *lv_version_info() +{ + return LVGL_VERSION_INFO; +} #ifdef __cplusplus } diff --git a/lvgl.mk b/lvgl.mk index bbea98d351..1479c217a8 100644 --- a/lvgl.mk +++ b/lvgl.mk @@ -6,5 +6,3 @@ include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc/lv_misc.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes/lv_themes.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw/lv_draw.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu/lv_gpu.mk - - diff --git a/scripts/built_in_font/built_in_font_gen.py b/scripts/built_in_font/built_in_font_gen.py index b3206506ff..1a0526464e 100755 --- a/scripts/built_in_font/built_in_font_gen.py +++ b/scripts/built_in_font/built_in_font_gen.py @@ -7,40 +7,40 @@ import sys parser = argparse.ArgumentParser(description="""Create fonts for LittelvGL including the built-in symbols. lv_font_conv needs to be installed. See https://github.com/littlevgl/lv_font_conv Example: python built_in_font_gen.py --size 16 -o lv_font_roboto_16.c --bpp 4 -r 0x20-0x7F""", formatter_class=RawTextHelpFormatter) -parser.add_argument('-s', '--size', - type=int, - metavar = 'px', - nargs='?', +parser.add_argument('-s', '--size', + type=int, + metavar = 'px', + nargs='?', help='Size of the font in px') -parser.add_argument('--bpp', - type=int, - metavar = '1,2,4', - nargs='?', +parser.add_argument('--bpp', + type=int, + metavar = '1,2,4', + nargs='?', help='Bit per pixel') -parser.add_argument('-r', '--range', - nargs='+', - metavar = 'start-end', - default=['0x20-0x7F,0xB0,0x2022'], +parser.add_argument('-r', '--range', + nargs='+', + metavar = 'start-end', + default=['0x20-0x7F,0xB0,0x2022'], help='Ranges and/or characters to include. Default is 0x20-7F (ASCII). E.g. -r 0x20-0x7F, 0x200, 324') -parser.add_argument('--symbols', - nargs='+', - metavar = 'sym', +parser.add_argument('--symbols', + nargs='+', + metavar = 'sym', default=[''], help=u'Symbols to include. E.g. -s ÁÉŐ'.encode('utf-8')) -parser.add_argument('--font', - metavar = 'file', - nargs='?', - default='Montserrat-Medium.ttf', +parser.add_argument('--font', + metavar = 'file', + nargs='?', + default='Montserrat-Medium.ttf', help='A TTF or WOFF file') -parser.add_argument('-o', '--output', - nargs='?', - metavar='file', +parser.add_argument('-o', '--output', + nargs='?', + metavar='file', help='Output file name. E.g. my_font_20.c') parser.add_argument('--compressed', action='store_true', help='Compress the bitmaps') parser.add_argument('--subpx', action='store_true', help='3 times wider letters for sub pixel rendering') - + args = parser.parse_args() if args.compressed == False: diff --git a/scripts/built_in_font/generate_all.py b/scripts/built_in_font/generate_all.py index 348b951208..dab551f678 100755 --- a/scripts/built_in_font/generate_all.py +++ b/scripts/built_in_font/generate_all.py @@ -101,5 +101,3 @@ os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_ print("\nGenerating 16 px Hebrew, Persian") os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF") os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_dejavu_16_persian_hebrew.c') - - diff --git a/scripts/code-format.cfg b/scripts/code-format.cfg index 9b0a35e17e..0d786927c9 100644 --- a/scripts/code-format.cfg +++ b/scripts/code-format.cfg @@ -23,7 +23,7 @@ --suffix=none --preserve-date --formatted ---exclude=lv_conf_internal.h +--exclude=lv_conf_internal.h --exclude=../src/lv_font/lv_font_montserrat_12.c --exclude=../src/lv_font/lv_font_montserrat_14.c --exclude=../src/lv_font/lv_font_montserrat_16.c @@ -47,4 +47,3 @@ --exclude=../src/lv_font/lv_font_montserrat_28_compressed.c --exclude=../src/lv_font/lv_font_simsun_16_cjk.c --exclude=../src/lv_font/lv_font_dejavu_16_persian_hebrew.c - diff --git a/scripts/cppcheck_run.sh b/scripts/cppcheck_run.sh index 98e594cb92..3916c76721 100755 --- a/scripts/cppcheck_run.sh +++ b/scripts/cppcheck_run.sh @@ -1,2 +1 @@ cppcheck -j8 --template="{severity}\t{file}:{line}\t{id}: {message}" --enable=all ../src/ --output-file=cppcheck_res.txt --suppress=unusedFunction --suppress=preprocessorErrorDirective --force - diff --git a/scripts/infer_run.sh b/scripts/infer_run.sh index 2d33d5b842..f1d12235a9 100755 --- a/scripts/infer_run.sh +++ b/scripts/infer_run.sh @@ -1,10 +1,9 @@ # https://github.com/facebook/infer # -# Install: +# Install: # VERSION=0.17.0; \ # curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux64-v$VERSION.tar.xz" \ # | sudo tar -C /opt -xJ && \ # sudoln -s "/opt/infer-linux64-v$VERSION/bin/infer" /usr/local/bin/infer - infer run -- make -j8 diff --git a/scripts/lv_conf_checker.py b/scripts/lv_conf_checker.py index bc3e008ece..d520042081 100755 --- a/scripts/lv_conf_checker.py +++ b/scripts/lv_conf_checker.py @@ -4,7 +4,6 @@ Generates a checker file for lv_conf.h from lv_conf_template.h define all the not defined values ''' - import sys import re @@ -15,7 +14,6 @@ if sys.version_info < (3,6,0): fin = open("../lv_conf_template.h", "r") fout = open("../src/lv_conf_internal.h", "w") - fout.write( '''/** * GENERATED FILE, DO NOT EDIT IT! @@ -82,7 +80,7 @@ for i in fin.read().splitlines(): if '/*--END OF LV_CONF_H--*/' in i: break r = re.search(r'^ *# *define ([^\s]+).*$', i) - + #ifndef LV_USE_BTN /*Only if not defined in lv_conf.h*/ # ifdef CONFIG_LV_USE_BTN /*Use KConfig value if set*/ # define LV_USE_BTN CONFIG_LV_USE_BTN @@ -90,17 +88,16 @@ for i in fin.read().splitlines(): # 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'# ifdef CONFIG_{line}\n' - f'# define {line} CONFIG_{line}\n' + f'# ifdef CONFIG_{line.upper()}\n' + f'# define {line} CONFIG_{line.upper()}\n' f'# else\n' f'{d}\n' f'# endif\n' @@ -111,7 +108,6 @@ for i in fin.read().splitlines(): else: fout.write(f'{i}\n') - fout.write( ''' diff --git a/scripts/release/com.py b/scripts/release/com.py index bb3fd7ddd0..8a8f4d79d1 100755 --- a/scripts/release/com.py +++ b/scripts/release/com.py @@ -10,32 +10,32 @@ import com def cmd(c, ask_on_err = True): print("\n" + c) - r = os.system(c) + r = os.system(c) if r: print("### Error: " + str(r)) - if ask_on_err: - input("Press Enter to continue exectution...") - -def define_set(fn, name, value): + if ask_on_err: + input("Press Enter to continue execution...") + +def define_set(fn, name, value): print("In " + fn + " set " + name + " to " + value) - - new_content = "" + + new_content = "" s = r'^ *# *define +' + str(name).rstrip() + ' +' - + f = open(fn, "r") for i in f.read().splitlines(): r = re.search(s, i) - if r: + if r: d = i.split("define") - i = d[0] + "define " + name + " " + value + i = d[0] + "define " + name + " " + value new_content += i + '\n' - + f.close() - + f = open(fn, "w") f.write(new_content) f.close() - + def ver_format(ver): s = "v" + str(ver[0]) + "." + str(ver[1]) + "." + str(ver[2]) if(ver[3] != ""): s = s + "-" + ver[3] @@ -43,69 +43,68 @@ def ver_format(ver): def get_lvgl_version(br): print("Get LVGL's version") - - ver = [0, 0, 0, ""] - + + ver = [0, 0, 0, ""] + os.chdir("./lvgl") - + com.cmd("git checkout " + br) - + f = open("./lvgl.h", "r") - + lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+') for i in f.read().splitlines(): r = re.search(r'^#define LVGL_VERSION_MAJOR ', i) - if r: + if r: m = lastNum.search(i) if m: ver[0] = m.group(1) r = re.search(r'^#define LVGL_VERSION_MINOR ', i) - if r: + if r: m = lastNum.search(i) if m: ver[1] = m.group(1) - + r = re.search(r'^#define LVGL_VERSION_PATCH ', i) - if r: + if r: m = lastNum.search(i) if m: ver[2] = m.group(1) - + f.close() - + com.cmd("git checkout master") - + os.chdir("../") return ver - + def push(c): cmd("git push " + c) - + def update_version(ver): ver_str = ver_format(ver) ver_num = ver[0] + "." + ver[1] + "." + ver[2] - + templ = fnmatch.filter(os.listdir('.'), '*_templ*.h') - + if len(templ) > 0 and templ[0]: print("Updating version in " + templ[0]) cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+.*/"+ "v" + ver_num + "/' " + templ[0]) - if os.path.exists("library.json"): + if os.path.exists("library.json"): print("Updating version in library.json") cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_num +"/' library.json") - - if path.exists("library.properties"): + + if path.exists("library.properties"): print("Updating version in library.properties") cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_num + "/' library.properties") - - if path.exists("conf.py"): - cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") - + + if path.exists("conf.py"): + cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") + if path.exists("Kconfig"): cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" Kconfig") - if path.exists("lvgl.h"): + if path.exists("lvgl.h"): define_set("./lvgl.h", "LVGL_VERSION_MAJOR", str(ver[0])) define_set("./lvgl.h", "LVGL_VERSION_MINOR", str(ver[1])) define_set("./lvgl.h", "LVGL_VERSION_PATCH", str(ver[2])) define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"" + ver[3] + "\"") - diff --git a/scripts/release/dev.py b/scripts/release/dev.py index 38c342e312..7b53fe530e 100755 --- a/scripts/release/dev.py +++ b/scripts/release/dev.py @@ -15,7 +15,7 @@ def lvgl_update_ver(ver, br): com.cmd("git commit -am 'Update " + br + " version'") com.push("origin " + br) com.cmd("git checkout master") - + os.chdir("../") def docs_update_ver(ver, br): @@ -25,10 +25,9 @@ def docs_update_ver(ver, br): com.cmd("git commit -am 'Update " + br + " version'") com.push("origin " + br) com.cmd("git checkout master --") - + os.chdir("../") - - + def merge_dev_to_master(): os.chdir("./lvgl") com.cmd("git checkout master") @@ -42,8 +41,7 @@ def merge_dev_to_master(): com.cmd("git merge dev -X theirs --no-edit;") com.push("origin latest") os.chdir("../") - - + def make(mode): if(mode == "bugfix"): ver = com.get_lvgl_version("master") @@ -58,14 +56,14 @@ def make(mode): if(mode == "major"): ver[0] = str(int(ver[0]) + 1) ver[1] = '0' - ver[2] = '0' + ver[2] = '0' if(mode == "minor"): ver[1] = str(int(ver[1]) + 1) - ver[2] = '0' - + ver[2] = '0' + lvgl_update_ver(ver, "dev") docs_update_ver(ver, "dev") - + if __name__ == '__main__': if(len(sys.argv) != 2): print("Missing argument. Usage ./dev.py major | minor | bugfix") diff --git a/scripts/release/main.py b/scripts/release/main.py index a96d11fc3c..ba9ab20434 100755 --- a/scripts/release/main.py +++ b/scripts/release/main.py @@ -15,7 +15,7 @@ proj_list = [ "lv_sim_eclipse_sdl", "lv_sim_emscripten"] def upstream(repo): return upstream_org_url + repo + ".git" - + def clone(repo): com.cmd("git clone --recurse-submodules " + upstream(repo)) os.chdir("./" + repo) @@ -23,7 +23,7 @@ def clone(repo): com.cmd("git remote update origin --prune") com.cmd("git pull origin --tags") os.chdir("..") - + def clone_repos(): com.cmd("rm -fr " + workdir) com.cmd("mkdir " + workdir) @@ -36,30 +36,30 @@ def clone_repos(): for p in proj_list: clone(p) - + def cleanup(): os.chdir("../") com.cmd("rm -fr " + workdir) if __name__ == '__main__': prepare_type = ['major', 'minor', 'bugfix'] - dev_prepare = 'minor' + dev_prepare = 'minor' # if(len(sys.argv) != 2): # print("Missing argument. Usage ./release.py bugfix | minor | major") -# print("Use minor by deafult") -# else: +# print("Use minor by default") +# else: # dev_prepare = sys.argv[1] - - if not (dev_prepare in prepare_type): - print("Invalid argument. Usage ./release.py bugfix | minor | major") + + if not (dev_prepare in prepare_type): + print("Invalid argument. Usage ./release.py bugfix | minor | major") exit(1) - + #os.chdir(workdir) clone_repos() release.make() for p in proj_list: proj.make(p, True) - - dev.make(dev_prepare) + + dev.make(dev_prepare) #cleanup() diff --git a/scripts/release/proj.py b/scripts/release/proj.py index db02cd5378..c28fd3207d 100755 --- a/scripts/release/proj.py +++ b/scripts/release/proj.py @@ -7,43 +7,41 @@ import re import subprocess import com - def make(repo_path, auto_push = False): os.chdir("./" + repo_path) com.cmd('git checkout master') - print("Upadte lvgl"); + print("Update lvgl"); os.chdir("./lvgl") com.cmd("git checkout master") com.cmd("git pull origin --tags") - - out = subprocess.Popen(['git', 'tag', '--sort=-creatordate'], - stdout=subprocess.PIPE, + + out = subprocess.Popen(['git', 'tag', '--sort=-creatordate'], + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout,stderr = out.communicate() - + ver_str = stdout.decode("utf-8").split('\n')[0] release_br = ver_str[1:] #trim "v" release_br = release_br.split('.')[0] # get the first number release_br = "release/v" + release_br - + com.cmd("git checkout " + release_br + "; git pull origin " + release_br) - + os.chdir("..") - + com.cmd("cp -f lvgl/lv_conf_template.h lv_conf.h") com.cmd("sed -i -r 's/#if 0/#if 1/' lv_conf.h") # Enable lv_conf.h with open("confdef.txt") as f: for line in f: (key, val) = line.rstrip().split('\t') - com.define_set("lv_conf.h", str(key), str(val)) + com.define_set("lv_conf.h", str(key), str(val)) - - if os.path.exists("lv_examples"): - print("Upadte lv_examples"); + if os.path.exists("lv_examples"): + print("Update lv_examples"); com.cmd("cd lv_examples; git co " + release_br + "; git pull origin " + release_br) - - if os.path.exists("lv_drivers"): - print("upadte lv_drivers"); + + if os.path.exists("lv_drivers"): + print("update lv_drivers"); com.cmd("cd lv_drivers " + release_br + "; git pull origin " + release_br) msg = 'Update to ' + ver_str @@ -53,7 +51,7 @@ def make(repo_path, auto_push = False): if auto_push: com.push("origin --tags") com.push("origin master") - + os.chdir("../") if __name__ == '__main__': diff --git a/scripts/release/release.py b/scripts/release/release.py index edcdf79e4c..1e6037df5a 100755 --- a/scripts/release/release.py +++ b/scripts/release/release.py @@ -8,21 +8,21 @@ import com import re def update_release_branch(release_br, master_br = "master"): - com.cmd("git checkout " + release_br) - com.cmd("git pull origin " + release_br) - com.cmd("git merge "+ master_br +" -X ours"); - com.push("origin " + release_br); - com.cmd("git checkout master"); - + com.cmd("git checkout " + release_br) + com.cmd("git pull origin " + release_br) + com.cmd("git merge "+ master_br +" -X ours"); + com.push("origin " + release_br); + com.cmd("git checkout master"); + def lvgl_release(ver): print("Release lvgl") - + ver_str = com.ver_format(ver) release_br = "release/v" + str(ver[0]) - + os.chdir("./lvgl") com.define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"') - + # Run some scripts os.chdir("./scripts") com.cmd("./code-format.sh") @@ -35,132 +35,132 @@ def lvgl_release(ver): #update CHANGLELOG new_content = "" f = open("./CHANGELOG.md", "r") - + release_note = "" - note_state = 0 + note_state = 0 for i in f.read().splitlines(): if note_state == 0: r = re.search(r'^## ' + ver_str, i) - if r: - i = i.replace("planned on ", "") + if r: + i = i.replace("planned on ", "") note_state+=1 - - elif note_state == 1: + + elif note_state == 1: r = re.search(r'^## ', i) if r: note_state+=1 else: release_note += i + '\n' - + new_content += i + '\n' - + f.close() - + f = open("./CHANGELOG.md", "w") f.write(new_content) f.close() - + com.cmd('git commit -am "Release ' + ver_str + '"') - + com.cmd('git checkout dev') com.cmd("git merge master -X ours") com.cmd("git add .") com.cmd("git commit -am 'Merge master'", False) com.push('origin dev') com.cmd('git checkout master') - com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") com.push('origin master') com.push('origin --tags') - + update_release_branch(release_br) - + os.chdir("../") - + return release_note - - + def lv_examples_release(ver): print("Release lv_examples") - + os.chdir("./lv_examples") release_br = "release/v" + str(ver[0]) ver_str = com.ver_format(ver) - + com.update_version(ver) - - com.cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK(" + str(ver[0]) + ", " + str(ver[1]) + ", " + str(ver[2]) + ")/' lv_examples.h") - + + com.cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK\(" + str(ver[0]) + ", " + str(ver[1]) + ", " + str(ver[2]) + ")/' lv_examples.h") + com.cmd('git commit -am "Release ' + ver_str + '"') - com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") com.push('origin master') com.push('origin --tags') + + update_release_branch(release_br) os.chdir("../") - + def lv_drivers_release(ver): print("Release lv_drivers") - + os.chdir("./lv_drivers") release_br = "release/v" + str(ver[0]) ver_str = com.ver_format(ver) - + com.update_version(ver) - + com.cmd('git commit -am "Release ' + ver_str + '"') - com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") com.push('origin master') com.push('origin --tags') - + update_release_branch(release_br) os.chdir("../") - + def docs_release(ver): print("Release docs") - + os.chdir("./docs") release_br = "release/v" + str(ver[0]) ver_str = com.ver_format(ver) - - com.cmd("git co latest --") - com.cmd("rm -rf xml"); - com.cmd("cp -r ../lvgl/docs/api_doc/xml ."); + + com.cmd("git co latest --") + com.cmd("rm -rf xml"); + com.cmd("cp -r ../lvgl/docs/api_doc/xml ."); com.cmd("git add xml"); - + com.update_version(ver) com.cmd('git commit -am "Release ' + ver_str + '"') - com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") + com.cmd("git tag -a " + ver_str + " -m 'Release " + ver_str + "' ") com.push('origin master') com.push('origin --tags') - + update_release_branch(release_br, "latest") os.chdir("../") - + def blog_release(ver, release_note): - + os.chdir("./blog/_posts") - + ver_str = com.ver_format(ver) - + post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n" post += release_note - + today = date.today() d = today.strftime("%Y-%m-%d") - + f = open(d + "-release_" + ver_str + ".md", "w") f.write(post) f.close() - + com.cmd("git add .") com.cmd("git commit -am 'Add " + ver_str + " release post'") com.push('origin master') - + os.chdir("../../") - - + def make(): ver = com.get_lvgl_version("master") release_note = lvgl_release(ver) @@ -168,6 +168,6 @@ def make(): lv_drivers_release(ver) docs_release(ver) blog_release(ver, release_note) - + if __name__ == '__main__': make() diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 592d54d3ba..acc7bbd049 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -349,7 +349,6 @@ # endif #endif - /* Gesture threshold in pixels */ #ifndef LV_INDEV_DEF_GESTURE_LIMIT # ifdef CONFIG_LV_INDEV_DEF_GESTURE_LIMIT @@ -602,7 +601,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ * (I.e. no new image decoder is added) * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. * However the opened images might consume additional RAM. - * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ + * Set it to 0 to disable caching */ #ifndef LV_IMG_CACHE_DEF_SIZE # ifdef CONFIG_LV_IMG_CACHE_DEF_SIZE # define LV_IMG_CACHE_DEF_SIZE CONFIG_LV_IMG_CACHE_DEF_SIZE @@ -1363,15 +1362,15 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ # endif #endif #ifndef lv_snprintf -# ifdef CONFIG_lv_snprintf -# define lv_snprintf CONFIG_lv_snprintf +# ifdef CONFIG_LV_SNPRINTF +# define lv_snprintf CONFIG_LV_SNPRINTF # else # define lv_snprintf snprintf # endif #endif #ifndef lv_vsnprintf -# ifdef CONFIG_lv_vsnprintf -# define lv_vsnprintf CONFIG_lv_vsnprintf +# ifdef CONFIG_LV_VSNPRINTF +# define lv_vsnprintf CONFIG_LV_VSNPRINTF # else # define lv_vsnprintf vsnprintf # endif diff --git a/src/lv_conf_kconfig.h b/src/lv_conf_kconfig.h index 5757c94dbc..6225ed02a4 100644 --- a/src/lv_conf_kconfig.h +++ b/src/lv_conf_kconfig.h @@ -30,8 +30,8 @@ extern "C" { *******************/ #ifndef LV_MEM_SIZE -#if defined (CONFIG_LV_MEM_SIZE_BYTES) -#define CONFIG_LV_MEM_SIZE (CONFIG_LV_MEM_SIZE_BYTES * 1024U) +#if defined (CONFIG_LV_MEM_SIZE_KILOBYTES) +#define CONFIG_LV_MEM_SIZE (CONFIG_LV_MEM_SIZE_KILOBYTES * 1024U) #endif #endif @@ -337,9 +337,9 @@ extern "C" { *-----------------*/ #ifndef LV_TEXT_ENC #ifdef CONFIG_LV_TXT_ENC_UTF8 -#define CONFIG_LV_TXT_ENC LV_TXT_ENC_UTF8 +#define CONFIG_LV_TXT_ENC LV_TXT_ENC_UTF8 #elif defined CONFIG_LV_TXT_ENC_ASCII -#define CONFIG_LV_TXT_ENC LV_TXT_ENC_ASCII +#define CONFIG_LV_TXT_ENC LV_TXT_ENC_ASCII #endif #endif @@ -363,11 +363,11 @@ extern "C" { #ifndef LV_USE_EXT_CLICK_AREA #ifdef CONFIG_LV_USE_EXT_CLICK_AREA_OFF -#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF +#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF #elif defined CONFIG_LV_USE_EXT_CLICK_AREA_TINY -#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY +#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY #elif defined CONFIG_LV_USE_EXT_CLICK_AREA_FULL -#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_FULL +#define CONFIG_LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_FULL #endif #endif @@ -385,7 +385,6 @@ extern "C" { #endif #endif - /*------------------ * SPINNER DEF ANIM *-----------------*/ @@ -400,6 +399,20 @@ extern "C" { #endif #endif +/*------------------ + * SPRINTF DISABLE FLOAT + *-----------------*/ + +#if defined(CONFIG_LV_CONF_SKIP) || defined(LV_CONF_SKIP) +# ifndef LV_SPRINTF_DISABLE_FLOAT +# ifndef CONFIG_LV_SPRINTF_DISABLE_FLOAT +# define LV_SPRINTF_DISABLE_FLOAT 0 +# else +# define LV_SPRINTF_DISABLE_FLOAT 1 +# endif +# endif +#endif + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/lv_conf_zephyr.h b/src/lv_conf_zephyr.h deleted file mode 100644 index e4e338f2b7..0000000000 --- a/src/lv_conf_zephyr.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2020 Jan Van Winkel - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifdef __ZEPHYR__ - - #include - - #define LV_MEM_CUSTOM 1 - - #define LV_MEMCPY_MEMSET_STD 1 - - #ifdef CONFIG_LVGL_MEM_POOL_HEAP_KERNEL - - #define LV_MEM_CUSTOM_INCLUDE "kernel.h" - #define LV_MEM_CUSTOM_ALLOC k_malloc - #define LV_MEM_CUTOM_FREE k_free - - #elif defined(CONFIG_LVGL_MEM_POOL_HEAP_LIB_C) - - #define LV_MEM_CUSTOM_INCLUDE "stdlib.h" - #define LV_MEM_CUSTOM_ALLOC malloc - #define LV_MEM_CUTOM_FREE free - - #else - - #define LV_MEM_CUSTOM_INCLUDE "lvgl_mem.h" - #define LV_MEM_CUSTOM_ALLOC lvgl_malloc - #define LV_MEM_CUTOM_FREE lvgl_free - - #endif - - #define LV_ENABLE_GC 0 - - #define LV_TICK_CUSTOM 1 - #define LV_TICK_CUSTOM_INCLUDE "kernel.h" - #define LV_TICK_CUSTOM_SYS_TIME_EXPR (k_uptime_get_32()) - - #define LV_SPRINTF_CUSTOM 1 - - #if LV_SPRINTF_CUSTOM - #define LV_SPRINTF_INCLUDE "stdio.h" - #define lv_snprintf snprintf - #define lv_vsnprintf vsnprintf - #endif - -#endif diff --git a/src/lv_core/lv_disp.c b/src/lv_core/lv_disp.c index 51c0db34e7..b9c305b101 100644 --- a/src/lv_core/lv_disp.c +++ b/src/lv_core/lv_disp.c @@ -161,7 +161,6 @@ void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src) _lv_inv_area(disp, &a); } - /** * Opacity of the background * @param disp pointer to a display @@ -197,8 +196,7 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t lv_disp_t * d = lv_obj_get_disp(new_scr); lv_obj_t * act_scr = lv_scr_act(); - - if(d->del_prev && act_scr != d->scr_to_load) { + if(d->del_prev && act_scr != d->scr_to_load && d->scr_to_load) { lv_obj_del(act_scr); lv_disp_load_scr(d->scr_to_load); lv_anim_del(d->scr_to_load, NULL); diff --git a/src/lv_core/lv_disp.h b/src/lv_core/lv_disp.h index 5380bed2fd..422cb10dc5 100644 --- a/src/lv_core/lv_disp.h +++ b/src/lv_core/lv_disp.h @@ -199,7 +199,6 @@ static inline void lv_scr_load(lv_obj_t * scr) #define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) #endif - /** * Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP) * 1 dip is 1 px on a 160 DPI screen diff --git a/src/lv_core/lv_group.c b/src/lv_core/lv_group.c index 8242373f15..694c53e57d 100644 --- a/src/lv_core/lv_group.c +++ b/src/lv_core/lv_group.c @@ -13,10 +13,6 @@ #include "../lv_themes/lv_theme.h" #include "../lv_misc/lv_gc.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -84,7 +80,7 @@ lv_group_t * lv_group_create(void) */ void lv_group_del(lv_group_t * group) { - /*Defocus the the currently focused object*/ + /*Defocus the currently focused object*/ if(group->obj_focus != NULL) { (*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); lv_obj_invalidate(*group->obj_focus); @@ -191,7 +187,7 @@ void lv_group_remove_obj(lv_obj_t * obj) */ void lv_group_remove_all_objs(lv_group_t * group) { - /*Defocus the the currently focused object*/ + /*Defocus the currently focused object*/ if(group->obj_focus != NULL) { (*group->obj_focus)->signal_cb(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); lv_obj_invalidate(*group->obj_focus); diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index 23b910f49b..4cf0c86d66 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -578,7 +578,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) } /* Save the last keys before anything else. - * They need to be already saved if the the function returns for any reason*/ + * They need to be already saved if the function returns for any reason*/ lv_indev_state_t last_state = i->proc.types.keypad.last_state; i->proc.types.keypad.last_state = data->state; i->proc.types.keypad.last_key = data->key; @@ -650,7 +650,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) /*On enter long press toggle edit mode.*/ if(editable) { /*Don't leave edit mode if there is only one object (nowhere to navigate)*/ - if(_lv_ll_is_empty(&g->obj_ll) == false) { + if(_lv_ll_get_len(&g->obj_ll) > 1) { lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/ } } @@ -716,7 +716,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data) /*An object is being edited and the button is released. */ else if(g->editing) { /*Ignore long pressed enter release because it comes from mode switch*/ - if(!i->proc.long_pr_sent || _lv_ll_is_empty(&g->obj_ll)) { + if(!i->proc.long_pr_sent || _lv_ll_get_len(&g->obj_ll) <= 1) { indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL); if(indev_reset_check(&i->proc)) return; @@ -1170,7 +1170,6 @@ static void indev_click_focus(lv_indev_proc_t * proc) } - /** * Handle the gesture of indev_proc_p->types.pointer.act_obj * @param indev pointer to a input device state @@ -1190,7 +1189,6 @@ void indev_gesture(lv_indev_proc_t * proc) if(gesture_obj == NULL) return; - if((LV_ABS(proc->types.pointer.vect.x) < indev_act->driver.gesture_min_velocity) && (LV_ABS(proc->types.pointer.vect.y) < indev_act->driver.gesture_min_velocity)) { proc->types.pointer.gesture_sum.x = 0; @@ -1226,8 +1224,6 @@ void indev_gesture(lv_indev_proc_t * proc) } } - - /** * Checks if the reset_query flag has been set. If so, perform necessary global indev cleanup actions * @param proc pointer to an input device 'proc' diff --git a/src/lv_core/lv_refr.c b/src/lv_core/lv_refr.c index ea7a3dbb78..13b3176bc9 100644 --- a/src/lv_core/lv_refr.c +++ b/src/lv_core/lv_refr.c @@ -23,10 +23,6 @@ #include "../lv_widgets/lv_label.h" #endif -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -78,7 +74,7 @@ void _lv_refr_init(void) /** * Redraw the invalidated areas now. * Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process - * can prevent the call of `lv_task_handler`. In this case if the the GUI is updated in the process + * can prevent the call of `lv_task_handler`. In this case if the GUI is updated in the process * (e.g. progress bar) this function can be called when the screen should be updated. * @param disp pointer to display to refresh. NULL to refresh all displays. */ @@ -564,7 +560,6 @@ static void lv_refr_area_part(const lv_area_t * area_p) } - if(top_act_scr == NULL) { top_act_scr = disp_refr->act_scr; } diff --git a/src/lv_core/lv_refr.h b/src/lv_core/lv_refr.h index 177981c9e6..d3c67c2229 100644 --- a/src/lv_core/lv_refr.h +++ b/src/lv_core/lv_refr.h @@ -50,7 +50,7 @@ void _lv_refr_init(void); /** * Redraw the invalidated areas now. * Normally the redrawing is periodically executed in `lv_task_handler` but a long blocking process - * can prevent the call of `lv_task_handler`. In this case if the the GUI is updated in the process + * can prevent the call of `lv_task_handler`. In this case if the GUI is updated in the process * (e.g. progress bar) this function can be called when the screen should be updated. * @param disp pointer to display to refresh. NULL to refresh all displays. */ diff --git a/src/lv_core/lv_style.h b/src/lv_core/lv_style.h index 867aca9955..5ce9b72bff 100644 --- a/src/lv_core/lv_style.h +++ b/src/lv_core/lv_style.h @@ -581,8 +581,6 @@ bool lv_style_is_empty(const lv_style_t * style); */ #define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy_p); - - #if LV_USE_DEBUG # ifndef LV_DEBUG_IS_STYLE diff --git a/src/lv_draw/lv_draw_arc.c b/src/lv_draw/lv_draw_arc.c index c5d105eeaf..1fdb779806 100644 --- a/src/lv_draw/lv_draw_arc.c +++ b/src/lv_draw/lv_draw_arc.c @@ -34,7 +34,6 @@ typedef struct { const lv_area_t * clip_area; } quarter_draw_dsc_t; - /********************** * STATIC PROTOTYPES **********************/ @@ -44,7 +43,6 @@ static void draw_quarter_2(quarter_draw_dsc_t * q); static void draw_quarter_3(quarter_draw_dsc_t * q); static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area); - /********************** * STATIC VARIABLES **********************/ @@ -364,7 +362,6 @@ static void draw_quarter_2(quarter_draw_dsc_t * q) } } - static void draw_quarter_3(quarter_draw_dsc_t * q) { lv_area_t quarter_area; @@ -418,7 +415,6 @@ static void draw_quarter_3(quarter_draw_dsc_t * q) } } - static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area) { const uint8_t ps = 8; @@ -456,4 +452,3 @@ static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness res_area->y2 = cir_y + thick_half - thick_corr; } } - diff --git a/src/lv_draw/lv_draw_blend.c b/src/lv_draw/lv_draw_blend.c index 023ec137d3..900d8de190 100644 --- a/src/lv_draw/lv_draw_blend.c +++ b/src/lv_draw/lv_draw_blend.c @@ -70,7 +70,7 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co * STATIC VARIABLES **********************/ -#if LV_USE_GPU || LV_USE_GPU_STM32_DMA2D +#if (LV_USE_GPU || LV_USE_GPU_STM32_DMA2D) && (LV_USE_GPU_NXP_PXP == 0) && (LV_USE_GPU_NXP_VG_LITE == 0) LV_ATTRIBUTE_DMA static lv_color_t blend_buf[LV_HOR_RES_MAX]; #endif @@ -78,7 +78,6 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co * MACROS **********************/ - #define FILL_NORMAL_MASK_PX(out_x, color) \ if(*mask_tmp_x) { \ if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[out_x] = color; \ @@ -86,7 +85,6 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co } \ mask_tmp_x++; - #define FILL_NORMAL_MASK_PX_SCR_TRANSP(out_x, color) \ if(*mask_tmp_x) { \ if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[out_x] = color; \ @@ -96,7 +94,6 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co } \ mask_tmp_x++; - #define MAP_NORMAL_MASK_PX(x) \ if(*mask_tmp_x) { \ if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[x] = map_buf_first[x]; \ @@ -117,7 +114,6 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co * GLOBAL FUNCTIONS **********************/ - /** * Fill and area in the display buffer. * @param clip_area clip the fill to this area (absolute coordinates) @@ -252,7 +248,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a #endif } - /********************** * STATIC FUNCTIONS **********************/ @@ -336,12 +331,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co /*Simple fill (maybe with opacity), no masking*/ if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) { if(opa > LV_OPA_MAX) { -#if LV_USE_GPU - if(disp->driver.gpu_fill_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) { - disp->driver.gpu_fill_cb(&disp->driver, disp_buf, disp_w, draw_area, color); - return; - } -#elif LV_USE_GPU_NXP_PXP +#if LV_USE_GPU_NXP_PXP if(lv_area_get_size(draw_area) >= LV_GPU_NXP_PXP_FILL_SIZE_LIMIT) { lv_gpu_nxp_pxp_fill(disp_buf, disp_w, draw_area, color, opa); return; @@ -358,6 +348,11 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co lv_gpu_stm32_dma2d_fill(disp_buf_first, disp_w, color, draw_area_w, draw_area_h); return; } +#elif LV_USE_GPU + if(disp->driver.gpu_fill_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) { + disp->driver.gpu_fill_cb(&disp->driver, disp_buf, disp_w, draw_area, color); + return; + } #endif /*Software rendering*/ for(y = 0; y < draw_area_h; y++) { @@ -392,7 +387,6 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co } #endif - #if LV_USE_GPU_STM32_DMA2D if(lv_area_get_size(draw_area) >= 240) { if(blend_buf[0].full != color.full) lv_color_fill(blend_buf, color, LV_HOR_RES_MAX); @@ -450,7 +444,6 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co } #endif - /*Buffer the result color to avoid recalculating the same color*/ lv_color_t last_dest_color; lv_color_t last_res_color; @@ -581,7 +574,6 @@ static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, co /*Create a temp. disp_buf which always point to current line to draw*/ lv_color_t * disp_buf_tmp = disp_buf + disp_w * draw_area->y1; - lv_color_t (*blend_fp)(lv_color_t, lv_color_t, lv_opa_t); switch(mode) { case LV_BLEND_MODE_ADDITIVE: @@ -757,7 +749,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col if(opa > LV_OPA_MAX) { #if LV_USE_GPU_NXP_PXP - if(lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_SIZE_LIMIT) { + if(lv_area_get_size(draw_area) >= LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT) { lv_gpu_nxp_pxp_blit(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h, opa); return; } @@ -775,7 +767,6 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col blit.src_area.x2 = blit.src_area.x1 + draw_area_w; blit.src_area.y2 = blit.src_area.y1 + draw_area_h; - blit.dst = disp_buf; blit.dst_width = lv_area_get_width(disp_area); blit.dst_height = lv_area_get_height(disp_area); @@ -826,7 +817,6 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col blit.src_area.x2 = blit.src_area.x1 + draw_area_w; blit.src_area.y2 = blit.src_area.y1 + draw_area_h; - blit.dst = disp_buf; blit.dst_width = lv_area_get_width(disp_area); blit.dst_height = lv_area_get_height(disp_area); diff --git a/src/lv_draw/lv_draw_blend.h b/src/lv_draw/lv_draw_blend.h index a5f57ed881..3dcf2c0457 100644 --- a/src/lv_draw/lv_draw_blend.h +++ b/src/lv_draw/lv_draw_blend.h @@ -42,7 +42,6 @@ typedef uint8_t lv_blend_mode_t; LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode); - LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode); diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index 7f6c813e06..d66ae836ae 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -313,7 +313,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, return LV_RES_INV; } - lv_draw_map(&line, &mask_line, buf, draw_dsc, chroma_keyed, alpha_byte); line.y1++; line.y2++; @@ -512,7 +511,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const mask_res = (alpha_byte || chroma_key || draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER; - /*Prepare the `mask_buf`if there are other masks*/ if(other_mask_cnt) { lv_memset_ff(mask_buf, mask_buf_size); @@ -532,7 +530,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const #endif for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) { - #if LV_USE_IMG_TRANSFORM if(transform) { @@ -656,11 +653,10 @@ static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, co static void draw_cleanup(lv_img_cache_entry_t * cache) { -/*Automatically close images with no caching*/ + /*Automatically close images with no caching*/ #if LV_IMG_CACHE_DEF_SIZE == 0 lv_img_decoder_close(&cache->dec_dsc); #else LV_UNUSED(cache); #endif } - diff --git a/src/lv_draw/lv_draw_img.h b/src/lv_draw/lv_draw_img.h index 245f6933ca..13e97a81c8 100644 --- a/src/lv_draw/lv_draw_img.h +++ b/src/lv_draw/lv_draw_img.h @@ -89,7 +89,6 @@ bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf); */ bool lv_img_cf_has_alpha(lv_img_cf_t cf); - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index 512e6a5ad2..e822f2291a 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -41,7 +41,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area, const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode); - static uint8_t hex_char_to_num(char hex); /********************** @@ -231,7 +230,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area lv_color_t recolor; int32_t letter_w; - lv_draw_rect_dsc_t draw_dsc_sel; lv_draw_rect_dsc_init(&draw_dsc_sel); draw_dsc_sel.bg_color = dsc->sel_bg_color; @@ -388,7 +386,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area * STATIC FUNCTIONS **********************/ - /** * Draw a letter in the Virtual Display Buffer * @param pos_p left-top coordinate of the latter @@ -414,7 +411,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_font_glyph_dsc_t g; bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0'); if(g_ret == false) { - /* Add waring if the dsc is not found + /* Add warning if the dsc is not found * but do not print warning for non printable ASCII chars (e.g. '\n')*/ if(letter >= 0x20) { LV_LOG_WARN("lv_draw_letter: glyph dsc. not found"); @@ -436,7 +433,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const return; } - const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter); if(map_p == NULL) { LV_LOG_WARN("lv_draw_letter: character's bitmap not found"); @@ -451,7 +447,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const } } - LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area, const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode) @@ -568,7 +563,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_ mask_p++; } - /*Apply masks if any*/ if(other_mask_cnt) { lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2, @@ -646,7 +640,6 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ int32_t box_h = g->box_h; int32_t width_bit = box_w * bpp; /*Letter width in bits*/ - /* Calculate the col/row start/end on the map*/ int32_t col_start = pos_x >= clip_area->x1 ? 0 : (clip_area->x1 - pos_x) * 3; int32_t col_end = pos_x + box_w / 3 <= clip_area->x2 ? box_w : (clip_area->x2 - pos_x + 1) * 3; @@ -816,7 +809,6 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ #endif } - /** * Convert a hexadecimal characters to a number (0..15) * @param hex Pointer to a hexadecimal character (0..9, A..F) diff --git a/src/lv_draw/lv_draw_line.c b/src/lv_draw/lv_draw_line.c index 59a2a5012c..a4348b0140 100644 --- a/src/lv_draw/lv_draw_line.c +++ b/src/lv_draw/lv_draw_line.c @@ -83,7 +83,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_poin else if(point1->x == point2->x) draw_line_ver(point1, point2, &clip_line, dsc); else draw_line_skew(point1, point2, &clip_line, dsc); - if(dsc->round_end || dsc->round_start) { lv_draw_rect_dsc_t cir_dsc; lv_draw_rect_dsc_init(&cir_dsc); @@ -217,7 +216,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const } } - LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip, const lv_draw_line_dsc_t * dsc) @@ -312,7 +310,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const } } - LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip, const lv_draw_line_dsc_t * dsc) diff --git a/src/lv_draw/lv_draw_line.h b/src/lv_draw/lv_draw_line.h index c34606c4d9..26a449121a 100644 --- a/src/lv_draw/lv_draw_line.h +++ b/src/lv_draw/lv_draw_line.h @@ -51,7 +51,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_poin LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc); - //! @endcond /********************** diff --git a/src/lv_draw/lv_draw_mask.c b/src/lv_draw/lv_draw_mask.c index 7cd673d921..e71fcc2958 100644 --- a/src/lv_draw/lv_draw_mask.c +++ b/src/lv_draw/lv_draw_mask.c @@ -12,10 +12,6 @@ #include "../lv_misc/lv_debug.h" #include "../lv_misc/lv_gc.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -284,7 +280,6 @@ void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t * Find the degree which keeps the origo in place */ if(angle > 180) angle -= 180; /*> 180 will swap the origo*/ - int32_t p2x; int32_t p2y; @@ -294,7 +289,6 @@ void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t lv_draw_mask_line_points_init(param, p1x, py, p2x, p2y, side); } - /** * Initialize an angle mask. * @param param pointer to a `lv_draw_mask_param_t` to initialize @@ -360,7 +354,6 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert lv_draw_mask_line_angle_init(¶m->end_line, vertex_x, vertex_y, end_angle, end_side); } - /** * Initialize a fade mask. * @param param param pointer to a `lv_draw_mask_param_t` to initialize @@ -385,7 +378,6 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area param->y_prev_x.i = 0; } - /** * Initialize a fade mask. * @param param pointer to a `lv_draw_mask_param_t` to initialize @@ -408,7 +400,6 @@ void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t * param->dsc.type = LV_DRAW_MASK_TYPE_FADE; } - /** * Initialize a map mask. * @param param pointer to a `lv_draw_mask_param_t` to initialize @@ -423,7 +414,6 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c param->dsc.type = LV_DRAW_MASK_TYPE_MAP; } - /********************** * STATIC FUNCTIONS **********************/ @@ -573,7 +563,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b if(k >= len) break; } - if(k < len && k >= 0) { int32_t x_inters = (px_h * p->xy_steep) >> 10; m = (x_inters * px_h) >> 9; @@ -582,7 +571,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b mask_buf[k] = mask_mix(mask_buf[k], m); } - if(p->inv) { k = xei - abs_x; if(k > len) { @@ -747,7 +735,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_ return LV_DRAW_MASK_RES_CHANGED; } - LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_angle_param_t * p) @@ -755,7 +742,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma int32_t rel_y = abs_y - p->cfg.vertex_p.y; int32_t rel_x = abs_x - p->cfg.vertex_p.x; - if(p->cfg.start_angle < 180 && p->cfg.end_angle < 180 && p->cfg.start_angle != 0 && p->cfg.end_angle != 0 && p->cfg.start_angle > p->cfg.end_angle) { @@ -768,7 +754,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma int32_t end_angle_first = (rel_y * p->end_line.xy_steep) >> 10; int32_t start_angle_last = ((rel_y + 1) * p->start_line.xy_steep) >> 10; - /*Do not let the line end cross the vertex else it will affect the opposite part*/ if(p->cfg.start_angle > 270 && p->cfg.start_angle <= 359 && start_angle_last < 0) start_angle_last = 0; else if(p->cfg.start_angle > 0 && p->cfg.start_angle <= 90 && start_angle_last < 0) start_angle_last = 0; @@ -778,7 +763,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma else if(p->cfg.end_angle > 0 && p->cfg.end_angle <= 90 && start_angle_last < 0) start_angle_last = 0; else if(p->cfg.end_angle > 90 && p->cfg.end_angle < 270 && start_angle_last > 0) start_angle_last = 0; - int32_t dist = (end_angle_first - start_angle_last) >> 1; lv_draw_mask_res_t res1 = LV_DRAW_MASK_RES_FULL_COVER; @@ -1139,7 +1123,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m return LV_DRAW_MASK_RES_CHANGED; } - LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len, lv_draw_mask_fade_param_t * p) @@ -1200,7 +1183,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask const lv_opa_t * map_tmp = p->cfg.map; map_tmp += (abs_y - p->cfg.coords.y1) * lv_area_get_width(&p->cfg.coords); - if(abs_x + len > p->cfg.coords.x2) len -= abs_x + len - p->cfg.coords.x2 - 1; if(abs_x < p->cfg.coords.x1) { @@ -1221,7 +1203,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask return LV_DRAW_MASK_RES_CHANGED; } - LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new) { if(mask_new >= LV_OPA_MAX) return mask_act; diff --git a/src/lv_draw/lv_draw_mask.h b/src/lv_draw/lv_draw_mask.h index 6d2256ced4..6a160b79a2 100644 --- a/src/lv_draw/lv_draw_mask.h +++ b/src/lv_draw/lv_draw_mask.h @@ -37,7 +37,6 @@ enum { typedef uint8_t lv_draw_mask_res_t; - enum { LV_DRAW_MASK_TYPE_LINE, LV_DRAW_MASK_TYPE_ANGLE, @@ -103,7 +102,6 @@ typedef struct { /*1: It's a flat line? (Near to horizontal)*/ uint8_t flat : 1; - /* Invert the mask. The default is: Keep the left part. * It is used to select left/right/top/bottom*/ uint8_t inv: 1; @@ -182,7 +180,6 @@ typedef _lv_draw_mask_saved_t _lv_draw_mask_saved_arr_t[_LV_MASK_MAX_NUM]; */ int16_t lv_draw_mask_add(void * param, void * custom_id); - //! @cond Doxygen_Suppress /** @@ -199,7 +196,6 @@ int16_t lv_draw_mask_add(void * param, void * custom_id); LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len); - //! @endcond /** @@ -226,7 +222,6 @@ void * lv_draw_mask_remove_custom(void * custom_id); */ LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void); - //! @endcond /** diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 22d4561169..55aee6c461 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -205,7 +205,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are lv_draw_mask_res_t mask_res = LV_DRAW_MASK_RES_FULL_COVER; lv_color_t grad_color = dsc->bg_color; - lv_color_t * grad_map = NULL; /*In case of horizontal gradient pre-compute a line with a gradient*/ if(grad_dir == LV_GRAD_DIR_HOR) { @@ -290,7 +289,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are _lv_blend_fill(clip, &fill_area2, grad_color, mask_buf + mask_ofs, mask_res, opa2, dsc->blend_mode); - } else { if(grad_dir == LV_GRAD_DIR_HOR) { @@ -323,7 +321,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are if(fill_area.y1 <= fill_area.y2) fill_area.y1 = fill_area.y2 + 1; /*Avoid overdrawing the last line*/ fill_area.y2 = coords_bg.y2; - _lv_blend_fill(clip, &fill_area, dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->blend_mode); @@ -594,7 +591,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv short_side = LV_MIN(lv_area_get_width(&sh_rect_area), lv_area_get_height(&sh_rect_area)); if(r_sh > short_side >> 1) r_sh = short_side >> 1; - int32_t corner_size = sw + r_sh; lv_opa_t * sh_buf; @@ -921,7 +917,6 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv } } - /*Fill the bottom side*/ a.x1 = sh_area.x1 + corner_size; a.x2 = sh_area.x2 - corner_size; @@ -1209,6 +1204,7 @@ static void draw_content(const lv_area_t * coords, const lv_area_t * clip, const if(s.x == 0 || s.y == 0) return; lv_area_t coords_tmp; + lv_draw_mask_radius_param_t radius_mask_param; coords_tmp.x1 = 0; coords_tmp.y1 = 0; @@ -1377,7 +1373,6 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are if(mask_ofs < 0) mask_ofs = 0; _lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode); - fill_area.y1++; fill_area.y2++; } @@ -1417,4 +1412,3 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are lv_draw_mask_remove_id(mask_rout_id); lv_mem_buf_release(mask_buf); } - diff --git a/src/lv_draw/lv_draw_triangle.c b/src/lv_draw/lv_draw_triangle.c index 84b792abd7..9658dd30a7 100644 --- a/src/lv_draw/lv_draw_triangle.c +++ b/src/lv_draw/lv_draw_triangle.c @@ -125,7 +125,6 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are i_next_right = y_min_i + 1; if(i_next_right > point_cnt - 1) i_next_right = 0; - /* Check if the order of points is inverted or not. * The normal case is when the left point is on `y_min_i - 1` * Explanation: diff --git a/src/lv_draw/lv_img_buf.c b/src/lv_draw/lv_img_buf.c index 97699631d3..7788959955 100644 --- a/src/lv_draw/lv_img_buf.c +++ b/src/lv_draw/lv_img_buf.c @@ -38,7 +38,6 @@ * GLOBAL FUNCTIONS **********************/ - /** * Get the color of an image's pixel * @param dsc an image descriptor @@ -411,7 +410,6 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf) } } - #if LV_USE_IMG_TRANSFORM /** * Initialize a descriptor to transform an image @@ -485,7 +483,6 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t return; } - res->x1 = (((-pivot->x) * zoom) >> 8) - 1; res->y1 = (((-pivot->y) * zoom) >> 8) - 1; res->x2 = (((w - pivot->x) * zoom) >> 8) + 2; @@ -772,4 +769,3 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc) /********************** * STATIC FUNCTIONS **********************/ - diff --git a/src/lv_draw/lv_img_buf.h b/src/lv_draw/lv_img_buf.h index ad8d5b26a6..9f83e83dd5 100644 --- a/src/lv_draw/lv_img_buf.h +++ b/src/lv_draw/lv_img_buf.h @@ -17,7 +17,6 @@ extern "C" { #include "../lv_misc/lv_color.h" #include "../lv_misc/lv_area.h" - /********************* * DEFINES *********************/ @@ -101,7 +100,6 @@ enum { }; typedef uint8_t lv_img_cf_t; - /** * LVGL image header */ @@ -120,7 +118,6 @@ typedef struct { non-printable character*/ uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/ - } lv_img_header_t; #else typedef struct { @@ -163,7 +160,6 @@ typedef struct { lv_opa_t opa; } res; - struct { lv_img_dsc_t img_dsc; int32_t pivot_x_256; @@ -269,7 +265,6 @@ void lv_img_buf_free(lv_img_dsc_t * dsc); */ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf); - #if LV_USE_IMG_TRANSFORM /** * Initialize a descriptor to rotate an image @@ -283,7 +278,6 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc); */ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc); - /** * Get which color and opa would come to a pixel if it were rotated * @param dsc a descriptor initialized by `lv_img_buf_rotate_init` diff --git a/src/lv_draw/lv_img_cache.c b/src/lv_draw/lv_img_cache.c index 650fc3eebd..2cd012c05d 100644 --- a/src/lv_draw/lv_img_cache.c +++ b/src/lv_draw/lv_img_cache.c @@ -13,9 +13,6 @@ #include "../lv_hal/lv_hal_tick.h" #include "../lv_misc/lv_gc.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ /********************* * DEFINES *********************/ @@ -37,14 +34,14 @@ * STATIC PROTOTYPES **********************/ #if LV_IMG_CACHE_DEF_SIZE == 0 -static lv_img_cache_entry_t cache_temp; + static lv_img_cache_entry_t cache_temp; #endif /********************** * STATIC VARIABLES **********************/ #if LV_IMG_CACHE_DEF_SIZE -static uint16_t entry_cnt; + static uint16_t entry_cnt; #endif /********************** diff --git a/src/lv_draw/lv_img_decoder.c b/src/lv_draw/lv_img_decoder.c index ff57ebbd87..707aeca310 100644 --- a/src/lv_draw/lv_img_decoder.c +++ b/src/lv_draw/lv_img_decoder.c @@ -13,10 +13,6 @@ #include "../lv_misc/lv_color.h" #include "../lv_misc/lv_gc.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -421,7 +417,6 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder /*The palette begins in the beginning of the image data. Just point to it.*/ lv_color32_t * palette_p = (lv_color32_t *)((lv_img_dsc_t *)dsc->src)->data; - uint32_t i; for(i = 0; i < palette_size; i++) { user_data->palette[i] = lv_color_make(palette_p[i].ch.red, palette_p[i].ch.green, palette_p[i].ch.blue); @@ -525,7 +520,6 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds } } - /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/lv_font/lv_font.c b/src/lv_font/lv_font.c index 6e6d0ea364..9e3ec2201c 100644 --- a/src/lv_font/lv_font.c +++ b/src/lv_font/lv_font.c @@ -43,7 +43,7 @@ * Return with the bitmap of a font. * @param font_p pointer to a font * @param letter an UNICODE character code - * @return pointer to the bitmap of the letter + * @return pointer to the bitmap of the letter */ const uint8_t * lv_font_get_glyph_bitmap(const lv_font_t * font_p, uint32_t letter) { diff --git a/src/lv_font/lv_font.h b/src/lv_font/lv_font.h index 94b49ae72a..04ab308649 100644 --- a/src/lv_font/lv_font.h +++ b/src/lv_font/lv_font.h @@ -43,7 +43,6 @@ typedef struct { uint8_t bpp; /**< Bit-per-pixel: 1, 2, 4, 8*/ } lv_font_glyph_dsc_t; - /** The bitmaps might be upscaled by 3 to achieve subpixel rendering. */ enum { LV_FONT_SUBPX_NONE, @@ -56,7 +55,7 @@ typedef uint8_t lv_font_subpx_t; /** Describe the properties of a font*/ typedef struct _lv_font_struct { - /** Get a glyph's descriptor from a font*/ + /** Get a glyph's descriptor from a font*/ bool (*get_glyph_dsc)(const struct _lv_font_struct *, lv_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next); /** Get a glyph's bitmap from a font*/ @@ -75,7 +74,6 @@ typedef struct _lv_font_struct { lv_font_user_data_t user_data; /**< Custom user data for font. */ #endif - } lv_font_t; /********************** @@ -86,7 +84,7 @@ typedef struct _lv_font_struct { * Return with the bitmap of a font. * @param font_p pointer to a font * @param letter an UNICODE character code - * @return pointer to the bitmap of the letter + * @return pointer to the bitmap of the letter */ const uint8_t * lv_font_get_glyph_bitmap(const lv_font_t * font_p, uint32_t letter); diff --git a/src/lv_font/lv_font_dejavu_16_persian_hebrew.c b/src/lv_font/lv_font_dejavu_16_persian_hebrew.c index 8a32111a71..4c4181806f 100644 --- a/src/lv_font/lv_font_dejavu_16_persian_hebrew.c +++ b/src/lv_font/lv_font_dejavu_16_persian_hebrew.c @@ -5818,7 +5818,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -6508,8 +6507,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = } }; - - /*-------------------- * ALL CUSTOM DATA *--------------------*/ @@ -6527,7 +6524,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -6549,4 +6545,3 @@ lv_font_t lv_font_dejavu_16_persian_hebrew = { }; #endif /*#if LV_FONT_DEJAVU_16_PERSIAN_HEBREW*/ - diff --git a/src/lv_font/lv_font_fmt_txt.c b/src/lv_font/lv_font_fmt_txt.c index 666082620d..4094a23e58 100644 --- a/src/lv_font/lv_font_fmt_txt.c +++ b/src/lv_font/lv_font_fmt_txt.c @@ -16,10 +16,6 @@ #include "../lv_misc/lv_utils.h" #include "../lv_misc/lv_mem.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -199,7 +195,6 @@ void _lv_font_clean_up_fmt_txt(void) } } - /********************** * STATIC FUNCTIONS **********************/ @@ -557,7 +552,6 @@ static inline uint8_t rle_next(void) rle_state = RLE_STATE_SINGLE; } - } else if(rle_state == RLE_STATE_COUNTER) { ret = rle_prev_v; diff --git a/src/lv_font/lv_font_fmt_txt.h b/src/lv_font/lv_font_fmt_txt.h index 863b192690..1538c2fa69 100644 --- a/src/lv_font/lv_font_fmt_txt.h +++ b/src/lv_font/lv_font_fmt_txt.h @@ -45,7 +45,6 @@ typedef struct { #endif } lv_font_fmt_txt_glyph_dsc_t; - /** Format of font character map. */ enum { LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY, @@ -56,7 +55,6 @@ enum { typedef uint8_t lv_font_fmt_txt_cmap_type_t; - /* Map codepoints to a `glyph_dsc`s * Several formats are supported to optimize memory usage * See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md @@ -117,7 +115,7 @@ typedef struct { typedef struct { /*To get a kern value of two code points: 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t - 2 for(i = 0; i < pair_cnt * 2; i+2) + 2. for(i = 0; i < pair_cnt * 2; i+2) if(gylph_ids[i] == glyph_id_left && gylph_ids[i+1] == glyph_id_right) return values[i / 2]; @@ -132,7 +130,7 @@ typedef struct { typedef struct { /*To get a kern value of two code points: 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t - 2 Get the class of the left and right glyphs as `left_class` and `right_class` + 2. Get the class of the left and right glyphs as `left_class` and `right_class` left_class = left_class_mapping[glyph_id_left]; right_class = right_class_mapping[glyph_id_right]; 3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)] @@ -145,7 +143,6 @@ typedef struct { uint8_t right_class_cnt; } lv_font_fmt_txt_kern_classes_t; - /** Bitmap formats*/ typedef enum { LV_FONT_FMT_TXT_PLAIN = 0, @@ -153,7 +150,6 @@ typedef enum { LV_FONT_FMT_TXT_COMPRESSED_NO_PREFILTER = 1, } lv_font_fmt_txt_bitmap_format_t; - /*Describe store additional data for fonts */ typedef struct { /*The bitmaps of all glyphs*/ diff --git a/src/lv_font/lv_font_loader.c b/src/lv_font/lv_font_loader.c index 8c45611ced..ce084da344 100644 --- a/src/lv_font/lv_font_loader.c +++ b/src/lv_font/lv_font_loader.c @@ -16,7 +16,6 @@ #if LV_USE_FILESYSTEM - /********************** * TYPEDEFS **********************/ @@ -61,7 +60,6 @@ typedef struct cmap_table_bin { uint8_t padding; } cmap_table_bin_t; - /********************** * STATIC PROTOTYPES **********************/ @@ -72,7 +70,6 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f static int read_bits_signed(bit_iterator_t * it, int n_bits, lv_fs_res_t * res); static int read_bits(bit_iterator_t * it, int n_bits, lv_fs_res_t * res); - /********************** * MACROS **********************/ @@ -116,7 +113,6 @@ lv_font_t * lv_font_load(const char * font_name) return font; } - /** * Frees the memory allocated by the `lv_font_load()` function * @param font lv_font_t object created by the lv_font_load function @@ -185,7 +181,6 @@ void lv_font_free(lv_font_t * font) } } - /********************** * STATIC FUNCTIONS **********************/ @@ -691,4 +686,3 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f } #endif /*LV_USE_FILESYSTEM*/ - diff --git a/src/lv_font/lv_font_montserrat_10.c b/src/lv_font/lv_font_montserrat_10.c index 3f42da8b10..6d1dbfa545 100644 --- a/src/lv_font/lv_font_montserrat_10.c +++ b/src/lv_font/lv_font_montserrat_10.c @@ -947,7 +947,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -1141,7 +1140,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = { * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { 0, 0, 1, 2, 0, 3, 4, 5, @@ -1568,7 +1566,6 @@ static const int8_t kern_class_values[] = { 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { .class_pair_values = kern_class_values, @@ -1595,7 +1592,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -1616,7 +1612,4 @@ lv_font_t lv_font_montserrat_10 = { .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ }; - - #endif /*#if LV_FONT_MONTSERRAT_10*/ - diff --git a/src/lv_font/lv_font_montserrat_12.c b/src/lv_font/lv_font_montserrat_12.c index 209eea93e4..dd1ef8f704 100644 --- a/src/lv_font/lv_font_montserrat_12.c +++ b/src/lv_font/lv_font_montserrat_12.c @@ -1201,7 +1201,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -1396,7 +1395,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -1826,7 +1824,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -1854,7 +1851,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -1876,4 +1872,3 @@ lv_font_t lv_font_montserrat_12 = { }; #endif /*#if LV_FONT_MONTSERRAT_12*/ - diff --git a/src/lv_font/lv_font_montserrat_12_subpx.c b/src/lv_font/lv_font_montserrat_12_subpx.c index 2bd1fc68dc..2dddd60a88 100644 --- a/src/lv_font/lv_font_montserrat_12_subpx.c +++ b/src/lv_font/lv_font_montserrat_12_subpx.c @@ -1201,7 +1201,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -1396,7 +1395,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -1826,7 +1824,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -1854,7 +1851,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -1876,4 +1872,3 @@ lv_font_t lv_font_montserrat_12_subpx = { }; #endif /*#if LV_FONT_MONTSERRAT_12_SUBPX*/ - diff --git a/src/lv_font/lv_font_montserrat_14.c b/src/lv_font/lv_font_montserrat_14.c index 978742d5e3..0950733231 100644 --- a/src/lv_font/lv_font_montserrat_14.c +++ b/src/lv_font/lv_font_montserrat_14.c @@ -1470,7 +1470,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -1665,7 +1664,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -2095,7 +2093,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -2123,7 +2120,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -2145,4 +2141,3 @@ lv_font_t lv_font_montserrat_14 = { }; #endif /*#if LV_FONT_MONTSERRAT_14*/ - diff --git a/src/lv_font/lv_font_montserrat_16.c b/src/lv_font/lv_font_montserrat_16.c index eeaed4f80a..2336c9c437 100644 --- a/src/lv_font/lv_font_montserrat_16.c +++ b/src/lv_font/lv_font_montserrat_16.c @@ -1733,7 +1733,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -1928,7 +1927,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -2358,7 +2356,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -2386,7 +2383,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -2408,4 +2404,3 @@ lv_font_t lv_font_montserrat_16 = { }; #endif /*#if LV_FONT_MONTSERRAT_16*/ - diff --git a/src/lv_font/lv_font_montserrat_18.c b/src/lv_font/lv_font_montserrat_18.c index c1850de0f7..209d80ed08 100644 --- a/src/lv_font/lv_font_montserrat_18.c +++ b/src/lv_font/lv_font_montserrat_18.c @@ -2122,7 +2122,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -2317,7 +2316,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -2747,7 +2745,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -2775,7 +2772,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -2797,4 +2793,3 @@ lv_font_t lv_font_montserrat_18 = { }; #endif /*#if LV_FONT_MONTSERRAT_18*/ - diff --git a/src/lv_font/lv_font_montserrat_20.c b/src/lv_font/lv_font_montserrat_20.c index 6403288da0..5b8762e253 100644 --- a/src/lv_font/lv_font_montserrat_20.c +++ b/src/lv_font/lv_font_montserrat_20.c @@ -2468,7 +2468,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -2663,7 +2662,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -3093,7 +3091,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -3121,7 +3118,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -3143,4 +3139,3 @@ lv_font_t lv_font_montserrat_20 = { }; #endif /*#if LV_FONT_MONTSERRAT_20*/ - diff --git a/src/lv_font/lv_font_montserrat_22.c b/src/lv_font/lv_font_montserrat_22.c index e1c1e42af1..7308e6ea16 100644 --- a/src/lv_font/lv_font_montserrat_22.c +++ b/src/lv_font/lv_font_montserrat_22.c @@ -2885,7 +2885,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -3080,7 +3079,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -3510,7 +3508,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -3538,7 +3535,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -3560,4 +3556,3 @@ lv_font_t lv_font_montserrat_22 = { }; #endif /*#if LV_FONT_MONTSERRAT_22*/ - diff --git a/src/lv_font/lv_font_montserrat_24.c b/src/lv_font/lv_font_montserrat_24.c index 22f5f3a7e7..e182ee73df 100644 --- a/src/lv_font/lv_font_montserrat_24.c +++ b/src/lv_font/lv_font_montserrat_24.c @@ -3286,7 +3286,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -3481,7 +3480,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -3911,7 +3909,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -3939,7 +3936,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -3961,4 +3957,3 @@ lv_font_t lv_font_montserrat_24 = { }; #endif /*#if LV_FONT_MONTSERRAT_24*/ - diff --git a/src/lv_font/lv_font_montserrat_26.c b/src/lv_font/lv_font_montserrat_26.c index 6d4e9db0c9..9dacec475e 100644 --- a/src/lv_font/lv_font_montserrat_26.c +++ b/src/lv_font/lv_font_montserrat_26.c @@ -3806,7 +3806,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -4001,7 +4000,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -4431,7 +4429,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -4459,7 +4456,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -4481,4 +4477,3 @@ lv_font_t lv_font_montserrat_26 = { }; #endif /*#if LV_FONT_MONTSERRAT_26*/ - diff --git a/src/lv_font/lv_font_montserrat_28.c b/src/lv_font/lv_font_montserrat_28.c index 59c381519c..5e740fed6e 100644 --- a/src/lv_font/lv_font_montserrat_28.c +++ b/src/lv_font/lv_font_montserrat_28.c @@ -4340,7 +4340,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -4535,7 +4534,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -4965,7 +4963,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -4993,7 +4990,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -5015,4 +5011,3 @@ lv_font_t lv_font_montserrat_28 = { }; #endif /*#if LV_FONT_MONTSERRAT_28*/ - diff --git a/src/lv_font/lv_font_montserrat_28_compressed.c b/src/lv_font/lv_font_montserrat_28_compressed.c index ef74c0a548..96e4153655 100644 --- a/src/lv_font/lv_font_montserrat_28_compressed.c +++ b/src/lv_font/lv_font_montserrat_28_compressed.c @@ -2530,7 +2530,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0xff, 0x3a, 0xba, 0x40, 0x3f, 0xf9, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -2725,7 +2724,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -3155,7 +3153,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -3183,7 +3180,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 1 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -3205,4 +3201,3 @@ lv_font_t lv_font_montserrat_28_compressed = { }; #endif /*#if LV_FONT_MONTSERRAT_28_COMPRESSED*/ - diff --git a/src/lv_font/lv_font_montserrat_30.c b/src/lv_font/lv_font_montserrat_30.c index 93e024b013..bde5a9032f 100644 --- a/src/lv_font/lv_font_montserrat_30.c +++ b/src/lv_font/lv_font_montserrat_30.c @@ -4906,7 +4906,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -5101,7 +5100,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -5531,7 +5529,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -5559,7 +5556,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -5581,4 +5577,3 @@ lv_font_t lv_font_montserrat_30 = { }; #endif /*#if LV_FONT_MONTSERRAT_30*/ - diff --git a/src/lv_font/lv_font_montserrat_32.c b/src/lv_font/lv_font_montserrat_32.c index 9a4485bec9..a9fb7bd04e 100644 --- a/src/lv_font/lv_font_montserrat_32.c +++ b/src/lv_font/lv_font_montserrat_32.c @@ -5383,7 +5383,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -5578,7 +5577,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -6008,7 +6006,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -6036,7 +6033,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -6058,4 +6054,3 @@ lv_font_t lv_font_montserrat_32 = { }; #endif /*#if LV_FONT_MONTSERRAT_32*/ - diff --git a/src/lv_font/lv_font_montserrat_34.c b/src/lv_font/lv_font_montserrat_34.c index 71f1ee64a0..10fc05a4ad 100644 --- a/src/lv_font/lv_font_montserrat_34.c +++ b/src/lv_font/lv_font_montserrat_34.c @@ -6160,7 +6160,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -6355,7 +6354,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -6785,7 +6783,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -6813,7 +6810,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -6835,4 +6831,3 @@ lv_font_t lv_font_montserrat_34 = { }; #endif /*#if LV_FONT_MONTSERRAT_34*/ - diff --git a/src/lv_font/lv_font_montserrat_36.c b/src/lv_font/lv_font_montserrat_36.c index 3c4104f2dc..ef6c397c88 100644 --- a/src/lv_font/lv_font_montserrat_36.c +++ b/src/lv_font/lv_font_montserrat_36.c @@ -6787,7 +6787,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -6982,7 +6981,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -7412,7 +7410,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -7440,7 +7437,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -7462,4 +7458,3 @@ lv_font_t lv_font_montserrat_36 = { }; #endif /*#if LV_FONT_MONTSERRAT_36*/ - diff --git a/src/lv_font/lv_font_montserrat_38.c b/src/lv_font/lv_font_montserrat_38.c index 5f3cb1a8f2..f86dfd9dad 100644 --- a/src/lv_font/lv_font_montserrat_38.c +++ b/src/lv_font/lv_font_montserrat_38.c @@ -7510,7 +7510,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -7705,7 +7704,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -8135,7 +8133,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -8163,7 +8160,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -8185,4 +8181,3 @@ lv_font_t lv_font_montserrat_38 = { }; #endif /*#if LV_FONT_MONTSERRAT_38*/ - diff --git a/src/lv_font/lv_font_montserrat_40.c b/src/lv_font/lv_font_montserrat_40.c index a26745b21f..815e8572cf 100644 --- a/src/lv_font/lv_font_montserrat_40.c +++ b/src/lv_font/lv_font_montserrat_40.c @@ -8342,7 +8342,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -8537,7 +8536,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -8967,7 +8965,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -8995,7 +8992,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -9017,4 +9013,3 @@ lv_font_t lv_font_montserrat_40 = { }; #endif /*#if LV_FONT_MONTSERRAT_40*/ - diff --git a/src/lv_font/lv_font_montserrat_42.c b/src/lv_font/lv_font_montserrat_42.c index f386e40b17..d83dff5cbd 100644 --- a/src/lv_font/lv_font_montserrat_42.c +++ b/src/lv_font/lv_font_montserrat_42.c @@ -9160,7 +9160,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -9355,7 +9354,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -9785,7 +9783,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -9813,7 +9810,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -9835,4 +9831,3 @@ lv_font_t lv_font_montserrat_42 = { }; #endif /*#if LV_FONT_MONTSERRAT_42*/ - diff --git a/src/lv_font/lv_font_montserrat_44.c b/src/lv_font/lv_font_montserrat_44.c index c873397799..feb6b21cef 100644 --- a/src/lv_font/lv_font_montserrat_44.c +++ b/src/lv_font/lv_font_montserrat_44.c @@ -9960,7 +9960,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -10155,7 +10154,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -10585,7 +10583,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -10613,7 +10610,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -10635,4 +10631,3 @@ lv_font_t lv_font_montserrat_44 = { }; #endif /*#if LV_FONT_MONTSERRAT_44*/ - diff --git a/src/lv_font/lv_font_montserrat_46.c b/src/lv_font/lv_font_montserrat_46.c index 01c1d68774..d6d9f06f29 100644 --- a/src/lv_font/lv_font_montserrat_46.c +++ b/src/lv_font/lv_font_montserrat_46.c @@ -10889,7 +10889,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -11084,7 +11083,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -11514,7 +11512,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -11542,7 +11539,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -11564,4 +11560,3 @@ lv_font_t lv_font_montserrat_46 = { }; #endif /*#if LV_FONT_MONTSERRAT_46*/ - diff --git a/src/lv_font/lv_font_montserrat_48.c b/src/lv_font/lv_font_montserrat_48.c index 1d24b16928..9a801ae597 100644 --- a/src/lv_font/lv_font_montserrat_48.c +++ b/src/lv_font/lv_font_montserrat_48.c @@ -11571,7 +11571,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -11766,7 +11765,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -12196,7 +12194,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -12224,7 +12221,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -12246,4 +12242,3 @@ lv_font_t lv_font_montserrat_48 = { }; #endif /*#if LV_FONT_MONTSERRAT_48*/ - diff --git a/src/lv_font/lv_font_montserrat_8.c b/src/lv_font/lv_font_montserrat_8.c index ae766a7d2d..34f6d4cc98 100644 --- a/src/lv_font/lv_font_montserrat_8.c +++ b/src/lv_font/lv_font_montserrat_8.c @@ -739,7 +739,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -933,7 +932,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = { * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { 0, 0, 1, 2, 0, 3, 4, 5, @@ -1360,7 +1358,6 @@ static const int8_t kern_class_values[] = { 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { .class_pair_values = kern_class_values, @@ -1387,7 +1384,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -1408,7 +1404,4 @@ lv_font_t lv_font_montserrat_8 = { .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ }; - - #endif /*#if LV_FONT_MONTSERRAT_8*/ - diff --git a/src/lv_font/lv_font_simsun_16_cjk.c b/src/lv_font/lv_font_simsun_16_cjk.c index 8d57f1e53a..7e8a38a0b0 100644 --- a/src/lv_font/lv_font_simsun_16_cjk.c +++ b/src/lv_font/lv_font_simsun_16_cjk.c @@ -12639,7 +12639,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -13559,8 +13558,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = } }; - - /*-------------------- * ALL CUSTOM DATA *--------------------*/ @@ -13578,7 +13575,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -13600,4 +13596,3 @@ lv_font_t lv_font_simsun_16_cjk = { }; #endif /*#if LV_FONT_SIMSUN_16_CJK*/ - diff --git a/src/lv_font/lv_font_unscii_16.c b/src/lv_font/lv_font_unscii_16.c index 16bfc255d7..1ce0bf7192 100644 --- a/src/lv_font/lv_font_unscii_16.c +++ b/src/lv_font/lv_font_unscii_16.c @@ -471,7 +471,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0xc0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -580,8 +579,6 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { * CHARACTER MAPPING *--------------------*/ - - /*Collect the unicode lists and glyph_id offsets*/ static const lv_font_fmt_txt_cmap_t cmaps[] = { { @@ -590,8 +587,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = { } }; - - /*-------------------- * ALL CUSTOM DATA *--------------------*/ @@ -609,7 +604,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -630,6 +624,4 @@ lv_font_t lv_font_unscii_16 = { .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ }; - - #endif /*#if LV_FONT_UNSCII_16*/ diff --git a/src/lv_font/lv_font_unscii_8.c b/src/lv_font/lv_font_unscii_8.c index 4438d82e59..714f5486a3 100644 --- a/src/lv_font/lv_font_unscii_8.c +++ b/src/lv_font/lv_font_unscii_8.c @@ -307,7 +307,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0xc1, 0x42, 0xbd, 0x2c, 0x40, 0x81, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -416,8 +415,6 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { * CHARACTER MAPPING *--------------------*/ - - /*Collect the unicode lists and glyph_id offsets*/ static const lv_font_fmt_txt_cmap_t cmaps[] = { { @@ -426,8 +423,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = { } }; - - /*-------------------- * ALL CUSTOM DATA *--------------------*/ @@ -445,7 +440,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -466,6 +460,4 @@ lv_font_t lv_font_unscii_8 = { .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ }; - - #endif /*#if LV_FONT_UNSCII_8*/ diff --git a/src/lv_font/lv_symbol_def.h b/src/lv_font/lv_symbol_def.h index 4ca5d54fae..bc32ec26f7 100644 --- a/src/lv_font/lv_symbol_def.h +++ b/src/lv_font/lv_symbol_def.h @@ -156,10 +156,4 @@ enum { } /* extern "C" */ #endif - #endif /*LV_SYMBOL_DEF_H*/ - - - - - diff --git a/src/lv_gpu/lv_gpu_nxp_pxp.c b/src/lv_gpu/lv_gpu_nxp_pxp.c index 8024a14c90..b49c359945 100644 --- a/src/lv_gpu/lv_gpu_nxp_pxp.c +++ b/src/lv_gpu/lv_gpu_nxp_pxp.c @@ -27,7 +27,6 @@ * */ - /********************* * INCLUDES *********************/ @@ -60,7 +59,6 @@ #error Only 16bit color depth is supported. Set LV_COLOR_DEPTH to 16. #endif - /********************** * TYPEDEFS **********************/ @@ -136,7 +134,6 @@ void lv_gpu_nxp_pxp_deinit(void) PXP_Deinit(LV_GPU_NXP_PXP_ID); } - /** * Fill area, with optional opacity. * @@ -283,7 +280,6 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo } PXP_EnableAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKeyEnabled); - /* Output buffer. */ outputBufferConfig.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT; outputBufferConfig.interlacedMode = kPXP_OutputProgressive; diff --git a/src/lv_gpu/lv_gpu_nxp_pxp.h b/src/lv_gpu/lv_gpu_nxp_pxp.h index e3f10a445a..c91d80fd36 100644 --- a/src/lv_gpu/lv_gpu_nxp_pxp.h +++ b/src/lv_gpu/lv_gpu_nxp_pxp.h @@ -126,14 +126,12 @@ void lv_gpu_nxp_pxp_deinit(void); void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa); - - /** * @brief BLock Image Transfer - copy rectangular image from src buffer to dst buffer with effects. * * By default, image is copied directly, with optional opacity configured by \p opa. * Color keying can be enabled by calling lv_gpu_nxp_pxp_enable_color_key() before calling this function. - * Recoloring can be enabled by calling lv_gpu_nxp_pxp_enable_recolor() before calling this function. + * Recoloring can be enabled by calling lv_gpu_nxp_pxp_enable_recolor() before calling this function. * Note that color keying and recoloring at the same time is not supported and black rectangle is rendered. * * @param[in/out] dest destination buffer @@ -147,7 +145,6 @@ void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src, lv_coord_t src_width, lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa); - /** * @brief Enable color keying for subsequent calls to lv_gpu_nxp_pxp_blit() * @@ -161,7 +158,6 @@ void lv_gpu_nxp_pxp_enable_color_key(void); */ void lv_gpu_nxp_pxp_disable_color_key(void); - /** * @brief Enable recolor feature for subsequent calls to lv_gpu_nxp_pxp_blit() * diff --git a/src/lv_gpu/lv_gpu_nxp_pxp_osa.c b/src/lv_gpu/lv_gpu_nxp_pxp_osa.c index 19b4a12f1c..81163c10a1 100644 --- a/src/lv_gpu/lv_gpu_nxp_pxp_osa.c +++ b/src/lv_gpu/lv_gpu_nxp_pxp_osa.c @@ -43,7 +43,6 @@ #include "semphr.h" #endif - /********************* * DEFINES *********************/ diff --git a/src/lv_gpu/lv_gpu_nxp_vglite.c b/src/lv_gpu/lv_gpu_nxp_vglite.c index 8db4bce7a0..3ac384c856 100644 --- a/src/lv_gpu/lv_gpu_nxp_vglite.c +++ b/src/lv_gpu/lv_gpu_nxp_vglite.c @@ -41,7 +41,6 @@ #include "fsl_cache.h" #include "vg_lite.h" - /********************* * DEFINES *********************/ @@ -117,7 +116,6 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv } else { /* fill with transparency */ - vg_lite_path_t path; lv_color32_t colMix; int16_t path_data[] = { /* VG rectangular path */ @@ -129,7 +127,6 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv VLC_OP_END }; - err |= vg_lite_init_path(&path, VG_LITE_S16, VG_LITE_LOW, sizeof(path_data), path_data, fill_area->x1, fill_area->y1, fill_area->x2 + 1, fill_area->y2 + 1); if(err != VG_LITE_SUCCESS) { @@ -176,7 +173,6 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv } } - /*** * BLock Image Transfer. * @param[in] blit Description of the transfer diff --git a/src/lv_gpu/lv_gpu_stm32_dma2d.c b/src/lv_gpu/lv_gpu_stm32_dma2d.c index d94e87abfa..21fb3001e9 100644 --- a/src/lv_gpu/lv_gpu_stm32_dma2d.c +++ b/src/lv_gpu/lv_gpu_stm32_dma2d.c @@ -65,7 +65,7 @@ void lv_gpu_stm32_dma2d_init(void) /* Enable DMA2D clock */ #if defined(STM32F4) || defined(STM32F7) RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN; -#elif defined(STM32H7) +#elif defined(STM32H7) RCC->AHB3ENR |= RCC_AHB3ENR_DMA2DEN; #else # warning "LVGL can't enable the clock of DMA2D" diff --git a/src/lv_gpu/lv_gpu_stm32_dma2d.h b/src/lv_gpu/lv_gpu_stm32_dma2d.h index f3d4680498..59b14c00fe 100644 --- a/src/lv_gpu/lv_gpu_stm32_dma2d.h +++ b/src/lv_gpu/lv_gpu_stm32_dma2d.h @@ -52,7 +52,6 @@ void lv_gpu_stm32_dma2d_init(void); void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w, lv_coord_t fill_h); - /** * Fill an area in the buffer with a color but take into account a mask which describes the opacity of each pixel * @param buf a buffer which should be filled using a mask @@ -93,7 +92,6 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h); - /** * Can be used as `gpu_wait_cb` in display driver to * let the MCU run while the GPU is working diff --git a/src/lv_hal/lv_hal_disp.c b/src/lv_hal/lv_hal_disp.c index 91537d56ab..275d0311e6 100644 --- a/src/lv_hal/lv_hal_disp.c +++ b/src/lv_hal/lv_hal_disp.c @@ -19,10 +19,6 @@ #include "../lv_core/lv_refr.h" #include "../lv_themes/lv_theme.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -335,7 +331,6 @@ LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_drv_t * disp_drv) disp_drv->buffer->flushing_last = 0; } - /** * Tell if it's the last area of the refreshing process. * Can be called from `flush_cb` to execute some special display refreshing if needed when all areas area flushed. diff --git a/src/lv_hal/lv_hal_disp.h b/src/lv_hal/lv_hal_disp.h index 5098e376ac..cb2d1328ab 100644 --- a/src/lv_hal/lv_hal_disp.h +++ b/src/lv_hal/lv_hal_disp.h @@ -78,7 +78,7 @@ typedef struct _disp_drv_t { uint32_t rotated : 1; /**< 1: turn the display by 90 degree. @warning Does not update coordinates for you!*/ #if LV_COLOR_SCREEN_TRANSP - /**Handle if the the screen doesn't have a solid (opa == LV_OPA_COVER) background. + /**Handle if the screen doesn't have a solid (opa == LV_OPA_COVER) background. * Use only if required because it's slower.*/ uint32_t screen_transp : 1; #endif @@ -177,7 +177,6 @@ uint8_t del_prev : uint32_t last_activity_time; /**< Last time there was activity on this display */ } lv_disp_t; - typedef enum { LV_DISP_SIZE_SMALL, LV_DISP_SIZE_MEDIUM, diff --git a/src/lv_hal/lv_hal_indev.c b/src/lv_hal/lv_hal_indev.c index 44683ea47d..ba1770c565 100644 --- a/src/lv_hal/lv_hal_indev.c +++ b/src/lv_hal/lv_hal_indev.c @@ -15,10 +15,6 @@ #include "../lv_misc/lv_gc.h" #include "lv_hal_disp.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -139,7 +135,7 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data) data->point.x = indev->proc.types.pointer.act_point.x; data->point.y = indev->proc.types.pointer.act_point.y; } - /*Similarly set at least the last key in case of the the user doesn't set it on release*/ + /*Similarly set at least the last key in case of the user doesn't set it on release*/ else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) { data->key = indev->proc.types.keypad.last_key; } diff --git a/src/lv_hal/lv_hal_indev.h b/src/lv_hal/lv_hal_indev.h index dc080d174e..8b1ca27e06 100644 --- a/src/lv_hal/lv_hal_indev.h +++ b/src/lv_hal/lv_hal_indev.h @@ -76,7 +76,6 @@ typedef struct { lv_indev_state_t state; /**< LV_INDEV_STATE_REL or LV_INDEV_STATE_PR*/ } lv_indev_data_t; - /** Initialized by the user and registered by 'lv_indev_add()'*/ typedef struct _lv_indev_drv_t { diff --git a/src/lv_hal/lv_hal_tick.c b/src/lv_hal/lv_hal_tick.c index 3a1a5128af..2ceb7adf6f 100644 --- a/src/lv_hal/lv_hal_tick.c +++ b/src/lv_hal/lv_hal_tick.c @@ -1,5 +1,5 @@ /** - * @file systick.c + * @file lv_hal_tick.c * Provide access to the system tick with 1 millisecond resolution */ @@ -76,7 +76,7 @@ uint32_t lv_tick_get(void) /** * Get the elapsed milliseconds since a previous time stamp - * @param prev_tick a previous time stamp (return value of systick_get() ) + * @param prev_tick a previous time stamp (return value of lv_tick_get() ) * @return the elapsed milliseconds since 'prev_tick' */ uint32_t lv_tick_elaps(uint32_t prev_tick) diff --git a/src/lv_hal/lv_hal_tick.h b/src/lv_hal/lv_hal_tick.h index f99d5188ce..a6068660c5 100644 --- a/src/lv_hal/lv_hal_tick.h +++ b/src/lv_hal/lv_hal_tick.h @@ -51,7 +51,7 @@ uint32_t lv_tick_get(void); /** * Get the elapsed milliseconds since a previous time stamp - * @param prev_tick a previous time stamp (return value of systick_get() ) + * @param prev_tick a previous time stamp (return value of lv_tick_get() ) * @return the elapsed milliseconds since 'prev_tick' */ uint32_t lv_tick_elaps(uint32_t prev_tick); diff --git a/src/lv_misc/lv_anim.c b/src/lv_misc/lv_anim.c index 6b52b4c661..6bd895f35a 100644 --- a/src/lv_misc/lv_anim.c +++ b/src/lv_misc/lv_anim.c @@ -17,10 +17,6 @@ #include "lv_math.h" #include "lv_gc.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -371,7 +367,6 @@ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_ani return (lv_anim_value_t)new_value; } - /** * Calculate the current value of an animation with 3 bounces * @param a pointer to an animation @@ -481,7 +476,7 @@ static void anim_task(lv_timer_t * param) anim_list_changed = false; if(!a->has_run) { - a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/ + a->has_run = 1; /*The list readying might be reset so need to know which anim has run already*/ /*The animation will run now for the first time. Call `start_cb`*/ int32_t new_act_time = a->act_time + elaps; diff --git a/src/lv_misc/lv_anim.h b/src/lv_misc/lv_anim.h index 357da37e48..1316c47088 100644 --- a/src/lv_misc/lv_anim.h +++ b/src/lv_misc/lv_anim.h @@ -42,7 +42,6 @@ typedef lv_coord_t lv_anim_value_t; #define LV_ANIM_REPEAT_INFINITE 0xFFFF - struct _lv_anim_t; struct _lv_anim_path_t; /** Get the current value during an animation*/ @@ -53,8 +52,6 @@ typedef struct _lv_anim_path_t { void * user_data; } lv_anim_path_t; - - /** Generic prototype of "animator" functions. * First parameter is the variable to animate. * Second parameter is the value to set. @@ -100,7 +97,6 @@ typedef struct _lv_anim_t { uint32_t has_run : 1; /**< Indicates the animation has run in this round*/ } lv_anim_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -198,7 +194,6 @@ static inline void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec */ void lv_anim_set_path(lv_anim_t * a, const lv_anim_path_t * path); - /** * Set a function call when the animation really starts (considering `delay`) * @param a pointer to an initialized `lv_anim_t` variable @@ -310,7 +305,6 @@ static inline int32_t lv_anim_get_delay(lv_anim_t * a) */ bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb); - /** * Get the animation of a variable and its `exec_cb`. * @param var pointer to variable diff --git a/src/lv_misc/lv_area.c b/src/lv_misc/lv_area.c index d6de645003..fd07cd6d34 100644 --- a/src/lv_misc/lv_area.c +++ b/src/lv_misc/lv_area.c @@ -239,7 +239,8 @@ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coo is_in = true; } - if(radius == 0) return is_in; + if(!is_in) return false; + if(radius == 0) return true; /*Check if the corner points are inside the radius or not*/ lv_point_t p; @@ -398,8 +399,8 @@ static bool lv_point_within_circle(const lv_area_t * area, const lv_point_t * p) lv_coord_t px = p->x - cx; lv_coord_t py = p->y - cy; - int32_t r_sqrd = r * r; - int32_t dist = (px * px) + (py * py); + uint32_t r_sqrd = r * r; + uint32_t dist = (px * px) + (py * py); if(dist <= r_sqrd) return true; diff --git a/src/lv_misc/lv_area.h b/src/lv_misc/lv_area.h index a4c1bc322b..bc6b27e127 100644 --- a/src/lv_misc/lv_area.h +++ b/src/lv_misc/lv_area.h @@ -49,8 +49,6 @@ typedef struct { lv_coord_t y2; } lv_area_t; - - /** Alignments */ enum { LV_ALIGN_CENTER = 0, @@ -90,7 +88,6 @@ enum { typedef uint8_t lv_dir_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -210,7 +207,6 @@ bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p); */ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius); - /** * Align an area to an other * @param base an are where the other will be aligned diff --git a/src/lv_misc/lv_async.c b/src/lv_misc/lv_async.c index 733b27fcee..5147fa1256 100644 --- a/src/lv_misc/lv_async.c +++ b/src/lv_misc/lv_async.c @@ -17,6 +17,11 @@ * TYPEDEFS **********************/ +typedef struct _lv_async_info_t { + lv_async_cb_t cb; + void * user_data; +} lv_async_info_t; + /********************** * STATIC PROTOTYPES **********************/ diff --git a/src/lv_misc/lv_async.h b/src/lv_misc/lv_async.h index 7d8c2625fe..f1b688868f 100644 --- a/src/lv_misc/lv_async.h +++ b/src/lv_misc/lv_async.h @@ -30,13 +30,6 @@ extern "C" { */ typedef void (*lv_async_cb_t)(void *); -typedef struct _lv_async_info_t { - lv_async_cb_t cb; - void * user_data; -} lv_async_info_t; - -struct _lv_obj_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/lv_misc/lv_bidi.c b/src/lv_misc/lv_bidi.c index 27c2f2f129..a62c62a64c 100644 --- a/src/lv_misc/lv_bidi.c +++ b/src/lv_misc/lv_bidi.c @@ -131,7 +131,7 @@ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt) * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param visual_pos the visual character position which logical position should be get - * @param is_rtl tell the the char at `visual_pos` is RTL or LTR context + * @param is_rtl tell the char at `visual_pos` is RTL or LTR context * @return the logical character position */ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, @@ -168,7 +168,7 @@ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_ * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param logical_pos the logical character position which visual position should be get - * @param is_rtl tell the the char at `logical_pos` is RTL or LTR context + * @param is_rtl tell the char at `logical_pos` is RTL or LTR context * @return the visual character position */ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, @@ -625,7 +625,6 @@ static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32 } } - /*There where a previous strong char which can be used*/ if(bracket_dir != LV_BIDI_DIR_NEUTRAL) break; @@ -636,7 +635,6 @@ static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32 } } - /*The letter was an opening bracket*/ if(bracket_left[i] != '\0') { @@ -660,5 +658,4 @@ static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32 return LV_BIDI_DIR_NEUTRAL; } - #endif /*LV_USE_BIDI*/ diff --git a/src/lv_misc/lv_bidi.h b/src/lv_misc/lv_bidi.h index fd98009e5c..8b2f765dbb 100644 --- a/src/lv_misc/lv_bidi.h +++ b/src/lv_misc/lv_bidi.h @@ -21,7 +21,7 @@ extern "C" { /********************* * DEFINES *********************/ -/* Special non printable strong characters. +/* Special non printable strong characters. * They can be inserted to texts to affect the run's direction*/ #define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/ #define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/ @@ -72,7 +72,7 @@ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt); * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param visual_pos the visual character position which logical position should be get - * @param is_rtl tell the the char at `visual_pos` is RTL or LTR context + * @param is_rtl tell the char at `visual_pos` is RTL or LTR context * @return the logical character position */ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, @@ -87,7 +87,7 @@ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_ * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param logical_pos the logical character position which visual position should be get - * @param is_rtl tell the the char at `logical_pos` is RTL or LTR context + * @param is_rtl tell the char at `logical_pos` is RTL or LTR context * @return the visual character position */ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, diff --git a/src/lv_misc/lv_color.c b/src/lv_misc/lv_color.c index ee8b5c6f21..0354df63e5 100644 --- a/src/lv_misc/lv_color.c +++ b/src/lv_misc/lv_color.c @@ -7,7 +7,6 @@ * INCLUDES *********************/ #include "lv_color.h" -#include "lv_math.h" /********************* * DEFINES @@ -33,10 +32,6 @@ * GLOBAL FUNCTIONS **********************/ -/********************** - * STATIC FUNCTIONS - **********************/ - LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uint32_t px_num) { #if LV_COLOR_DEPTH == 16 @@ -127,13 +122,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uin #endif } - lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl) { return lv_color_mix(LV_COLOR_WHITE, c, lvl); } - lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl) { return lv_color_mix(LV_COLOR_BLACK, c, lvl); @@ -234,7 +227,7 @@ lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8) hsv.v = (100 * rgbMax) >> 10; int32_t delta = rgbMax - rgbMin; - if(LV_ABS(delta) < 3) { + if(delta < 3) { hsv.h = 0; hsv.s = 0; return hsv; diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h index 3a4f8cf049..97f08cb8c6 100644 --- a/src/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -86,7 +86,6 @@ enum { #error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!" #endif - /* Adjust color mix functions rounding. * GPUs might calculate color mix (blending) differently. * Should be in range of 0..254 @@ -110,16 +109,16 @@ enum { # define LV_COLOR_SET_R1(c, v) (c).ch.red = (uint8_t)((v) & 0x1) # define LV_COLOR_SET_G1(c, v) (c).ch.green = (uint8_t)((v) & 0x1) # define LV_COLOR_SET_B1(c, v) (c).ch.blue = (uint8_t)((v) & 0x1) -# define LV_COLOR_SET_A1(c, v) +# define LV_COLOR_SET_A1(c, v) do {} while(0) # define LV_COLOR_GET_R1(c) (c).ch.red # define LV_COLOR_GET_G1(c) (c).ch.green # define LV_COLOR_GET_B1(c) (c).ch.blue -# define LV_COLOR_GET_A1(c) 1 +# define LV_COLOR_GET_A1(c) 0xFF -# define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)(v) & 0x7U -# define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)(v) & 0x7U -# define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)(v) & 0x3U +# define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)((v) & 0x7U) +# define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)((v) & 0x7U) +# define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)((v) & 0x3U) # define LV_COLOR_SET_A8(c, v) do {} while(0) # define LV_COLOR_GET_R8(c) (c).ch.red @@ -127,29 +126,34 @@ enum { # define LV_COLOR_GET_B8(c) (c).ch.blue # define LV_COLOR_GET_A8(c) 0xFF -# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(v) & 0x1FU -# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)(v) & 0x3FU -# define LV_COLOR_SET_G16_SWAP(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);} -# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)(v) & 0x1FU +# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)((v) & 0x1FU) +#if LV_COLOR_16_SWAP == 0 +# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)((v) & 0x3FU) +#else +# define LV_COLOR_SET_G16(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);} +#endif +# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)((v) & 0x1FU) # define LV_COLOR_SET_A16(c, v) do {} while(0) # define LV_COLOR_GET_R16(c) (c).ch.red +#if LV_COLOR_16_SWAP == 0 # define LV_COLOR_GET_G16(c) (c).ch.green -# define LV_COLOR_GET_G16_SWAP(c) (((c).ch.green_h << 3) + (c).ch.green_l) +#else +# define LV_COLOR_GET_G16(c) (((c).ch.green_h << 3) + (c).ch.green_l) +#endif # define LV_COLOR_GET_B16(c) (c).ch.blue # define LV_COLOR_GET_A16(c) 0xFF -# define LV_COLOR_SET_R32(c, v) (c).ch.red = (uint32_t)((v) & 0xFF) -# define LV_COLOR_SET_G32(c, v) (c).ch.green = (uint32_t)((v) & 0xFF) -# define LV_COLOR_SET_B32(c, v) (c).ch.blue = (uint32_t)((v) & 0xFF) -# define LV_COLOR_SET_A32(c, v) (c).ch.alpha = (uint32_t)((v) & 0xFF) +# define LV_COLOR_SET_R32(c, v) (c).ch.red = (uint8_t)((v) & 0xFF) +# define LV_COLOR_SET_G32(c, v) (c).ch.green = (uint8_t)((v) & 0xFF) +# define LV_COLOR_SET_B32(c, v) (c).ch.blue = (uint8_t)((v) & 0xFF) +# define LV_COLOR_SET_A32(c, v) (c).ch.alpha = (uint8_t)((v) & 0xFF) # define LV_COLOR_GET_R32(c) (c).ch.red # define LV_COLOR_GET_G32(c) (c).ch.green # define LV_COLOR_GET_B32(c) (c).ch.blue # define LV_COLOR_GET_A32(c) (c).ch.alpha - /*--------------------------------------- * Macros for the current color depth * to set/get values of the color channels @@ -178,20 +182,12 @@ enum { #elif LV_COLOR_DEPTH == 16 # define LV_COLOR_SET_R(c, v) LV_COLOR_SET_R16(c,v) -# if LV_COLOR_16_SWAP == 0 # define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G16(c,v) -# else -# define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G16_SWAP(c,v) -# endif # define LV_COLOR_SET_B(c, v) LV_COLOR_SET_B16(c,v) # define LV_COLOR_SET_A(c, v) LV_COLOR_SET_A16(c,v) # define LV_COLOR_GET_R(c) LV_COLOR_GET_R16(c) -# if LV_COLOR_16_SWAP == 0 # define LV_COLOR_GET_G(c) LV_COLOR_GET_G16(c) -# else -# define LV_COLOR_GET_G(c) LV_COLOR_GET_G16_SWAP(c) -# endif # define LV_COLOR_GET_B(c) LV_COLOR_GET_B16(c) # define LV_COLOR_GET_A(c) LV_COLOR_GET_A16(c) @@ -282,7 +278,6 @@ typedef lv_color32_t lv_color_t; #error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!" #endif - typedef struct { uint16_t h; uint8_t s; @@ -304,12 +299,12 @@ typedef lv_color_t (*lv_color_filter_cb_t)(lv_color_t, lv_opa_t); /*In color conversations: * - When converting to bigger color type the LSB weight of 1 LSB is calculated * E.g. 16 bit Red has 5 bits - * 8 bit Red has 2 bits + * 8 bit Red has 3 bits * ---------------------- - * 8 bit red LSB = (2^5 - 1) / (2^2 - 1) = 31 / 3 = 10 + * 8 bit red LSB = (2^5 - 1) / (2^3 - 1) = 31 / 7 = 4 * * - When calculating to smaller color type simply shift out the LSBs - * E.g. 8 bit Red has 2 bits + * E.g. 8 bit Red has 3 bits * 16 bit Red has 5 bits * ---------------------- * Shift right with 5 - 3 = 2 @@ -376,11 +371,7 @@ static inline uint16_t lv_color_to16(lv_color_t color) #elif LV_COLOR_DEPTH == 8 lv_color16_t ret; LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) * 4); /*(2^5 - 1)/(2^3 - 1) = 31/7 = 4*/ -#if LV_COLOR_16_SWAP == 0 LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) * 9); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/ -#else - LV_COLOR_SET_G16_SWAP(ret, (LV_COLOR_GET_G(color) * 9)); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/ -#endif LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) * 10); /*(2^5 - 1)/(2^2 - 1) = 31/3 = 10*/ return ret.full; #elif LV_COLOR_DEPTH == 16 @@ -388,12 +379,7 @@ static inline uint16_t lv_color_to16(lv_color_t color) #elif LV_COLOR_DEPTH == 32 lv_color16_t ret; LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) >> 3); /* 8 - 5 = 3*/ - -#if LV_COLOR_16_SWAP == 0 LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) >> 2); /* 8 - 6 = 2*/ -#else - LV_COLOR_SET_G16_SWAP(ret, ret.ch.green_h = (LV_COLOR_GET_G(color) >> 2); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/ -#endif LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) >> 3); /* 8 - 5 = 3*/ return ret.full; #endif @@ -454,7 +440,6 @@ static inline uint32_t lv_color_to32(lv_color_t color) #endif } - //! @cond Doxygen_Suppress /** @@ -500,12 +485,11 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_premult(lv_color_t c, uint8_t } - /** * Mix two colors with a given ratio. It runs faster then `lv_color_mix` but requires some pre computation. - * @param c1 The first color. Should be preprocessed with `lv_color_premult(c1)` + * @param premult_c1 The first color. Should be preprocessed with `lv_color_premult(c1)` * @param c2 The second color. As it is no pre computation required on it - * @param mix The ratio of the colors. 0: full `c2`, 255: full `c1`, 127: half `c1` and half `c2`. + * @param mix The ratio of the colors. 0: full `c1`, 255: full `c2`, 127: half `c1` and half `c2`. * Should be modified like mix = `255 - mix` * @return the mixed color * @note 255 won't give clearly `c1`. @@ -515,9 +499,9 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix_premult(uint16_t * p lv_color_t ret; #if LV_COLOR_DEPTH != 1 /*LV_COLOR_DEPTH == 8, 16 or 32*/ - LV_COLOR_SET_R(ret, LV_UDIV255((uint16_t) premult_c1[0] + LV_COLOR_GET_R(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); - LV_COLOR_SET_G(ret, LV_UDIV255((uint16_t) premult_c1[1] + LV_COLOR_GET_G(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); - LV_COLOR_SET_B(ret, LV_UDIV255((uint16_t) premult_c1[2] + LV_COLOR_GET_B(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); + LV_COLOR_SET_R(ret, LV_UDIV255(premult_c1[0] + LV_COLOR_GET_R(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); + LV_COLOR_SET_G(ret, LV_UDIV255(premult_c1[1] + LV_COLOR_GET_G(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); + LV_COLOR_SET_B(ret, LV_UDIV255(premult_c1[2] + LV_COLOR_GET_B(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_A(ret, 0xFF); #else /*LV_COLOR_DEPTH == 1*/ @@ -526,15 +510,14 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix_premult(uint16_t * p LV_COLOR_SET_R(c1, premult_c1[0]); LV_COLOR_SET_G(c1, premult_c1[1]); LV_COLOR_SET_B(c1, premult_c1[2]); - ret.full = mix > LV_OPA_50 ? c1.full : c2.full; + ret.full = mix > LV_OPA_50 ? c2.full : c1.full; #endif return ret; } - /** - * Mix two colors. Both color can have alpha value. It requires ARGB888 colors. + * Mix two colors. Both color can have alpha value. * @param bg_color background color * @param bg_opa alpha of the background color * @param fg_color foreground color @@ -644,9 +627,9 @@ static inline uint8_t lv_color_brightness(lv_color_t color) #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((b8 >> 6) & 0x3U), (uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 5) & 0x7U)}}) #elif LV_COLOR_DEPTH == 16 #if LV_COLOR_16_SWAP == 0 -#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x3FU), (uint16_t)((r8 >> 3) & 0x1FU)}}) +#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((b8 >> 3) & 0x1FU), (uint8_t)((g8 >> 2) & 0x3FU), (uint8_t)((r8 >> 3) & 0x1FU)}}) #else -#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint16_t)((g8 >> 5) & 0x7U), (uint16_t)((r8 >> 3) & 0x1FU), (uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x7U)}}) +#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 3) & 0x1FU), (uint8_t)((b8 >> 3) & 0x1FU), (uint8_t)((g8 >> 2) & 0x7U)}}) #endif #elif LV_COLOR_DEPTH == 32 #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/ @@ -668,7 +651,6 @@ static inline lv_color_t lv_color_hex3(uint32_t c) (uint8_t)((c & 0xF) | ((c & 0xF) << 4))); } - //! @cond Doxygen_Suppress //! LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uint32_t px_num); @@ -705,7 +687,6 @@ lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8); */ lv_color_hsv_t lv_color_to_hsv(lv_color_t color); - /********************** * MACROS **********************/ @@ -714,4 +695,4 @@ lv_color_hsv_t lv_color_to_hsv(lv_color_t color); } /* extern "C" */ #endif -#endif /*USE_COLOR*/ +#endif /*LV_COLOR_H*/ diff --git a/src/lv_misc/lv_debug.c b/src/lv_misc/lv_debug.c index 2571f47fff..5fcdc7243b 100644 --- a/src/lv_misc/lv_debug.c +++ b/src/lv_misc/lv_debug.c @@ -135,6 +135,4 @@ void lv_debug_log_error(const char * msg, uint64_t value) * STATIC FUNCTIONS **********************/ - #endif /*LV_USE_DEBUG*/ - diff --git a/src/lv_misc/lv_debug.h b/src/lv_misc/lv_debug.h index 9160ceee88..82c92fe091 100644 --- a/src/lv_misc/lv_debug.h +++ b/src/lv_misc/lv_debug.h @@ -60,7 +60,6 @@ void lv_debug_log_error(const char * msg, uint64_t value); #define LV_DEBUG_IS_NULL(p) (lv_debug_check_null(p)) #endif - #ifndef LV_DEBUG_CHECK_MEM_INTEGRITY #define LV_DEBUG_CHECK_MEM_INTEGRITY() (lv_debug_check_mem_integrity()) #endif @@ -112,7 +111,6 @@ void lv_debug_log_error(const char * msg, uint64_t value); # endif #endif - #else /* LV_USE_DEBUG == 0 */ #define LV_DEBUG_ASSERT(expr, msg, value) do{}while(0) diff --git a/src/lv_misc/lv_fs.c b/src/lv_misc/lv_fs.c index 2615f28c5c..87c2b1730a 100644 --- a/src/lv_misc/lv_fs.c +++ b/src/lv_misc/lv_fs.c @@ -14,10 +14,6 @@ #include #include "lv_gc.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -93,7 +89,6 @@ void * lv_fs_open(const char * path, lv_fs_mode_t mode) char letter = path[0]; lv_fs_drv_t * drv = lv_fs_get_drv(letter); - if(drv == NULL) { LV_LOG_WARN("Can't open file (%s): unknown driver letter", path); return NULL; @@ -256,12 +251,12 @@ lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos, lv_fs_whence_t whenc lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos) { if(file_p->drv == NULL) { - pos = 0; + *pos = 0; return LV_FS_RES_INV_PARAM; } if(file_p->drv->tell_cb == NULL) { - pos = 0; + *pos = 0; return LV_FS_RES_NOT_IMP; } @@ -282,7 +277,7 @@ lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p) return LV_FS_RES_INV_PARAM; } - if(file_p->drv->tell_cb == NULL) { + if(file_p->drv->trunc_cb == NULL) { return LV_FS_RES_NOT_IMP; } @@ -353,6 +348,9 @@ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname) */ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path) { + rddir_p->drv = NULL; + rddir_p->dir_d = NULL; + if(path == NULL) return LV_FS_RES_INV_PARAM; char letter = path[0]; @@ -360,25 +358,43 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path) rddir_p->drv = lv_fs_get_drv(letter); if(rddir_p->drv == NULL) { - rddir_p->dir_d = NULL; return LV_FS_RES_NOT_EX; } - rddir_p->dir_d = lv_mem_alloc(rddir_p->drv->rddir_size); - LV_ASSERT_MEM(rddir_p->dir_d); - if(rddir_p->dir_d == NULL) { - rddir_p->dir_d = NULL; - return LV_FS_RES_OUT_OF_MEM; /* Out of memory */ + if(rddir_p->drv->ready_cb != NULL) { + if(rddir_p->drv->ready_cb(rddir_p->drv) == false) { + rddir_p->drv = NULL; + return LV_FS_RES_HW_ERR; + } } if(rddir_p->drv->dir_open_cb == NULL) { + rddir_p->drv = NULL; return LV_FS_RES_NOT_IMP; } const char * real_path = lv_fs_get_real_path(path); + if(rddir_p->drv->rddir_size == 0) { /*Is dir_d zero size?*/ + /*Pass dir_d's address to dir_open_cb, so the implementor can allocate memory byself*/ + return rddir_p->drv->dir_open_cb(rddir_p->drv, &rddir_p->dir_d, real_path); + } + + rddir_p->dir_d = lv_mem_alloc(rddir_p->drv->rddir_size); + LV_ASSERT_MEM(rddir_p->dir_d); + if(rddir_p->dir_d == NULL) { + rddir_p->drv = NULL; + return LV_FS_RES_OUT_OF_MEM; /* Out of memory */ + } + lv_fs_res_t res = rddir_p->drv->dir_open_cb(rddir_p->drv, rddir_p->dir_d, real_path); + if(res != LV_FS_RES_OK) { + lv_mem_free(rddir_p->dir_d); + rddir_p->dir_d = NULL; + rddir_p->drv = NULL; + } + return res; } @@ -397,6 +413,7 @@ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn) } if(rddir_p->drv->dir_read_cb == NULL) { + fn[0] = '\0'; return LV_FS_RES_NOT_IMP; } @@ -416,19 +433,15 @@ lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p) return LV_FS_RES_INV_PARAM; } - lv_fs_res_t res; - if(rddir_p->drv->dir_close_cb == NULL) { - res = LV_FS_RES_NOT_IMP; - } - else { - res = rddir_p->drv->dir_close_cb(rddir_p->drv, rddir_p->dir_d); + return LV_FS_RES_NOT_IMP; } + lv_fs_res_t res = rddir_p->drv->dir_close_cb(rddir_p->drv, rddir_p->dir_d); + lv_mem_free(rddir_p->dir_d); /*Clean up*/ rddir_p->dir_d = NULL; rddir_p->drv = NULL; - rddir_p->dir_d = NULL; return res; } @@ -448,19 +461,22 @@ lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p) return LV_FS_RES_INV_PARAM; } - lv_fs_res_t res; + if(drv->ready_cb != NULL) { + if(drv->ready_cb(drv) == false) { + return LV_FS_RES_HW_ERR; + } + } if(drv->free_space_cb == NULL) { - res = LV_FS_RES_NOT_IMP; + return LV_FS_RES_NOT_IMP; } - else { + uint32_t total_tmp = 0; uint32_t free_tmp = 0; - res = drv->free_space_cb(drv, &total_tmp, &free_tmp); + lv_fs_res_t res = drv->free_space_cb(drv, &total_tmp, &free_tmp); if(total_p != NULL) *total_p = total_tmp; if(free_p != NULL) *free_p = free_tmp; - } return res; } diff --git a/src/lv_misc/lv_gc.c b/src/lv_misc/lv_gc.c index 41b32b08d7..4932c716c2 100644 --- a/src/lv_misc/lv_gc.c +++ b/src/lv_misc/lv_gc.c @@ -10,10 +10,6 @@ #include "lv_gc.h" #include "string.h" -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ diff --git a/src/lv_misc/lv_gc.h b/src/lv_misc/lv_gc.h index 3c956ac9d6..d0db2b4721 100644 --- a/src/lv_misc/lv_gc.h +++ b/src/lv_misc/lv_gc.h @@ -28,7 +28,7 @@ extern "C" { #define LV_ITERATE_ROOTS(f) \ f(lv_ll_t, _lv_timer_ll) /*Linked list to store the lv_tmr-s*/ \ f(lv_ll_t, _lv_disp_ll) /*Linked list of screens*/ \ - f(lv_ll_t, _lv_indev_ll) /*Linked list of screens*/ \ + f(lv_ll_t, _lv_indev_ll) /*Linked list of input device*/ \ f(lv_ll_t, _lv_drv_ll) \ f(lv_ll_t, _lv_file_ll) \ f(lv_ll_t, _lv_anim_ll) \ @@ -51,6 +51,7 @@ extern "C" { #if LV_MEM_CUSTOM != 1 #error "GC requires CUSTOM_MEM" #endif /* LV_MEM_CUSTOM */ +#include LV_GC_INCLUDE #else /* LV_ENABLE_GC */ #define LV_GC_ROOT(x) x #define LV_EXTERN_ROOT(root_type, root_name) extern root_type root_name; diff --git a/src/lv_misc/lv_ll.c b/src/lv_misc/lv_ll.c index 0b9d7df9bb..ac1dad20dc 100644 --- a/src/lv_misc/lv_ll.c +++ b/src/lv_misc/lv_ll.c @@ -150,7 +150,7 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p) /** * Remove the node 'node_p' from 'll_p' linked list. - * It does not free the the memory of node. + * It does not free the memory of node. * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ diff --git a/src/lv_misc/lv_ll.h b/src/lv_misc/lv_ll.h index 8346ab92e4..ab45dd7f3b 100644 --- a/src/lv_misc/lv_ll.h +++ b/src/lv_misc/lv_ll.h @@ -1,5 +1,5 @@ /** - * @file lv_ll.c + * @file lv_ll.h * Handle linked lists. The nodes are dynamically allocated by the 'lv_mem' module. */ @@ -70,7 +70,7 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p); /** * Remove the node 'node_p' from 'll_p' linked list. - * It does not free the the memory of node. + * It does not free the memory of node. * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ diff --git a/src/lv_misc/lv_log.c b/src/lv_misc/lv_log.c index d3cd8215da..42b3b02511 100644 --- a/src/lv_misc/lv_log.c +++ b/src/lv_misc/lv_log.c @@ -53,7 +53,6 @@ void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb) custom_print_cb = print_cb; } - /** * Add a log * @param level the level of log. (From `lv_log_level_t` enum) diff --git a/src/lv_misc/lv_log.h b/src/lv_misc/lv_log.h index a85427e782..fe46cf4493 100644 --- a/src/lv_misc/lv_log.h +++ b/src/lv_misc/lv_log.h @@ -23,12 +23,12 @@ extern "C" { /*Possible log level. For compatibility declare it independently from `LV_USE_LOG`*/ #define LV_LOG_LEVEL_TRACE 0 /**< A lot of logs to give detailed information*/ -#define LV_LOG_LEVEL_INFO 1 /**< Log important events*/ -#define LV_LOG_LEVEL_WARN 2 /**< Log if something unwanted happened but didn't caused problem*/ +#define LV_LOG_LEVEL_INFO 1 /**< Log important events*/ +#define LV_LOG_LEVEL_WARN 2 /**< Log if something unwanted happened but didn't caused problem*/ #define LV_LOG_LEVEL_ERROR 3 /**< Only critical issue, when the system may fail*/ -#define LV_LOG_LEVEL_USER 4 /**< Custom logs from the user*/ -#define LV_LOG_LEVEL_NONE 5 /**< Do not log anything*/ -#define _LV_LOG_LEVEL_NUM 6 /**< Number of log levels */ +#define LV_LOG_LEVEL_USER 4 /**< Custom logs from the user*/ +#define LV_LOG_LEVEL_NONE 5 /**< Do not log anything*/ +#define _LV_LOG_LEVEL_NUM 6 /**< Number of log levels */ LV_EXPORT_CONST_INT(LV_LOG_LEVEL_TRACE); LV_EXPORT_CONST_INT(LV_LOG_LEVEL_INFO); @@ -108,7 +108,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * #else /*LV_USE_LOG*/ -/*Do nothing if `LV_USE_LOG 0`*/ +/*Do nothing if `LV_USE_LOG 0`*/ #define _lv_log_add(level, file, line, ...) #define LV_LOG_TRACE(...) #define LV_LOG_INFO(...) diff --git a/src/lv_misc/lv_math.c b/src/lv_misc/lv_math.c index 17421c8588..a82a17c7e0 100644 --- a/src/lv_misc/lv_math.c +++ b/src/lv_misc/lv_math.c @@ -35,8 +35,6 @@ static const int16_t sin0_90_table[] = { 32269, 32364, 32448, 32523, 32587, 32642, 32687, 32722, 32747, 32762, 32767 }; - - /********************** * MACROS **********************/ @@ -85,7 +83,7 @@ LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_sin(int16_t angle) * @param u3 end values in range of [0..LV_BEZIER_VAL_MAX] * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] */ -int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3) +uint32_t lv_bezier3(uint32_t t, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3) { uint32_t t_rem = 1024 - t; uint32_t t_rem2 = (t_rem * t_rem) >> 10; @@ -93,10 +91,10 @@ int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3) uint32_t t2 = (t * t) >> 10; uint32_t t3 = (t2 * t) >> 10; - uint32_t v1 = ((uint32_t)t_rem3 * u0) >> 10; - uint32_t v2 = ((uint32_t)3 * t_rem2 * t * u1) >> 20; - uint32_t v3 = ((uint32_t)3 * t_rem * t2 * u2) >> 20; - uint32_t v4 = ((uint32_t)t3 * u3) >> 10; + uint32_t v1 = (t_rem3 * u0) >> 10; + uint32_t v2 = (3 * t_rem2 * t * u1) >> 20; + uint32_t v3 = (3 * t_rem * t2 * u2) >> 20; + uint32_t v4 = (t3 * u3) >> 10; return v1 + v2 + v3 + v4; } @@ -120,12 +118,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask) // http://ww1.microchip.com/...en/AppNotes/91040a.pdf do { trial = root + mask; - if((uint32_t)trial * trial <= x) root = trial; + if(trial * trial <= x) root = trial; mask = mask >> 1; } while(mask); - q->i = (uint32_t) root >> 4; - q->f = (uint32_t)(root & 0xf) << 4; + q->i = root >> 4; + q->f = (root & 0xf) << 4; } /** @@ -238,7 +236,7 @@ int64_t lv_pow(int64_t base, int8_t exp) * @param max_out max output range * @return the mapped number */ -int16_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out) +int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out) { if(x <= min_in) return min_out; if(x >= max_in) return max_out; diff --git a/src/lv_misc/lv_math.h b/src/lv_misc/lv_math.h index 9a98680c66..a9872aaf0d 100644 --- a/src/lv_misc/lv_math.h +++ b/src/lv_misc/lv_math.h @@ -1,5 +1,5 @@ /** - * @file math_base.h + * @file lv_math.h * */ @@ -34,7 +34,6 @@ typedef struct { uint16_t f; } lv_sqrt_res_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -64,7 +63,7 @@ static inline LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_cos(int16_t angle) * @param u3 end values in range of [0..LV_BEZIER_VAL_MAX] * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] */ -int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3); +uint32_t lv_bezier3(uint32_t t, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3); /** * Calculate the atan2 of a vector. @@ -74,7 +73,6 @@ int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3); */ uint16_t lv_atan2(int x, int y); - //! @cond Doxygen_Suppress /** @@ -108,8 +106,7 @@ int64_t lv_pow(int64_t base, int8_t exp); * @param max_out max output range * @return the mapped number */ -int16_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min, int32_t max); - +int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min, int32_t max); /********************** * MACROS diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c index 95286e07b3..b389c52d60 100644 --- a/src/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -17,10 +17,6 @@ #include LV_MEM_CUSTOM_INCLUDE #endif -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - /********************* * DEFINES *********************/ @@ -45,11 +41,11 @@ #if LV_ENABLE_GC == 0 /*gc custom allocations must not include header*/ -/*The size of this union must be 4 bytes (uint32_t)*/ +/*The size of this union must be 4/8 bytes (uint32_t/uint64_t)*/ typedef union { struct { MEM_UNIT used : 1; /* 1: if the entry is used*/ - MEM_UNIT d_size : 31; /* Size off the data (1 means 4 bytes)*/ + MEM_UNIT d_size : 31; /* Size of the data*/ } s; MEM_UNIT header; /* The header (used + d_size)*/ } lv_mem_header_t; @@ -106,6 +102,7 @@ static lv_mem_buf_t mem_buf_small[] = {{.p = mem_buf1_32, .size = MEM_BUF_SMALL_ #define COPY32 *d32 = *s32; d32++; s32++; #define COPY8 *d8 = *s8; d8++; s8++; #define SET32(x) *d32 = x; d32++; +#define SET8(x) *d8 = x; d8++; #define REPEAT8(expr) expr expr expr expr expr expr expr expr /********************** @@ -123,14 +120,13 @@ void lv_mem_init(void) /*Allocate a large array to store the dynamically allocated data*/ static LV_MEM_ATTR MEM_UNIT work_mem_int[LV_MEM_SIZE / sizeof(MEM_UNIT)]; work_mem = (uint8_t *)work_mem_int; - mem_max_size = 0; #else work_mem = (uint8_t *)LV_MEM_ADR; #endif last_mem = &work_mem[LV_MEM_SIZE - 1]; lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem; full->header.s.used = 0; - /*The total mem size id reduced by the first header and the close patterns */ + /*The total mem size reduced by the first header and the close patterns */ full->header.s.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); #endif } @@ -145,7 +141,7 @@ void lv_mem_deinit(void) lv_memset_00(work_mem, (LV_MEM_SIZE / sizeof(MEM_UNIT)) * sizeof(MEM_UNIT)); lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem; full->header.s.used = 0; - /*The total mem size id reduced by the first header and the close patterns */ + /*The total mem size reduced by the first header and the close patterns */ full->header.s.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); #endif } @@ -161,13 +157,8 @@ void * lv_mem_alloc(size_t size) return &zero_mem; } -#ifdef LV_ARCH_64 - /*Round the size up to 8*/ - size = (size + 7) & (~0x7); -#else - /*Round the size up to 4*/ - size = (size + 3) & (~0x3); -#endif + /*Round the size up to ALIGN_MASK*/ + size = (size + ALIGN_MASK) & (~ALIGN_MASK); void * alloc = NULL; #if LV_MEM_CUSTOM == 0 @@ -268,14 +259,8 @@ void lv_mem_free(const void * data) void * lv_mem_realloc(void * data_p, size_t new_size) { - -#ifdef LV_ARCH_64 - /*Round the size up to 8*/ - new_size = (new_size + 7) & (~0x7); -#else - /*Round the size up to 4*/ - new_size = (new_size + 3) & (~0x3); -#endif + /*Round the size up to ALIGN_MASK*/ + new_size = (new_size + ALIGN_MASK) & (~ALIGN_MASK); /*data_p could be previously freed pointer (in this case it is invalid)*/ if(data_p != NULL) { @@ -310,9 +295,9 @@ void * lv_mem_realloc(void * data_p, size_t new_size) lv_memcpy(new_p, data_p, LV_MIN(new_size, old_size)); lv_mem_free(data_p); } + lv_mem_free(data_p); } - return new_p; } @@ -397,9 +382,8 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p) lv_memset(mon_p, 0, sizeof(lv_mem_monitor_t)); #if LV_MEM_CUSTOM == 0 lv_mem_ent_t * e; - e = NULL; - e = ent_get_next(e); + e = ent_get_next(NULL); while(e != NULL) { if(e->header.s.used == 0) { @@ -419,7 +403,7 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p) mon_p->max_used = mem_max_size; mon_p->used_pct = 100 - (100U * mon_p->free_size) / mon_p->total_size; if(mon_p->free_size > 0) { - mon_p->frag_pct = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size; + mon_p->frag_pct = mon_p->free_biggest_size * 100U / mon_p->free_size; mon_p->frag_pct = 100 - mon_p->frag_pct; } else { @@ -497,18 +481,19 @@ void * lv_mem_buf_get(uint32_t size) return LV_GC_ROOT(lv_mem_buf[i_guess]).p; } - /*Reallocate a free buffer*/ for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) { if(LV_GC_ROOT(lv_mem_buf[i]).used == 0) { + /*if this fails you probably need to increase your LV_MEM_SIZE/heap size*/ + void * buf = lv_mem_realloc(LV_GC_ROOT(lv_mem_buf[i]).p, size); + if(buf == NULL) { + LV_DEBUG_ASSERT(false, "Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size)", 0x00); + return NULL; + } LV_GC_ROOT(lv_mem_buf[i]).used = 1; LV_GC_ROOT(lv_mem_buf[i]).size = size; - /*if this fails you probably need to increase your LV_MEM_SIZE/heap size*/ - LV_GC_ROOT(lv_mem_buf[i]).p = lv_mem_realloc(LV_GC_ROOT(lv_mem_buf[i]).p, size); - if(LV_GC_ROOT(lv_mem_buf[i]).p == NULL) { - LV_DEBUG_ASSERT(false, "Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size", 0x00); - } - return LV_GC_ROOT(lv_mem_buf[i]).p; + LV_GC_ROOT(lv_mem_buf[i]).p = buf; + return LV_GC_ROOT(lv_mem_buf[i]).p; } } @@ -593,7 +578,6 @@ LV_ATTRIBUTE_FAST_MEM void * lv_memcpy(void * dst, const void * src, size_t len) return dst; } - /*Make the memories aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; @@ -626,7 +610,6 @@ LV_ATTRIBUTE_FAST_MEM void * lv_memcpy(void * dst, const void * src, size_t len) return dst; } - /** * Same as `memset` but optimized for 4 byte operation. * @param dst pointer to the destination buffer @@ -644,8 +627,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len) if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { - *d8 = v; - d8++; + SET8(v); len--; d_align--; } @@ -656,14 +638,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len) uint32_t * d32 = (uint32_t *)d8; while(len > 32) { - SET32(v32); - SET32(v32); - SET32(v32); - SET32(v32); - SET32(v32); - SET32(v32); - SET32(v32); - SET32(v32); + REPEAT8(SET32(v32)); len -= 32; } @@ -672,11 +647,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len) len -= 4; } - d8 = (uint8_t *)d32; while(len) { - *d8 = v; - d8++; + SET8(v); len--; } } @@ -691,13 +664,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len) uint8_t * d8 = (uint8_t *) dst; uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK; - /*Make the address aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { - *d8 = 0x00; - d8++; + SET8(0); len--; d_align--; } @@ -705,14 +676,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len) uint32_t * d32 = (uint32_t *)d8; while(len > 32) { - SET32(0); - SET32(0); - SET32(0); - SET32(0); - SET32(0); - SET32(0); - SET32(0); - SET32(0); + REPEAT8(SET32(0)); len -= 32; } @@ -721,11 +685,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len) len -= 4; } - d8 = (uint8_t *)d32; while(len) { - *d8 = 0; - d8++; + SET8(0); len--; } } @@ -740,13 +702,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_ff(void * dst, size_t len) uint8_t * d8 = (uint8_t *) dst; uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK; - /*Make the address aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { - *d8 = 0xFF; - d8++; + SET8(0xFF); len--; d_align--; } @@ -754,14 +714,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_ff(void * dst, size_t len) uint32_t * d32 = (uint32_t *)d8; while(len > 32) { - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); - SET32(0xFFFFFFFF); + REPEAT8(SET32(0xFFFFFFFF)); len -= 32; } @@ -770,11 +723,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_ff(void * dst, size_t len) len -= 4; } - d8 = (uint8_t *)d32; while(len) { - *d8 = 0xFF; - d8++; + SET8(0xFF); len--; } } @@ -858,14 +809,8 @@ static inline void * ent_alloc(lv_mem_ent_t * e, size_t size) */ static void ent_trunc(lv_mem_ent_t * e, size_t size) { - -#ifdef LV_ARCH_64 - /*Round the size up to 8*/ - size = (size + 7) & (~0x7); -#else - /*Round the size up to 4*/ - size = (size + 3) & (~0x3); -#endif + /*Round the size up to ALIGN_MASK*/ + size = (size + ALIGN_MASK) & (~ALIGN_MASK); /*Don't let empty space only for a header without data*/ if(e->header.s.d_size == size + sizeof(lv_mem_header_t)) { @@ -878,10 +823,10 @@ static void ent_trunc(lv_mem_ent_t * e, size_t size) lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size]; after_new_e->header.s.used = 0; after_new_e->header.s.d_size = (uint32_t)e->header.s.d_size - size - sizeof(lv_mem_header_t); - } /* Set the new size for the original entry */ e->header.s.d_size = (uint32_t)size; + } } #endif diff --git a/src/lv_misc/lv_mem.h b/src/lv_misc/lv_mem.h index 6154c921bc..6c592818c3 100644 --- a/src/lv_misc/lv_mem.h +++ b/src/lv_misc/lv_mem.h @@ -138,7 +138,6 @@ void lv_mem_buf_release(void * p); */ void lv_mem_buf_free_all(void); - //! @cond Doxygen_Suppress #if LV_MEMCPY_MEMSET_STD @@ -252,7 +251,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_ff(void * dst, size_t len); #endif - /********************** * MACROS **********************/ diff --git a/src/lv_misc/lv_printf.c b/src/lv_misc/lv_printf.c index c8281038c4..bb6f3430bb 100644 --- a/src/lv_misc/lv_printf.c +++ b/src/lv_misc/lv_printf.c @@ -37,7 +37,6 @@ #include #include - #define PRINTF_DISABLE_SUPPORT_FLOAT LV_SPRINTF_DISABLE_FLOAT // 'ntoa' conversion buffer size, this must be big enough to hold one converted @@ -69,13 +68,13 @@ // define the default floating point precision // default: 6 digits #ifndef PRINTF_DEFAULT_FLOAT_PRECISION - #define PRINTF_DEFAULT_FLOAT_PRECISION 6U + #define PRINTF_DEFAULT_FLOAT_PRECISION 6U #endif // define the largest float suitable to print with %f // default: 1e9 #ifndef PRINTF_MAX_FLOAT - #define PRINTF_MAX_FLOAT 1e9 + #define PRINTF_MAX_FLOAT 1e9 #endif // support for the long long types (%llu or %p) @@ -107,24 +106,20 @@ #define FLAGS_PRECISION (1U << 10U) #define FLAGS_ADAPT_EXP (1U << 11U) - // import float.h for DBL_MAX #if defined(PRINTF_SUPPORT_FLOAT) #include #endif - // output function type typedef void (*out_fct_type)(char character, void * buffer, size_t idx, size_t maxlen); - // wrapper (used as buffer) for output function type typedef struct { void (*fct)(char character, void * arg); void * arg; } out_fct_wrap_type; - // internal buffer output static inline void _out_buffer(char character, void * buffer, size_t idx, size_t maxlen) { @@ -133,7 +128,6 @@ static inline void _out_buffer(char character, void * buffer, size_t idx, size_t } } - // internal null output static inline void _out_null(char character, void * buffer, size_t idx, size_t maxlen) { @@ -143,8 +137,6 @@ static inline void _out_null(char character, void * buffer, size_t idx, size_t m (void)maxlen; } - - // internal secure strlen // \return The length of the string (excluding the terminating 0) limited by 'maxsize' static inline unsigned int _strnlen_s(const char * str, size_t maxsize) @@ -154,7 +146,6 @@ static inline unsigned int _strnlen_s(const char * str, size_t maxsize) return (unsigned int)(s - str); } - // internal test if char is a digit (0-9) // \return true if char is a digit static inline bool _is_digit(char ch) @@ -162,7 +153,6 @@ static inline bool _is_digit(char ch) return (ch >= '0') && (ch <= '9'); } - // internal ASCII string to unsigned int conversion static unsigned int _atoi(const char ** str) { @@ -173,7 +163,6 @@ static unsigned int _atoi(const char ** str) return i; } - // output the specified string in reverse, taking care of any zero-padding static size_t _out_rev(out_fct_type out, char * buffer, size_t idx, size_t maxlen, const char * buf, size_t len, unsigned int width, unsigned int flags) @@ -203,7 +192,6 @@ static size_t _out_rev(out_fct_type out, char * buffer, size_t idx, size_t maxle return idx; } - // internal itoa format static size_t _ntoa_format(out_fct_type out, char * buffer, size_t idx, size_t maxlen, char * buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) @@ -258,7 +246,6 @@ static size_t _ntoa_format(out_fct_type out, char * buffer, size_t idx, size_t m return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); } - // internal itoa for 'long' type static size_t _ntoa_long(out_fct_type out, char * buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) @@ -283,7 +270,6 @@ static size_t _ntoa_long(out_fct_type out, char * buffer, size_t idx, size_t max return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags); } - // internal itoa for 'long long' type #if defined(PRINTF_SUPPORT_LONG_LONG) static size_t _ntoa_long_long(out_fct_type out, char * buffer, size_t idx, size_t maxlen, unsigned long long value, @@ -310,7 +296,6 @@ static size_t _ntoa_long_long(out_fct_type out, char * buffer, size_t idx, size_ } #endif // PRINTF_SUPPORT_LONG_LONG - #if defined(PRINTF_SUPPORT_FLOAT) #if defined(PRINTF_SUPPORT_EXPONENTIAL) @@ -319,7 +304,6 @@ static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, unsigned int width, unsigned int flags); #endif - // internal ftoa for fixed decimal floating point static size_t _ftoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags) @@ -448,7 +432,6 @@ static size_t _ftoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); } - #if defined(PRINTF_SUPPORT_EXPONENTIAL) // internal ftoa variant for exponential floating-point type, contributed by Martijn Jasperse static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, double value, unsigned int prec, @@ -562,7 +545,6 @@ static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, #endif // PRINTF_SUPPORT_EXPONENTIAL #endif // PRINTF_SUPPORT_FLOAT - // internal vsnprintf static int _vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, const char * format, va_list va) { @@ -873,7 +855,6 @@ static int _vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, cons return (int)idx; } - /////////////////////////////////////////////////////////////////////////////// int lv_snprintf(char * buffer, size_t count, const char * format, ...) @@ -891,4 +872,3 @@ int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va) } #endif /*LV_SPRINTF_CUSTOM*/ - diff --git a/src/lv_misc/lv_printf.h b/src/lv_misc/lv_printf.h index 9aa7073b3f..a89617cd05 100644 --- a/src/lv_misc/lv_printf.h +++ b/src/lv_misc/lv_printf.h @@ -32,7 +32,6 @@ #ifndef _LV_PRINTF_H_ #define _LV_PRINTF_H_ - #ifdef __cplusplus extern "C" { #endif @@ -61,10 +60,8 @@ int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va); #include LV_SPRINTF_INCLUDE #endif - #ifdef __cplusplus } #endif - -#endif // _PRINTF_H_ +#endif // _LV_PRINTF_H_ diff --git a/src/lv_misc/lv_txt.c b/src/lv_misc/lv_txt.c index 2229516983..b9e24144a1 100644 --- a/src/lv_misc/lv_txt.c +++ b/src/lv_misc/lv_txt.c @@ -122,7 +122,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t size_res->y += line_space; } - /*Calculate the the longest line*/ + /*Calculate the longest line*/ lv_coord_t act_line_length = _lv_txt_get_width(&text[line_start], new_line_start - line_start, font, letter_space, flag); @@ -226,7 +226,7 @@ static uint32_t lv_txt_get_next_word(const char * txt, const lv_font_t * font, /*Check for new line chars and breakchars*/ if(letter == '\n' || letter == '\r' || is_break_char(letter)) { /* Update the output width on the first character if it fits. - * Must do this here incase first letter is a break character. */ + * Must do this here in case first letter is a break character. */ if(i == 0 && break_index == NO_BREAK_FOUND && word_w_ptr != NULL) *word_w_ptr = cur_w; word_len--; break; @@ -235,7 +235,6 @@ static uint32_t lv_txt_get_next_word(const char * txt, const lv_font_t * font, /* Update the output width */ if(word_w_ptr != NULL && break_index == NO_BREAK_FOUND) *word_w_ptr = cur_w; - i = i_next; i_next = i_next_next; letter = letter_next; diff --git a/src/lv_misc/lv_txt_ap.c b/src/lv_misc/lv_txt_ap.c index 1bf68207d2..6bd7124ac8 100644 --- a/src/lv_misc/lv_txt_ap.c +++ b/src/lv_misc/lv_txt_ap.c @@ -12,7 +12,6 @@ #include "lv_txt_ap.h" #include "../lv_draw/lv_draw.h" - /********************* * DEFINES *********************/ @@ -115,7 +114,7 @@ uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt) chars_cnt++; else if(ch_enc < 0x0800) chars_cnt += 2; - else if(ch_enc < 0x010000) + else if(ch_enc < 0x010000) chars_cnt += 3; else chars_cnt += 4; @@ -126,7 +125,6 @@ uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt) return chars_cnt + 1; } - void _lv_txt_ap_proc(const char * txt, char * txt_out) { uint32_t txt_length = 0; @@ -212,7 +210,7 @@ static uint32_t lv_ap_get_char_index(uint16_t c) if(c == (ap_chars_map[i].char_offset + LV_AP_ALPHABET_BASE_CODE)) return i; else if(c == ap_chars_map[i].char_end_form //is it an End form - || c == (ap_chars_map[i].char_end_form + ap_chars_map[i].char_begining_form_offset) //is it a Begining form + || c == (ap_chars_map[i].char_end_form + ap_chars_map[i].char_begining_form_offset) //is it a Beginning form || c == (ap_chars_map[i].char_end_form + ap_chars_map[i].char_middle_form_offset) //is it a middle form || c == (ap_chars_map[i].char_end_form + ap_chars_map[i].char_isolated_form_offset)) { //is it an isolated form return i; diff --git a/src/lv_misc/lv_types.h b/src/lv_misc/lv_types.h index 92c75ee39e..5f49a0e6c5 100644 --- a/src/lv_misc/lv_types.h +++ b/src/lv_misc/lv_types.h @@ -22,7 +22,6 @@ extern "C" { #include #endif - // If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size #if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF #define LV_ARCH_64 @@ -36,7 +35,6 @@ extern "C" { #endif - /********************** * TYPEDEFS **********************/ @@ -51,8 +49,6 @@ enum { }; typedef uint8_t lv_res_t; - - #if defined(__cplusplus) || __STDC_VERSION__ >= 199901L // If c99 or newer, use the definition of uintptr_t directly from typedef uintptr_t lv_uintptr_t; @@ -68,7 +64,6 @@ typedef uint32_t lv_uintptr_t; #endif - /********************** * GLOBAL PROTOTYPES **********************/ @@ -84,4 +79,3 @@ typedef uint32_t lv_uintptr_t; #endif #endif /*LV_TYPES_H*/ - diff --git a/src/lv_themes/lv_theme.c b/src/lv_themes/lv_theme.c index 8871efaf9a..832b2ff045 100644 --- a/src/lv_themes/lv_theme.c +++ b/src/lv_themes/lv_theme.c @@ -185,6 +185,5 @@ uint32_t lv_theme_get_flags(void) static void apply_theme(lv_theme_t * th, lv_obj_t * obj) { if(th->base) apply_theme(th->base, obj); - if(th->apply_cb) th->apply_cb(act_theme, obj); } diff --git a/src/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h index 974f4300f3..ff2ecdea8c 100644 --- a/src/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -140,7 +140,6 @@ uint32_t lv_theme_get_flags(void); * POST INCLUDE *********************/ #include "lv_theme_default.h" -#include "lv_theme_mono.h" #ifdef __cplusplus } /* extern "C" */ diff --git a/src/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c deleted file mode 100644 index 49b63ec20f..0000000000 --- a/src/lv_themes/lv_theme_mono.c +++ /dev/null @@ -1,679 +0,0 @@ -/** - * @file lv_theme_mono.c - * - */ - -/********************* - * INCLUDES - *********************/ -#include "../../lvgl.h" /*To see all the widgets*/ - -#if LV_USE_THEME_MONO - -#include "../lv_misc/lv_gc.h" - -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_style_t scr; - lv_style_t bg; - lv_style_t clip_corner; - lv_style_t btn; - lv_style_t round; - lv_style_t no_radius; - lv_style_t fg_color; - lv_style_t border_none; - lv_style_t big_line_space; /*In roller or dropdownlist*/ - lv_style_t pad_none; - lv_style_t pad_normal; - lv_style_t pad_small; - lv_style_t txt_underline; - -#if LV_USE_ARC - lv_style_t arc_bg, arc_indic; -#endif - -#if LV_USE_LIST - lv_style_t list_btn; -#endif - -#if LV_USE_CALENDAR - lv_style_t calendar_date; -#endif - -#if LV_USE_CHART - lv_style_t chart_series; -#endif - -#if LV_USE_LINEMETER - lv_style_t linemeter; -#endif - -#if LV_USE_GAUGE - lv_style_t gauge_needle, gauge_major; -#endif - -#if LV_USE_PAGE - lv_style_t sb; -#endif - -#if LV_USE_SPINNER - lv_style_t tick_line; -#endif - -#if LV_USE_TEXTAREA - lv_style_t ta_cursor; -#endif - -#if LV_USE_TABVIEW - lv_style_t tab_bg; -#endif -} theme_styles_t; - -/********************** - * STATIC PROTOTYPES - **********************/ -static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name); -static void style_init_reset(lv_style_t * style); - -/********************** - * STATIC VARIABLES - **********************/ -static lv_theme_t theme; - -static theme_styles_t * styles; - -static bool inited; - -/********************** - * MACROS - **********************/ -#define COLOR_INV(c) ((c).ch.red == 0 ? LV_COLOR_WHITE : LV_COLOR_BLACK) -#define BG_COLOR theme.color_primary.ch.red == 0 ? LV_COLOR_WHITE : LV_COLOR_BLACK -#define FG_COLOR COLOR_INV(BG_COLOR) -#define RADIUS (LV_MAX(LV_DPI / 30, 2)) -#define BORDER_WIDTH (LV_MAX(LV_DPI / 60, 1)) - -/********************** - * STATIC FUNCTIONS - **********************/ - -static void basic_init(void) -{ - style_init_reset(&styles->scr); - lv_style_set_bg_opa(&styles->scr, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->scr, LV_STATE_DEFAULT, BG_COLOR); - lv_style_set_text_color(&styles->scr, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_text_sel_color(&styles->scr, LV_STATE_DEFAULT, BG_COLOR); - lv_style_set_text_sel_bg_color(&styles->scr, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_value_color(&styles->scr, LV_STATE_DEFAULT, FG_COLOR); - - style_init_reset(&styles->bg); - lv_style_set_border_post(&styles->bg, LV_STATE_DEFAULT, true); - lv_style_set_radius(&styles->bg, LV_STATE_DEFAULT, RADIUS); - lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->bg, LV_STATE_DEFAULT, BG_COLOR); - lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH); - lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED, BORDER_WIDTH * 2); - lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED | LV_STATE_EDITED, BORDER_WIDTH * 3); - lv_style_set_border_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 100, 1)); - lv_style_set_scale_end_line_width(&styles->bg, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 100, 1)); - lv_style_set_line_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_scale_grad_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_scale_end_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_text_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_value_color(&styles->bg, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_pad_left(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_right(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_top(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_bottom(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - - style_init_reset(&styles->clip_corner); - lv_style_set_clip_corner(&styles->clip_corner, LV_STATE_DEFAULT, true); - - style_init_reset(&styles->btn); - lv_style_set_radius(&styles->btn, LV_STATE_DEFAULT, RADIUS); - lv_style_set_border_width(&styles->btn, LV_STATE_DEFAULT, BORDER_WIDTH); - lv_style_set_border_width(&styles->btn, LV_STATE_FOCUSED, BORDER_WIDTH + 1); - lv_style_set_border_width(&styles->btn, LV_STATE_FOCUSED | LV_STATE_EDITED, BORDER_WIDTH + 2); - lv_style_set_border_color(&styles->btn, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_bg_color(&styles->btn, LV_STATE_DEFAULT, BG_COLOR); - lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, FG_COLOR); - lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, FG_COLOR); - lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, BG_COLOR); - lv_style_set_text_color(&styles->btn, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_text_color(&styles->btn, LV_STATE_PRESSED, BG_COLOR); - lv_style_set_text_color(&styles->btn, LV_STATE_CHECKED, BG_COLOR); - lv_style_set_text_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, FG_COLOR); - lv_style_set_value_color(&styles->btn, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_value_color(&styles->btn, LV_STATE_PRESSED, BG_COLOR); - lv_style_set_value_color(&styles->btn, LV_STATE_CHECKED, BG_COLOR); - lv_style_set_value_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, FG_COLOR); - lv_style_set_image_recolor(&styles->btn, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_image_recolor(&styles->btn, LV_STATE_PRESSED, BG_COLOR); - lv_style_set_image_recolor(&styles->btn, LV_STATE_CHECKED, BG_COLOR); - lv_style_set_image_recolor(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, FG_COLOR); - - style_init_reset(&styles->round); - lv_style_set_radius(&styles->round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - - style_init_reset(&styles->no_radius); - lv_style_set_radius(&styles->no_radius, LV_STATE_DEFAULT, 0); - - - style_init_reset(&styles->border_none); - lv_style_set_border_width(&styles->border_none, LV_STATE_DEFAULT, 0); - - - style_init_reset(&styles->fg_color); - lv_style_set_bg_color(&styles->fg_color, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_text_color(&styles->fg_color, LV_STATE_DEFAULT, BG_COLOR); - lv_style_set_image_recolor(&styles->fg_color, LV_STATE_DEFAULT, BG_COLOR); - lv_style_set_line_color(&styles->fg_color, LV_STATE_DEFAULT, FG_COLOR); - - style_init_reset(&styles->big_line_space); - lv_style_set_text_line_space(&styles->big_line_space, LV_STATE_DEFAULT, LV_DPI / 10); - - style_init_reset(&styles->pad_none); - lv_style_set_pad_left(&styles->pad_none, LV_STATE_DEFAULT, 0); - lv_style_set_pad_right(&styles->pad_none, LV_STATE_DEFAULT, 0); - lv_style_set_pad_top(&styles->pad_none, LV_STATE_DEFAULT, 0); - lv_style_set_pad_bottom(&styles->pad_none, LV_STATE_DEFAULT, 0); - - style_init_reset(&styles->pad_normal); - lv_style_set_pad_left(&styles->pad_normal, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_right(&styles->pad_normal, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_top(&styles->pad_normal, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_bottom(&styles->pad_normal, LV_STATE_DEFAULT, LV_DPI / 10); - - style_init_reset(&styles->pad_small); - lv_style_set_pad_left(&styles->pad_small, LV_STATE_DEFAULT, LV_DPI / 20); - lv_style_set_pad_right(&styles->pad_small, LV_STATE_DEFAULT, LV_DPI / 20); - lv_style_set_pad_top(&styles->pad_small, LV_STATE_DEFAULT, LV_DPI / 20); - lv_style_set_pad_bottom(&styles->pad_small, LV_STATE_DEFAULT, LV_DPI / 20); - - style_init_reset(&styles->txt_underline); - lv_style_set_text_decor(&styles->txt_underline, LV_STATE_FOCUSED, LV_TEXT_DECOR_UNDERLINE); -} - -static void arc_init(void) -{ -#if LV_USE_ARC != 0 - style_init_reset(&styles->arc_bg); - lv_style_set_line_width(&styles->arc_bg, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 100, 1)); - lv_style_set_line_color(&styles->arc_bg, LV_STATE_DEFAULT, FG_COLOR); - - style_init_reset(&styles->arc_indic); - lv_style_set_line_width(&styles->arc_indic, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 10, 3)); - lv_style_set_line_color(&styles->arc_indic, LV_STATE_DEFAULT, FG_COLOR); -#endif -} - -static void bar_init(void) -{ -#if LV_USE_BAR - -#endif -} - -static void btn_init(void) -{ -#if LV_USE_BTN != 0 - -#endif -} - - -static void btnmatrix_init(void) -{ -#if LV_USE_BTNMATRIX - -#endif -} - -static void chart_init(void) -{ -#if LV_USE_CHART - style_init_reset(&styles->chart_series); - lv_style_set_size(&styles->chart_series, LV_STATE_DEFAULT, 0); - lv_style_set_bg_opa(&styles->chart_series, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_line_width(&styles->chart_series, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 50, 1)); - -#endif -} - -static void checkbox_init(void) -{ -#if LV_USE_CHECKBOX != 0 - -#endif -} - -static void gauge_init(void) -{ -#if LV_USE_GAUGE != 0 - style_init_reset(&styles->gauge_needle); - lv_style_set_line_width(&styles->gauge_needle, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 30, 2)); - lv_style_set_line_color(&styles->gauge_needle, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_size(&styles->gauge_needle, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 10, 4)); - lv_style_set_bg_opa(&styles->gauge_needle, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->gauge_needle, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_radius(&styles->gauge_needle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - - style_init_reset(&styles->gauge_major); - lv_style_set_line_width(&styles->gauge_major, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 25, 2)); - lv_style_set_line_color(&styles->gauge_major, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_scale_end_color(&styles->gauge_major, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_scale_grad_color(&styles->gauge_major, LV_STATE_DEFAULT, FG_COLOR); - lv_style_set_scale_end_line_width(&styles->gauge_major, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 25, 2)); - -#endif -} - -static void img_init(void) -{ -#if LV_USE_IMG != 0 - -#endif -} - -static void label_init(void) -{ -#if LV_USE_LABEL != 0 - -#endif -} - - -static void linemeter_init(void) -{ -#if LV_USE_LINEMETER != 0 - style_init_reset(&styles->linemeter); - lv_style_set_line_width(&styles->linemeter, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 25, 2)); - lv_style_set_scale_end_line_width(&styles->linemeter, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 70, 1)); -#endif -} - -static void line_init(void) -{ -#if LV_USE_LINE != 0 - -#endif -} - -static void slider_init(void) -{ -#if LV_USE_SLIDER != 0 - -#endif -} - -static void switch_init(void) -{ -#if LV_USE_SWITCH != 0 - -#endif -} - -static void textarea_init(void) -{ -#if LV_USE_TEXTAREA - style_init_reset(&styles->ta_cursor); - lv_style_set_bg_opa(&styles->ta_cursor, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_border_width(&styles->ta_cursor, LV_STATE_DEFAULT, LV_MAX(LV_DPI / 100, 1)); - lv_style_set_border_side(&styles->ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT); - lv_style_set_border_color(&styles->ta_cursor, LV_STATE_DEFAULT, FG_COLOR); - -#endif -} - -static void ddlist_init(void) -{ -#if LV_USE_DROPDOWN != 0 - -#endif -} - -static void roller_init(void) -{ -#if LV_USE_ROLLER != 0 - -#endif -} - -static void table_init(void) -{ -#if LV_USE_TABLE != 0 - -#endif -} - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -/** - * Initialize the default - * @param color_primary the primary color of the theme - * @param color_secondary the secondary color for the theme - * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` - * @param font_small pointer to a small font - * @param font_normal pointer to a normal font - * @param font_subtitle pointer to a large font - * @param font_title pointer to a extra large font - * @return a pointer to reference this theme later - */ -lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, - const lv_font_t * font_title) -{ - - /* This trick is required only to avoid the garbage collection of - * styles' data if LVGL is used in a binding (e.g. Micropython) - * In a general case styles could be simple `static lv_style_t my style` variables*/ - if(!inited) { - LV_GC_ROOT(_lv_theme_mono_styles) = lv_mem_alloc(sizeof(theme_styles_t)); - styles = (theme_styles_t *)LV_GC_ROOT(_lv_theme_mono_styles); - } - - theme.color_primary = color_primary; - theme.color_secondary = color_secondary; - theme.font_small = font_small; - theme.font_normal = font_normal; - theme.font_subtitle = font_subtitle; - theme.font_title = font_title; - theme.flags = flags; - - basic_init(); - btn_init(); - label_init(); - bar_init(); - img_init(); - line_init(); - slider_init(); - switch_init(); - linemeter_init(); - gauge_init(); - arc_init(); - chart_init(); - checkbox_init(); - btnmatrix_init(); - textarea_init(); - ddlist_init(); - roller_init(); - table_init(); - - theme.apply_xcb = NULL; - theme.apply_cb = theme_apply; - - return &theme; -} - - -static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) -{ - LV_UNUSED(th); - - lv_style_list_t * list; - - switch(name) { - case LV_THEME_NONE: - break; - - case LV_THEME_SCR: - list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &styles->scr); - break; - case LV_THEME_OBJ: - list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - break; - - #if LV_USE_BTN - case LV_THEME_BTN: - list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - _lv_style_list_add_style(list, &styles->txt_underline); - break; -#endif - -#if LV_USE_BTNMATRIX - case LV_THEME_BTNMATRIX: - list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - - list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - _lv_style_list_add_style(list, &styles->txt_underline); - break; -#endif - -#if LV_USE_BAR - case LV_THEME_BAR: - list = _lv_obj_get_style_list(obj, LV_BAR_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->pad_none); - _lv_style_list_add_style(list, &styles->round); - - list = _lv_obj_get_style_list(obj, LV_BAR_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->fg_color); - _lv_style_list_add_style(list, &styles->round); - break; -#endif - -#if LV_USE_SWITCH - case LV_THEME_SWITCH: - list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->pad_none); - _lv_style_list_add_style(list, &styles->round); - - list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->fg_color); - - list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->pad_none); - _lv_style_list_add_style(list, &styles->round); - break; -#endif - -#if LV_USE_IMG - case LV_THEME_IMAGE: - list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); - break; -#endif - -#if LV_USE_IMGBTN - case LV_THEME_IMGBTN: - list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); - break; -#endif - -#if LV_USE_LABEL - case LV_THEME_LABEL: - list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); - break; -#endif - -#if LV_USE_LINE - case LV_THEME_LINE: - list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); - break; -#endif - -#if LV_USE_ARC - case LV_THEME_ARC: - list = _lv_obj_get_style_list(obj, LV_ARC_PART_BG); - _lv_style_list_add_style(list, &styles->arc_bg); - - list = _lv_obj_get_style_list(obj, LV_ARC_PART_INDIC); - _lv_style_list_add_style(list, &styles->arc_indic); - break; -#endif - -#if LV_USE_SLIDER - case LV_THEME_SLIDER: - list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->pad_none); - - list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->fg_color); - - list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - _lv_style_list_add_style(list, &styles->pad_small); - _lv_style_list_add_style(list, &styles->fg_color); - break; -#endif - -#if LV_USE_CHECKBOX - case LV_THEME_CHECKBOX: - list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_MAIN); - _lv_style_list_add_style(list, &styles->pad_small); - - list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - _lv_style_list_add_style(list, &styles->pad_small); - break; -#endif - -#if LV_USE_ROLLER - case LV_THEME_ROLLER: - list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->big_line_space); - - list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->fg_color); - _lv_style_list_add_style(list, &styles->no_radius); - break; -#endif - - -#if LV_USE_OBJMASK - case LV_THEME_OBJMASK: - list = _lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN); - break; -#endif - -#if LV_USE_DROPDOWN - case LV_THEME_DROPDOWN: - list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - - list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->big_line_space); - - list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->fg_color); - _lv_style_list_add_style(list, &styles->no_radius); - break; -#endif - -#if LV_USE_CHART - case LV_THEME_CHART: - list = _lv_obj_get_style_list(obj, LV_CHART_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->border_none); - - list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES); - _lv_style_list_add_style(list, &styles->chart_series); - break; -#endif -#if LV_USE_TABLE - case LV_THEME_TABLE: { - list = _lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - int idx = 1; /* start value should be 1, not zero, since cell styles - start at 1 due to presence of LV_TABLE_PART_BG=0 - in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) { - list = _lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->no_radius); - } - break; - } -#endif - -#if LV_USE_TEXTAREA - case LV_THEME_TEXTAREA: - list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - - list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR); - _lv_style_list_add_style(list, &styles->ta_cursor); - break; -#endif - -#if LV_USE_LINEMETER - case LV_THEME_LINEMETER: - list = _lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - _lv_style_list_add_style(list, &styles->linemeter); - break; -#endif -#if LV_USE_GAUGE - case LV_THEME_GAUGE: - list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - - list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR); - _lv_style_list_add_style(list, &styles->gauge_major); - - list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE); - _lv_style_list_add_style(list, &styles->gauge_needle); - break; -#endif - default: - break; - } - - - _lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); - - -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -static void style_init_reset(lv_style_t * style) -{ - if(inited) lv_style_reset(style); - else lv_style_init(style); -} - -#endif diff --git a/src/lv_themes/lv_theme_mono.h b/src/lv_themes/lv_theme_mono.h deleted file mode 100644 index 7d252e3b0a..0000000000 --- a/src/lv_themes/lv_theme_mono.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file lv_theme_mono.h - * - */ - -#ifndef LV_THEME_MONO_H -#define LV_THEME_MONO_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ -#include "../lv_conf_internal.h" - -#if LV_USE_THEME_MONO - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ - - -/** - * Initialize the mono theme. - * @param color_primary the primary color of the theme - * @param color_secondary the secondary color for the theme - * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` - * @param font_small pointer to a small font - * @param font_normal pointer to a normal font - * @param font_subtitle pointer to a large font - * @param font_title pointer to a extra large font - * @return a pointer to reference this theme later - */ -lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, - const lv_font_t * font_title); -/********************** - * MACROS - **********************/ - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_THEME_TEMPLATE_H*/ diff --git a/src/lv_themes/lv_theme_template.c b/src/lv_themes/lv_theme_template.c deleted file mode 100644 index 18a47a1cac..0000000000 --- a/src/lv_themes/lv_theme_template.c +++ /dev/null @@ -1,868 +0,0 @@ -/** - * @file lv_theme_template.c - * - */ - -/********************* - * INCLUDES - *********************/ -#include "../../lvgl.h" /*To see all the widgets*/ - -#if LV_USE_THEME_TEMPLATE - -#include "../lv_misc/lv_gc.h" - -#if defined(LV_GC_INCLUDE) - #include LV_GC_INCLUDE -#endif /* LV_ENABLE_GC */ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_style_t bg; - lv_style_t btn; - lv_style_t round; - lv_style_t color; - lv_style_t gray; - lv_style_t tick_line; - lv_style_t tight; -} theme_styles_t; - -/********************** - * STATIC PROTOTYPES - **********************/ -static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name); - -/********************** - * STATIC VARIABLES - **********************/ - -static lv_theme_t theme; -static theme_styles_t * styles; - -static bool inited; - -/********************** - * MACROS - **********************/ - -/********************** - * STATIC FUNCTIONS - **********************/ -static void style_init_reset(lv_style_t * style); - - -static void basic_init(void) -{ - style_init_reset(&styles->bg); - lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, 1); - lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED, 2); - lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED, theme.color_secondary); - lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, lv_color_darken(theme.color_secondary, LV_OPA_30)); - lv_style_set_line_width(&styles->bg, LV_STATE_DEFAULT, 1); - lv_style_set_scale_end_line_width(&styles->bg, LV_STATE_DEFAULT, 1); - lv_style_set_scale_end_color(&styles->bg, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_text_color(&styles->bg, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_style_set_pad_left(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_right(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_top(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_bottom(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - lv_style_set_pad_inner(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10); - - style_init_reset(&styles->btn); - lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc)); - lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary); - lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, - LV_OPA_30)); - lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER); - lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY); - lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY); - - style_init_reset(&styles->round); - lv_style_set_radius(&styles->round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - - style_init_reset(&styles->color); - lv_style_set_bg_color(&styles->color, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_line_color(&styles->color, LV_STATE_DEFAULT, theme.color_primary); - - style_init_reset(&styles->gray); - lv_style_set_bg_color(&styles->gray, LV_STATE_DEFAULT, LV_COLOR_SILVER); - lv_style_set_line_color(&styles->gray, LV_STATE_DEFAULT, LV_COLOR_SILVER); - lv_style_set_text_color(&styles->gray, LV_STATE_DEFAULT, LV_COLOR_GRAY); - - style_init_reset(&styles->tick_line); - lv_style_set_line_width(&styles->tick_line, LV_STATE_DEFAULT, 5); - lv_style_set_scale_end_line_width(&styles->tick_line, LV_STATE_DEFAULT, 5); - lv_style_set_scale_end_color(&styles->tick_line, LV_STATE_DEFAULT, theme.color_primary); - - style_init_reset(&styles->tight); - lv_style_set_pad_left(&styles->tight, LV_STATE_DEFAULT, 0); - lv_style_set_pad_right(&styles->tight, LV_STATE_DEFAULT, 0); - lv_style_set_pad_top(&styles->tight, LV_STATE_DEFAULT, 0); - lv_style_set_pad_bottom(&styles->tight, LV_STATE_DEFAULT, 0); - lv_style_set_pad_inner(&styles->tight, LV_STATE_DEFAULT, 0); -} - -static void arc_init(void) -{ -#if LV_USE_ARC != 0 - -#endif -} - -static void bar_init(void) -{ -#if LV_USE_BAR - -#endif -} - -static void btn_init(void) -{ -#if LV_USE_BTN != 0 - -#endif -} - - -static void btnmatrix_init(void) -{ -#if LV_USE_BTNMATRIX - -#endif -} - - -static void calendar_init(void) -{ -#if LV_USE_CALENDAR - -#endif -} - -static void chart_init(void) -{ -#if LV_USE_CHART - -#endif -} - - -static void cpicker_init(void) -{ -#if LV_USE_CPICKER - -#endif -} - -static void checkbox_init(void) -{ -#if LV_USE_CHECKBOX != 0 - -#endif -} - - -static void cont_init(void) -{ -#if LV_USE_CONT != 0 - -#endif -} - - -static void gauge_init(void) -{ -#if LV_USE_GAUGE != 0 - -#endif -} - -static void img_init(void) -{ -#if LV_USE_IMG != 0 - -#endif -} - -static void label_init(void) -{ -#if LV_USE_LABEL != 0 - -#endif -} - - -static void linemeter_init(void) -{ -#if LV_USE_LINEMETER != 0 - -#endif -} - -static void line_init(void) -{ -#if LV_USE_LINE != 0 - -#endif -} - -static void led_init(void) -{ -#if LV_USE_LED != 0 - -#endif -} - -static void page_init(void) -{ -#if LV_USE_PAGE - -#endif -} - -static void slider_init(void) -{ -#if LV_USE_SLIDER != 0 - -#endif -} - -static void switch_init(void) -{ -#if LV_USE_SWITCH != 0 - -#endif -} - - -static void spinbox_init(void) -{ -#if LV_USE_SPINBOX - -#endif -} - - -static void spinner_init(void) -{ -#if LV_USE_SPINNER != 0 - -#endif -} - -static void keyboard_init(void) -{ -#if LV_USE_KEYBOARD - -#endif -} - -static void msgbox_init(void) -{ -#if LV_USE_MSGBOX - -#endif -} - -static void textarea_init(void) -{ -#if LV_USE_TEXTAREA - -#endif -} - -static void list_init(void) -{ -#if LV_USE_LIST != 0 - -#endif -} - -static void ddlist_init(void) -{ -#if LV_USE_DROPDOWN != 0 - -#endif -} - -static void roller_init(void) -{ -#if LV_USE_ROLLER != 0 - -#endif -} - -static void tabview_init(void) -{ -#if LV_USE_TABVIEW != 0 - -#endif -} - -static void tileview_init(void) -{ -#if LV_USE_TILEVIEW != 0 -#endif -} - -static void table_init(void) -{ -#if LV_USE_TABLE != 0 - -#endif -} - -static void win_init(void) -{ -#if LV_USE_WIN != 0 - -#endif -} - - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -/** - * Initialize the default - * @param color_primary the primary color of the theme - * @param color_secondary the secondary color for the theme - * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` - * @param font_small pointer to a small font - * @param font_normal pointer to a normal font - * @param font_subtitle pointer to a large font - * @param font_title pointer to a extra large font - * @return a pointer to reference this theme later - */ -lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, - const lv_font_t * font_title) -{ - - /* This trick is required only to avoid the garbage collection of - * styles' data if LVGL is used in a binding (e.g. Micropython) - * In a general case styles could be simple `static lv_style_t my style` variables or allocated directly into `styles`*/ - if(!inited) { -#if defined(LV_GC_INCLUDE) - LV_GC_ROOT(_lv_theme_template_styles) = lv_mem_alloc(sizeof(theme_styles_t)); - styles = (theme_styles_t *)LV_GC_ROOT(_lv_theme_template_styles); -#else - styles = lv_mem_alloc(sizeof(theme_styles_t)); -#endif - - } - - theme.color_primary = color_primary; - theme.color_secondary = color_secondary; - theme.font_small = font_small; - theme.font_normal = font_normal; - theme.font_subtitle = font_subtitle; - theme.font_title = font_title; - theme.flags = flags; - - basic_init(); - cont_init(); - btn_init(); - label_init(); - bar_init(); - img_init(); - line_init(); - led_init(); - slider_init(); - switch_init(); - linemeter_init(); - gauge_init(); - arc_init(); - spinner_init(); - chart_init(); - calendar_init(); - cpicker_init(); - checkbox_init(); - btnmatrix_init(); - keyboard_init(); - msgbox_init(); - page_init(); - textarea_init(); - spinbox_init(); - list_init(); - ddlist_init(); - roller_init(); - tabview_init(); - tileview_init(); - table_init(); - win_init(); - - theme.apply_xcb = NULL; - theme.apply_cb = theme_apply; - - return &theme; -} - - -void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name) -{ - LV_UNUSED(th); - - lv_style_list_t * list; - - switch(name) { - case LV_THEME_NONE: - break; - - case LV_THEME_SCR: - list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - break; - case LV_THEME_OBJ: - list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - break; -#if LV_USE_CONT - case LV_THEME_CONT: - list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - break; -#endif - -#if LV_USE_BTN - case LV_THEME_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_BTNMATRIX - case LV_THEME_BTNMATRIX: - list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_KEYBOARD - case LV_THEME_KEYBOARD: - list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_BAR - case LV_THEME_BAR: - list = lv_obj_get_style_list(obj, LV_BAR_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - - list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - break; -#endif - -#if LV_USE_SWITCH - case LV_THEME_SWITCH: - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - _lv_style_list_add_style(list, &styles->round); - - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - _lv_style_list_add_style(list, &styles->round); - break; -#endif - -#if LV_USE_CANVAS - case LV_THEME_CANVAS: - list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN); - break; -#endif - -#if LV_USE_IMG - case LV_THEME_IMAGE: - list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); - break; -#endif - -#if LV_USE_IMGBTN - case LV_THEME_IMGBTN: - list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); - break; -#endif - -#if LV_USE_LABEL - case LV_THEME_LABEL: - list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); - break; -#endif - -#if LV_USE_LINE - case LV_THEME_LINE: - list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); - break; -#endif - -#if LV_USE_ARC - case LV_THEME_ARC: - list = lv_obj_get_style_list(obj, LV_ARC_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tick_line); - _lv_style_list_add_style(list, &styles->round); - - list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - _lv_style_list_add_style(list, &styles->tick_line); - break; -#endif - -#if LV_USE_SPINNER - case LV_THEME_SPINNER: - list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tick_line); - - list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - _lv_style_list_add_style(list, &styles->tick_line); - break; -#endif - -#if LV_USE_SLIDER - case LV_THEME_SLIDER: - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - break; -#endif - -#if LV_USE_CHECKBOX - case LV_THEME_CHECKBOX: - list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG); - - list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_MSGBOX - case LV_THEME_MSGBOX: - list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - break; - - case LV_THEME_MSGBOX_BTNS: - list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; - -#endif -#if LV_USE_LED - case LV_THEME_LED: - list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - _lv_style_list_add_style(list, &styles->round); - break; -#endif -#if LV_USE_PAGE - case LV_THEME_PAGE: - list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->gray); - - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR); - _lv_style_list_add_style(list, &styles->bg); - break; -#endif -#if LV_USE_TABVIEW - case LV_THEME_TABVIEW: - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCROLLABLE); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; - - case LV_THEME_TABVIEW_PAGE: - list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->gray); - - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE); - _lv_style_list_add_style(list, &styles->bg); - - break; -#endif - -#if LV_USE_TILEVIEW - case LV_THEME_TILEVIEW: - list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH); - _lv_style_list_add_style(list, &styles->bg); - break; -#endif - - -#if LV_USE_ROLLER - case LV_THEME_ROLLER: - list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - break; -#endif - - -#if LV_USE_OBJMASK - case LV_THEME_OBJMASK: - list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN); - break; -#endif - -#if LV_USE_LIST - case LV_THEME_LIST: - list = lv_obj_get_style_list(obj, LV_LIST_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE); - - list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR); - _lv_style_list_add_style(list, &styles->bg); - break; - - case LV_THEME_LIST_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_DROPDOWN - case LV_THEME_DROPDOWN: - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->color); - break; -#endif - -#if LV_USE_CHART - case LV_THEME_CHART: - list = lv_obj_get_style_list(obj, LV_CHART_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - break; -#endif -#if LV_USE_TABLE - case LV_THEME_TABLE: { - list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - int idx = 1; /* start value should be 1, not zero, since cell styles - start at 1 due to presence of LV_TABLE_PART_BG=0 - in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) { - list = lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &styles->bg); - } - break; - } -#endif - -#if LV_USE_WIN - case LV_THEME_WIN: - list = lv_obj_get_style_list(obj, LV_WIN_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER); - _lv_style_list_add_style(list, &styles->bg); - break; - - case LV_THEME_WIN_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_TEXTAREA - case LV_THEME_TEXTAREA: - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER); - _lv_style_list_add_style(list, &styles->gray); - - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - - list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR); - _lv_style_list_add_style(list, &styles->bg); - break; -#endif - - -#if LV_USE_SPINBOX - case LV_THEME_SPINBOX: - list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR); - _lv_style_list_add_style(list, &styles->bg); - break; - - case LV_THEME_SPINBOX_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - break; -#endif - -#if LV_USE_CALENDAR - case LV_THEME_CALENDAR: - list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->btn); - _lv_style_list_add_style(list, &styles->tight); - - list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->tight); - break; -#endif -#if LV_USE_CPICKER - case LV_THEME_CPICKER: - list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - - list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - break; -#endif - -#if LV_USE_LINEMETER - case LV_THEME_LINEMETER: - list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - break; -#endif -#if LV_USE_GAUGE - case LV_THEME_GAUGE: - list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN); - _lv_style_list_add_style(list, &styles->bg); - _lv_style_list_add_style(list, &styles->round); - - list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR); - _lv_style_list_add_style(list, &styles->tick_line); - - list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE); - _lv_style_list_add_style(list, &styles->bg); - break; -#endif - default: - break; - } - - lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -static void style_init_reset(lv_style_t * style) -{ - if(inited) lv_style_reset(style); - else lv_style_init(style); -} - -#endif diff --git a/src/lv_widgets/lv_arc.c b/src/lv_widgets/lv_arc.c index 19f6078633..7cf967130b 100644 --- a/src/lv_widgets/lv_arc.c +++ b/src/lv_widgets/lv_arc.c @@ -147,7 +147,6 @@ void lv_arc_set_end_angle(lv_obj_t * obj, uint16_t end) arc->indic_angle_end = end; } - /** * Set the start and end angles * @param arc pointer to an arc object @@ -280,7 +279,6 @@ void lv_arc_set_angle_ofs(lv_obj_t * obj, uint16_t angle_ofs) lv_obj_invalidate(obj); } - /** * Set the type of arc. * @param arc pointer to arc object @@ -413,7 +411,6 @@ void lv_arc_set_adjustable(lv_obj_t * obj, bool adjustable) * STATIC FUNCTIONS **********************/ - static void lv_arc_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy) { LV_LOG_TRACE("lv_arc create started"); @@ -521,7 +518,6 @@ static lv_draw_res_t lv_arc_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv &arc_dsc); } - /*make the indicator arc smaller or larger according to its greatest padding value*/ lv_coord_t left_indic = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); lv_coord_t right_indic = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); @@ -619,10 +615,10 @@ static lv_res_t lv_arc_signal(lv_obj_t * obj, lv_signal_t sign, void * param) bg_end =arc->bg_angle_end + 360; } - angle = lv_atan2(p.y, p.x); angle -=arc->angle_ofs; angle -=arc->bg_angle_start; /*Make the angle relative to the start angle*/ + if(angle < 0) angle += 360; int16_t deg_range = bg_end -arc->bg_angle_start; @@ -861,7 +857,6 @@ static void get_center(lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r) center->x = obj->coords.x1 + r + left_bg; center->y = obj->coords.y1 + r + top_bg; - lv_coord_t indic_width = lv_obj_get_style_line_width(obj, LV_PART_INDICATOR); r -= indic_width; } diff --git a/src/lv_widgets/lv_arc.h b/src/lv_widgets/lv_arc.h index 79fa0ec97e..183d017fed 100644 --- a/src/lv_widgets/lv_arc.h +++ b/src/lv_widgets/lv_arc.h @@ -128,7 +128,6 @@ void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end); */ void lv_arc_set_angle_ofs(lv_obj_t * arc, uint16_t rotation_angle); - /** * Set the type of arc. * @param arc pointer to arc object diff --git a/src/lv_widgets/lv_bar.c b/src/lv_widgets/lv_bar.c index 9a2f7a3ccf..262e558ef8 100644 --- a/src/lv_widgets/lv_bar.c +++ b/src/lv_widgets/lv_bar.c @@ -78,7 +78,6 @@ const lv_obj_class_t lv_bar = { */ lv_obj_t * lv_bar_create(lv_obj_t * parent, const lv_obj_t * copy) { - return lv_obj_create_from_class(&lv_bar, parent, copy); } @@ -102,7 +101,6 @@ void lv_bar_set_value(lv_obj_t * obj, int16_t value, lv_anim_enable_t anim) value = LV_CLAMP(bar->min_value, value, bar->max_value); value = value < bar->start_value ? bar->start_value : value; /*Can be smaller then the left value*/ - if(bar->cur_value == value) return; #if LV_USE_ANIMATION == 0 LV_UNUSED(anim); diff --git a/src/lv_widgets/lv_btn.c b/src/lv_widgets/lv_btn.c index 56a7143902..32e96728b5 100644 --- a/src/lv_widgets/lv_btn.c +++ b/src/lv_widgets/lv_btn.c @@ -10,15 +10,6 @@ #include "lv_btn.h" #if LV_USE_BTN != 0 -#include -#include "../lv_core/lv_group.h" -#include "../lv_misc/lv_debug.h" -#include "../lv_draw/lv_draw.h" -#include "../lv_themes/lv_theme.h" -#include "../lv_misc/lv_area.h" -#include "../lv_misc/lv_color.h" -#include "../lv_misc/lv_math.h" - /********************* * DEFINES *********************/ diff --git a/src/lv_widgets/lv_btn.h b/src/lv_widgets/lv_btn.h index 3ca70d997f..abd618cb6c 100644 --- a/src/lv_widgets/lv_btn.h +++ b/src/lv_widgets/lv_btn.h @@ -16,8 +16,7 @@ extern "C" { #include "../lv_conf_internal.h" #if LV_USE_BTN != 0 - -#include "../lv_core/lv_indev.h" +#include "../lv_core/lv_obj.h" /********************* * DEFINES diff --git a/src/lv_widgets/lv_btnmatrix.c b/src/lv_widgets/lv_btnmatrix.c index 80880d43b9..b7f08e376e 100644 --- a/src/lv_widgets/lv_btnmatrix.c +++ b/src/lv_widgets/lv_btnmatrix.c @@ -224,7 +224,6 @@ void lv_btnmatrix_set_focused_btn(lv_obj_t * obj, uint16_t id) lv_obj_invalidate(obj); } - /** * Enable recoloring of button's texts * @param obj pointer to button matrix object @@ -324,7 +323,6 @@ void lv_btnmatrix_set_btn_width(lv_obj_t * obj, uint16_t btn_id, uint8_t width) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - lv_btnmatrix_t * btnm = (lv_btnmatrix_t *)obj;; if(btn_id >= btnm->btn_cnt) return; btnm->ctrl_bits[btn_id] &= (~LV_BTNMATRIX_WIDTH_MASK); @@ -384,8 +382,13 @@ bool lv_btnmatrix_get_recolor(const lv_obj_t * obj) /** * Get the index of the lastly "activated" button by the user (pressed, released etc) +<<<<<<< HEAD * Useful in the the `event_cb` to get the text of the button, check if hidden etc. * @param obj pointer to button matrix object +======= + * Useful in the `event_cb` to get the text of the button, check if hidden etc. + * @param btnm pointer to button matrix object +>>>>>>> master * @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset) */ uint16_t lv_btnmatrix_get_active_btn(const lv_obj_t * obj) @@ -398,8 +401,13 @@ uint16_t lv_btnmatrix_get_active_btn(const lv_obj_t * obj) /** * Get the text of the lastly "activated" button by the user (pressed, released etc) +<<<<<<< HEAD * Useful in the the `event_cb` * @param obj pointer to button matrix object +======= + * Useful in the `event_cb` + * @param btnm pointer to button matrix object +>>>>>>> master * @return text of the last released button (NULL: if unset) */ const char * lv_btnmatrix_get_active_btn_text(const lv_obj_t * obj) @@ -477,7 +485,6 @@ bool lv_btnmatrix_get_btn_ctrl(lv_obj_t * obj, uint16_t btn_id, lv_btnmatrix_ctr return (btnm->ctrl_bits[btn_id] & ctrl) ? true : false; } - /** * Find whether "one check" mode is enabled. * @param obj Button matrix object @@ -921,11 +928,18 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par lv_obj_invalidate(obj); } else if(c == LV_KEY_DOWN) { +<<<<<<< HEAD lv_coord_t col_gap = LV_MAX(lv_obj_get_style_margin_left(obj, LV_BTNMATRIX_PART_BTN), lv_obj_get_style_margin_right(obj, LV_BTNMATRIX_PART_BTN)); /*Find the area below the the current*/ if(btnm->btn_id_focused == LV_BTNMATRIX_BTN_NONE) { btnm->btn_id_focused = 0; +======= + lv_style_int_t pad_inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG); + /*Find the area below the current*/ + if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) { + ext->btn_id_focused = 0; +>>>>>>> master } else { uint16_t area_below; @@ -948,10 +962,17 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * obj, lv_signal_t sign, void * par lv_obj_invalidate(obj); } else if(c == LV_KEY_UP) { +<<<<<<< HEAD lv_coord_t col_gap = LV_MAX(lv_obj_get_style_margin_left(obj, LV_BTNMATRIX_PART_BTN), lv_obj_get_style_margin_right(obj, LV_BTNMATRIX_PART_BTN)); /*Find the area below the the current*/ if(btnm->btn_id_focused == LV_BTNMATRIX_BTN_NONE) { btnm->btn_id_focused = 0; +======= + lv_style_int_t pad_inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG); + /*Find the area below the current*/ + if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) { + ext->btn_id_focused = 0; +>>>>>>> master } else { int16_t area_above; @@ -1005,7 +1026,6 @@ static void allocate_btn_areas_and_controls(const lv_obj_t * obj, const char ** /*Do not allocate memory for the same amount of buttons*/ if(btn_cnt == btnm->btn_cnt) return; - if(btnm->button_areas != NULL) { lv_mem_free(btnm->button_areas); btnm->button_areas = NULL; diff --git a/src/lv_widgets/lv_btnmatrix.h b/src/lv_widgets/lv_btnmatrix.h index 8b8ef835a1..5952b7c77c 100644 --- a/src/lv_widgets/lv_btnmatrix.h +++ b/src/lv_widgets/lv_btnmatrix.h @@ -188,7 +188,7 @@ bool lv_btnmatrix_get_recolor(const lv_obj_t * btnm); /** * Get the index of the lastly "activated" button by the user (pressed, released etc) - * Useful in the the `event_cb` to get the text of the button, check if hidden etc. + * Useful in the `event_cb` to get the text of the button, check if hidden etc. * @param btnm pointer to button matrix object * @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset) */ @@ -196,7 +196,7 @@ uint16_t lv_btnmatrix_get_active_btn(const lv_obj_t * btnm); /** * Get the text of the lastly "activated" button by the user (pressed, released etc) - * Useful in the the `event_cb` + * Useful in the `event_cb` * @param btnm pointer to button matrix object * @return text of the last released button (NULL: if unset) */ diff --git a/src/lv_widgets/lv_canvas.c b/src/lv_widgets/lv_canvas.c index 081ee88ddd..eb216d8a7c 100644 --- a/src/lv_widgets/lv_canvas.c +++ b/src/lv_widgets/lv_canvas.c @@ -47,7 +47,6 @@ static void set_px_cb_alpha2(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t static void set_px_cb_alpha4(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa); - static void set_px_cb_alpha8(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa); @@ -343,7 +342,6 @@ void lv_canvas_transform(lv_obj_t * obj, lv_img_dsc_t * img, int16_t angle, uint #endif } - /** * Apply horizontal blur on the canvas * @param canvas pointer to a canvas object @@ -406,7 +404,6 @@ void lv_canvas_blur_hor(lv_obj_t * obj, const lv_area_t * area, uint16_t r) lv_opa_t opa = LV_OPA_TRANSP; lv_memcpy(line_buf, &canvas->dsc.data[y * line_w], line_w); - for(x = a.x1 - r_back; x <= a.x1 + r_front; x++) { x_safe = x < 0 ? 0 : x; x_safe = x_safe > canvas->dsc.header.w - 1 ? canvas->dsc.header.w - 1 : x_safe; @@ -479,7 +476,6 @@ void lv_canvas_blur_hor(lv_obj_t * obj, const lv_area_t * area, uint16_t r) lv_mem_buf_release(line_buf); } - /** * Apply vertical blur on the canvas * @param canvas pointer to a canvas object @@ -671,7 +667,7 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord lv_img_dsc_t * dsc = lv_canvas_get_img(canvas); if(dsc->header.cf >= LV_IMG_CF_INDEXED_1BIT && dsc->header.cf <= LV_IMG_CF_INDEXED_8BIT) { - LV_LOG_WARN("lv_canvas_draw_rect: can't raw to LV_IMG_CF_INDEXED canvas"); + LV_LOG_WARN("lv_canvas_draw_rect: can't draw to LV_IMG_CF_INDEXED canvas"); return; } @@ -741,7 +737,7 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord lv_img_dsc_t * dsc = lv_canvas_get_img(canvas); if(dsc->header.cf >= LV_IMG_CF_INDEXED_1BIT && dsc->header.cf <= LV_IMG_CF_INDEXED_8BIT) { - LV_LOG_WARN("lv_canvas_draw_text: can't raw to LV_IMG_CF_INDEXED canvas"); + LV_LOG_WARN("lv_canvas_draw_text: can't draw to LV_IMG_CF_INDEXED canvas"); return; } @@ -798,7 +794,7 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi lv_img_dsc_t * dsc = lv_canvas_get_img(canvas); if(dsc->header.cf >= LV_IMG_CF_INDEXED_1BIT && dsc->header.cf <= LV_IMG_CF_INDEXED_8BIT) { - LV_LOG_WARN("lv_canvas_draw_img: can't raw to LV_IMG_CF_INDEXED canvas"); + LV_LOG_WARN("lv_canvas_draw_img: can't draw to LV_IMG_CF_INDEXED canvas"); return; } @@ -863,7 +859,7 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t points[], uint32_t lv_img_dsc_t * dsc = lv_canvas_get_img(canvas); if(dsc->header.cf >= LV_IMG_CF_INDEXED_1BIT && dsc->header.cf <= LV_IMG_CF_INDEXED_8BIT) { - LV_LOG_WARN("lv_canvas_draw_line: can't raw to LV_IMG_CF_INDEXED canvas"); + LV_LOG_WARN("lv_canvas_draw_line: can't draw to LV_IMG_CF_INDEXED canvas"); return; } /* Create a dummy display to fool the lv_draw function. @@ -926,7 +922,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32 lv_img_dsc_t * dsc = lv_canvas_get_img(canvas); if(dsc->header.cf >= LV_IMG_CF_INDEXED_1BIT && dsc->header.cf <= LV_IMG_CF_INDEXED_8BIT) { - LV_LOG_WARN("lv_canvas_draw_polygon: can't raw to LV_IMG_CF_INDEXED canvas"); + LV_LOG_WARN("lv_canvas_draw_polygon: can't draw to LV_IMG_CF_INDEXED canvas"); return; } @@ -990,7 +986,7 @@ void lv_canvas_draw_arc(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_ lv_img_dsc_t * dsc = lv_canvas_get_img(canvas); if(dsc->header.cf >= LV_IMG_CF_INDEXED_1BIT && dsc->header.cf <= LV_IMG_CF_INDEXED_8BIT) { - LV_LOG_WARN("lv_canvas_draw_arc: can't raw to LV_IMG_CF_INDEXED canvas"); + LV_LOG_WARN("lv_canvas_draw_arc: can't draw to LV_IMG_CF_INDEXED canvas"); return; } @@ -1185,7 +1181,6 @@ static void set_px_alpha_generic(lv_img_dsc_t * d, lv_coord_t x, lv_coord_t y, l lv_img_buf_set_px_alpha(d, x, y, br); } - static void set_px_true_color_alpha(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) @@ -1208,7 +1203,6 @@ static void set_px_true_color_alpha(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_ lv_color_mix_with_alpha(bg_color, bg_opa, color, opa, &res_color, &res_opa); - lv_img_buf_set_px_alpha(&d, x, y, res_opa); lv_img_buf_set_px_color(&d, x, y, res_color); } diff --git a/src/lv_widgets/lv_canvas.h b/src/lv_widgets/lv_canvas.h index 570bd3d803..1068f103d8 100644 --- a/src/lv_widgets/lv_canvas.h +++ b/src/lv_widgets/lv_canvas.h @@ -141,8 +141,6 @@ void lv_canvas_transform(lv_obj_t * canvas, lv_img_dsc_t * img, int16_t angle, u lv_coord_t offset_y, int32_t pivot_x, int32_t pivot_y, bool antialias); - - /** * Apply horizontal blur on the canvas * @param canvas pointer to a canvas object diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index 54bd38a60e..dd2221e35c 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -206,7 +206,6 @@ void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hid lv_chart_refresh(chart); } - /*===================== * Setter functions *====================*/ @@ -535,7 +534,6 @@ void lv_chart_set_cursor_point(lv_obj_t * obj, lv_chart_cursor_t * cursor, lv_po lv_chart_refresh(obj); } - /*===================== * Getter functions *====================*/ @@ -648,7 +646,6 @@ lv_coord_t lv_chart_get_x_from_index(lv_obj_t * obj, lv_chart_series_t * ser, ui lv_coord_t x = 0; - if(chart->type & LV_CHART_TYPE_LINE) { x = (w * id) / (chart->point_cnt - 1); } diff --git a/src/lv_widgets/lv_chart.h b/src/lv_widgets/lv_chart.h index c477b21552..acf7cfc5ba 100644 --- a/src/lv_widgets/lv_chart.h +++ b/src/lv_widgets/lv_chart.h @@ -49,7 +49,6 @@ enum { }; typedef uint8_t lv_chart_update_mode_t; - enum { LV_CHART_AXIS_PRIMARY_Y, /*Y axis should be the first to allow indexing arrays with the values*/ LV_CHART_AXIS_SECONDARY_Y, @@ -152,12 +151,10 @@ void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series); */ void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide); - /*===================== * Setter functions *====================*/ - /** * Set the number of horizontal and vertical division lines * @param chart pointer to a graph background object @@ -303,7 +300,6 @@ void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_char */ void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * point); - /*===================== * Getter functions *====================*/ diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index c927ff48f2..5a5611206e 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -1158,6 +1158,7 @@ static void page_press_handler(lv_obj_t * list_obj) static uint16_t get_id_on_point(lv_obj_t * dropdown_obj, lv_coord_t y) { + lv_dropdown_t * dropdown = (lv_dropdown_t *) dropdown_obj; lv_obj_t * label = get_label(dropdown_obj); if(label == NULL) return 0; y -= label->coords.y1; @@ -1171,6 +1172,7 @@ static uint16_t get_id_on_point(lv_obj_t * dropdown_obj, lv_coord_t y) uint16_t opt = y / h; + if(opt >= dropdown->option_cnt) opt = dropdown->option_cnt - 1; return opt; } diff --git a/src/lv_widgets/lv_dropdown.h b/src/lv_widgets/lv_dropdown.h index 1ce6785ee6..5b1b228929 100644 --- a/src/lv_widgets/lv_dropdown.h +++ b/src/lv_widgets/lv_dropdown.h @@ -20,7 +20,7 @@ extern "C" { /*Testing of dependencies*/ #if LV_USE_LABEL == 0 -#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " +#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif #include "../lv_widgets/lv_label.h" @@ -116,7 +116,6 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos */ void lv_dropdown_set_selected(lv_obj_t * ddlist, uint16_t sel_opt); - /** * Set the direction of the a drop down list * @param ddlist pointer to a drop down list object diff --git a/src/lv_widgets/lv_img.c b/src/lv_widgets/lv_img.c index 0a395ad350..416310ffc4 100644 --- a/src/lv_widgets/lv_img.c +++ b/src/lv_widgets/lv_img.c @@ -752,5 +752,4 @@ static lv_res_t lv_img_signal(lv_obj_t * obj, lv_signal_t sign, void * param) return res; } - #endif diff --git a/src/lv_widgets/lv_imgbtn.c b/src/lv_widgets/lv_imgbtn.c index 0d9be2d3b9..d7e787b24c 100644 --- a/src/lv_widgets/lv_imgbtn.c +++ b/src/lv_widgets/lv_imgbtn.c @@ -12,7 +12,6 @@ #include "lv_imgbtn.h" #include "lv_label.h" - #if LV_USE_IMGBTN != 0 /********************* diff --git a/src/lv_widgets/lv_label.c b/src/lv_widgets/lv_label.c index fdb39f3d72..5769ddce69 100644 --- a/src/lv_widgets/lv_label.c +++ b/src/lv_widgets/lv_label.c @@ -433,7 +433,6 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t visual_byte_pos = byte_id - line_start; #endif - /*Calculate the x coordinate*/ lv_coord_t x = _lv_txt_get_width(bidi_txt, visual_byte_pos, font, letter_space, flag); if(char_id != line_start) x += letter_space; @@ -991,7 +990,6 @@ void lv_label_refr_text(lv_obj_t * obj) uint32_t letter_id = lv_label_get_letter_on(obj, &p); - /*Be sure there is space for the dots*/ size_t txt_len = strlen(label->text); uint32_t byte_id = _lv_txt_encoded_get_byte_id(label->text, letter_id); diff --git a/src/lv_widgets/lv_line.h b/src/lv_widgets/lv_line.h index 08396474f8..3acd7f5610 100644 --- a/src/lv_widgets/lv_line.h +++ b/src/lv_widgets/lv_line.h @@ -74,7 +74,6 @@ void lv_line_set_y_invert(lv_obj_t * line, bool en); lv_line_set_y_invert /*The name was inconsistent. In v.6.0 only `lv_line_set_y_invert`will \ work */ - /*===================== * Getter functions *====================*/ diff --git a/src/lv_widgets/lv_roller.c b/src/lv_widgets/lv_roller.c index 01962cb33e..1ad3a33a4a 100644 --- a/src/lv_widgets/lv_roller.c +++ b/src/lv_widgets/lv_roller.c @@ -228,7 +228,6 @@ uint16_t lv_roller_get_selected(const lv_obj_t * obj) } } - /** * Get the current selected option as a string * @param ddlist pointer to ddlist object @@ -344,6 +343,9 @@ static void lv_roller_destructor(lv_obj_t * obj) // bar->class_p->base_p->destructor(obj); } +/********************** + * STATIC FUNCTIONS + **********************/ static void lv_roller_label_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy) { lv_label.constructor(obj, parent, copy); @@ -352,6 +354,7 @@ static void lv_roller_label_destructor(lv_obj_t * obj) { lv_label.destructor(obj); } + /** * Handle the drawing related tasks of the rollers * @param roller pointer to an object @@ -456,7 +459,6 @@ static lv_draw_res_t lv_roller_draw(lv_obj_t * obj, const lv_area_t * clip_area, return LV_DRAW_RES_OK; } - /** * Handle the drawing related tasks of the roller's label * @param roller pointer to an object @@ -724,7 +726,6 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) } } - static lv_res_t release_handler(lv_obj_t * obj) { diff --git a/src/lv_widgets/lv_slider.h b/src/lv_widgets/lv_slider.h index d7525c055e..9481479d81 100644 --- a/src/lv_widgets/lv_slider.h +++ b/src/lv_widgets/lv_slider.h @@ -19,7 +19,7 @@ extern "C" { /*Testing of dependencies*/ #if LV_USE_BAR == 0 -#error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1) " +#error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1)" #endif #include "../lv_core/lv_obj.h" diff --git a/src/lv_widgets/lv_switch.c b/src/lv_widgets/lv_switch.c index 152e39759d..7bf321bca8 100644 --- a/src/lv_widgets/lv_switch.c +++ b/src/lv_widgets/lv_switch.c @@ -12,7 +12,7 @@ /*Testing of dependencies*/ #if LV_USE_SLIDER == 0 - #error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1) " + #error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1)" #endif #include "../lv_misc/lv_debug.h" @@ -190,7 +190,6 @@ static lv_draw_res_t lv_switch_draw(lv_obj_t * obj, const lv_area_t * clip_area, return LV_DRAW_RES_OK; } - /** * Signal function of the switch * @param sw pointer to a switch object diff --git a/src/lv_widgets/lv_table.c b/src/lv_widgets/lv_table.c index 25b0a26904..1c91821b62 100644 --- a/src/lv_widgets/lv_table.c +++ b/src/lv_widgets/lv_table.c @@ -125,7 +125,6 @@ void lv_table_set_cell_value(lv_obj_t * obj, uint16_t row, uint16_t col, const c refr_size(obj) ; } - /** * Set the value of a cell. Memory will be allocated to store the text by the table. * @param table pointer to a Table object diff --git a/src/lv_widgets/lv_table.h b/src/lv_widgets/lv_table.h index a51f06f8e6..ab80469a1d 100644 --- a/src/lv_widgets/lv_table.h +++ b/src/lv_widgets/lv_table.h @@ -19,7 +19,7 @@ extern "C" { /*Testing of dependencies*/ #if LV_USE_LABEL == 0 -#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " +#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif #include "../lv_core/lv_obj.h" diff --git a/src/lv_widgets/lv_textarea.c b/src/lv_widgets/lv_textarea.c index bc2ec5e4b5..d7a06a0c1f 100644 --- a/src/lv_widgets/lv_textarea.c +++ b/src/lv_widgets/lv_textarea.c @@ -292,7 +292,6 @@ void lv_textarea_del_char(lv_obj_t * obj) lv_label_set_text(ta->label, label_txt); lv_textarea_clear_selection(obj); - /*If the textarea became empty, invalidate it to hide the placeholder*/ if(ta->placeholder_txt) { const char * txt = lv_label_get_text(ta->label); @@ -365,7 +364,6 @@ void lv_textarea_set_text(lv_obj_t * obj, const char * txt) lv_textarea_set_cursor_pos(obj, LV_TEXTAREA_CURSOR_LAST); } - /*If the textarea is empty, invalidate it to hide the placeholder*/ if(ta->placeholder_txt) { const char * txt_act = lv_label_get_text(ta->label); @@ -497,7 +495,7 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) } /** - * Enable/Disable the positioning of the the cursor by clicking the text on the text area. + * Enable/Disable the positioning of the cursor by clicking the text on the text area. * @param ta pointer to a text area object * @param en true: enable click positions; false: disable */ diff --git a/src/lv_widgets/lv_textarea.h b/src/lv_widgets/lv_textarea.h index 62bda1882c..3ac00d8914 100644 --- a/src/lv_widgets/lv_textarea.h +++ b/src/lv_widgets/lv_textarea.h @@ -19,7 +19,7 @@ extern "C" { /*Testing of dependencies*/ #if LV_USE_LABEL == 0 -#error "lv_ta: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " +#error "lv_ta: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1)" #endif #include "../lv_core/lv_obj.h" @@ -145,7 +145,7 @@ void lv_textarea_set_cursor_pos(lv_obj_t * ta, int32_t pos); void lv_textarea_set_cursor_hidden(lv_obj_t * ta, bool hide); /** - * Enable/Disable the positioning of the the cursor by clicking the text on the text area. + * Enable/Disable the positioning of the cursor by clicking the text on the text area. * @param ta pointer to a text area object * @param en true: enable click positions; false: disable */ diff --git a/tests/Makefile b/tests/Makefile index 70a44c1a61..bd7fe3738d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -11,16 +11,14 @@ WARNINGS = -Werror -Wall -Wextra \ -Wempty-body -Wshift-negative-value -Wstack-usage=2048 \ -Wtype-limits -Wsizeof-pointer-memaccess -#-Wno-unused-value -Wno-unused-parameter +#-Wno-unused-value -Wno-unused-parameter OPTIMIZATION ?= -O3 -g0 - CFLAGS ?= -I$(LVGL_DIR)/ $(DEFINES) $(WARNINGS) $(OPTIMIZATION) -I$(LVGL_DIR) -I. LDFLAGS ?= -lpng BIN ?= demo - #Collect the files to compile MAINSRC = ./lv_test_main.c @@ -53,10 +51,9 @@ all: default %.o: %.c @$(CC) $(CFLAGS) -c $< -o $@ @echo "CC $<" - + default: $(AOBJS) $(COBJS) $(MAINOBJ) $(CC) -o $(BIN) $(MAINOBJ) $(AOBJS) $(COBJS) $(LDFLAGS) -clean: +clean: rm -f $(BIN) $(AOBJS) $(COBJS) $(MAINOBJ) - diff --git a/tests/build.py b/tests/build.py index de90a95f7d..82969369e2 100755 --- a/tests/build.py +++ b/tests/build.py @@ -9,7 +9,6 @@ lvgldirname = '"' + lvgldirname + '"' base_defines = '"-DLV_CONF_PATH=' + lvgldirname +'/tests/lv_test_conf.h -DLV_BUILD_TEST"' optimization = '"-O3 -g0"' - def build(name, defines): global base_defines, optimization @@ -50,7 +49,6 @@ def build(name, defines): print("Finished") print("---------------------------") - minimal_monochrome = { "LV_DPI":40, "LV_MEM_SIZE":4*1024, @@ -282,7 +280,6 @@ all_obj_all_features = { "LV_USE_WIN":1 } - advanced_features = { "LV_DPI":100, "LV_MEM_SIZE":4*1024*1024, @@ -369,12 +366,7 @@ advanced_features = { "LV_USE_WIN":1 } - build("Minimal monochrome", minimal_monochrome) build("All objects, minimal features", all_obj_minimal_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 ce0d7a5ff5..3b8dfefb65 100644 --- a/tests/lv_test_assert.c +++ b/tests/lv_test_assert.c @@ -24,7 +24,6 @@ #define PNG_DEBUG 3 #include - /********************* * DEFINES *********************/ @@ -65,7 +64,6 @@ static void png_release(png_img_t * p); * GLOBAL FUNCTIONS **********************/ - void lv_test_print(const char * s, ...) { va_list args; @@ -75,7 +73,6 @@ void lv_test_print(const char * s, ...) va_end(args); } - void lv_test_exit(const char * s, ...) { va_list args; @@ -87,7 +84,6 @@ void lv_test_exit(const char * s, ...) exit(1); } - void lv_test_error(const char * s, ...) { va_list args; @@ -134,7 +130,6 @@ void lv_test_assert_int_lt(int32_t n_ref, int32_t n_act, const char * s) } } - void lv_test_assert_str_eq(const char * s_ref, const char * s_act, const char * s) { if(strcmp(s_ref, s_act) != 0) { @@ -144,7 +139,6 @@ void lv_test_assert_str_eq(const char * s_ref, const char * s_act, const char * } } - void lv_test_assert_array_eq(const uint8_t *p_ref, const uint8_t *p_act, int32_t size, const char * s) { if(memcmp(p_ref, p_act, size) != 0) { @@ -154,7 +148,6 @@ void lv_test_assert_array_eq(const uint8_t *p_ref, const uint8_t *p_act, int32_t } } - void lv_test_assert_ptr_eq(const void * p_ref, const void * p_act, const char * s) { if(p_ref != p_act) { @@ -281,7 +274,6 @@ static void read_png_file(png_img_t * p, const char* file_name) p->number_of_passes = png_set_interlace_handling(p->png_ptr); png_read_update_info(p->png_ptr, p->info_ptr); - /* read file */ if (setjmp(png_jmpbuf(p->png_ptr))) lv_test_exit("[read_png_file] Error during read_image"); @@ -382,4 +374,3 @@ static void png_release(png_img_t * p) // } //} #endif - diff --git a/tests/lv_test_core/lv_test_core.c b/tests/lv_test_core/lv_test_core.c index 37f65464b4..d500211ea9 100644 --- a/tests/lv_test_core/lv_test_core.c +++ b/tests/lv_test_core/lv_test_core.c @@ -50,7 +50,6 @@ void lv_test_core(void) lv_test_font_loader(); } - /********************** * STATIC FUNCTIONS **********************/ diff --git a/tests/lv_test_core/lv_test_font_loader.c b/tests/lv_test_core/lv_test_font_loader.c index 6cb64866a3..ff9c6be133 100644 --- a/tests/lv_test_core/lv_test_font_loader.c +++ b/tests/lv_test_core/lv_test_font_loader.c @@ -212,4 +212,3 @@ static int compare_fonts(lv_font_t * f1, lv_font_t * f2) **********************/ #endif // LV_BUILD_TEST - diff --git a/tests/lv_test_core/lv_test_font_loader.h b/tests/lv_test_core/lv_test_font_loader.h index fe29926bfe..ffe077e4b7 100644 --- a/tests/lv_test_core/lv_test_font_loader.h +++ b/tests/lv_test_core/lv_test_font_loader.h @@ -1,39 +1,38 @@ -/** - * @file lv_font_loader.h - * - */ - -#ifndef LV_TEST_FONT_LOADER_H -#define LV_TEST_FONT_LOADER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * GLOBAL PROTOTYPES - **********************/ -void lv_test_font_loader(void); - -/********************** - * MACROS - **********************/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /*LV_TEST_FONT_LOADER_H*/ - +/** + * @file lv_font_loader.h + * + */ + +#ifndef LV_TEST_FONT_LOADER_H +#define LV_TEST_FONT_LOADER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ +void lv_test_font_loader(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_TEST_FONT_LOADER_H*/ diff --git a/tests/lv_test_core/lv_test_obj.c b/tests/lv_test_core/lv_test_obj.c index 455646823c..e4708a18b0 100644 --- a/tests/lv_test_core/lv_test_obj.c +++ b/tests/lv_test_core/lv_test_obj.c @@ -47,7 +47,6 @@ void lv_test_obj(void) create_delete_change_parent(); } - /********************** * STATIC FUNCTIONS **********************/ @@ -59,7 +58,6 @@ static void create_delete_change_parent(void) lv_test_print("Create, delete, change parent of a simple object:"); lv_test_print("-------------------------------------------------"); - lv_test_print("Create an object on the default screen"); lv_test_assert_int_eq(0, lv_obj_count_children(lv_scr_act()), "Screen's children count before creation"); diff --git a/tests/lv_test_core/lv_test_style.c b/tests/lv_test_core/lv_test_style.c index 4697750fb0..46ac16da83 100644 --- a/tests/lv_test_core/lv_test_style.c +++ b/tests/lv_test_core/lv_test_style.c @@ -57,7 +57,6 @@ void lv_test_style(void) mem_leak(); } - /********************** * STATIC FUNCTIONS **********************/ @@ -148,7 +147,7 @@ static void add_remove_read_prop(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'color' property"); lv_test_assert_color_eq(LV_COLOR_RED, color, "Get the value of a 'color' property"); - lv_test_print("Reset the the style"); + lv_test_print("Reset the style"); lv_style_reset(&style); found = _lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); lv_test_assert_int_eq(LV_RES_INV, found, "Get an 'int' property from a reseted style"); @@ -166,7 +165,6 @@ static void add_remove_read_prop(void) _lv_style_list_reset(&style_list); } - static void cascade(void) { lv_test_print(""); @@ -236,7 +234,6 @@ static void cascade(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'color' property"); lv_test_assert_color_eq(LV_COLOR_BLUE, color, "Get the value of an overwritten 'color' property"); - lv_test_print("Overwrite the properties with the local style"); _lv_style_list_set_local_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, 20); _lv_style_list_set_local_opa(&style_list, LV_STYLE_BG_OPA, LV_OPA_70); @@ -259,7 +256,6 @@ static void cascade(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get a local 'color' property"); lv_test_assert_color_eq(LV_COLOR_LIME, color, "Get the value of a local'color' property"); - /*Clean-up*/ _lv_style_list_reset(&style_list); } @@ -270,7 +266,6 @@ static void copy(void) lv_test_print("Copy styles and style lists"); lv_test_print("---------------------------"); - lv_test_print("Copy a style"); lv_style_t style_src; lv_style_init(&style_src); @@ -362,7 +357,6 @@ static void states(void) _lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50); _lv_style_set_opa(&style_first, LV_STYLE_BG_OPA | (LV_STATE_CHECKED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_OPA_60); - lv_opa_t opa; found = _lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA , &opa); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property in normal state"); @@ -380,7 +374,6 @@ static void states(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property in checked pressed hovered state"); lv_test_assert_int_eq(LV_OPA_60, opa, "Get the value of an 'int' in checked pressed hovered state"); - lv_test_print("Test state precedence in 2 styles"); _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_YELLOW); _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, LV_COLOR_RED); @@ -417,7 +410,6 @@ static void states(void) _lv_style_list_reset(&style_list); } - static void mem_leak(void) { @@ -491,7 +483,6 @@ static void mem_leak(void) lv_mem_monitor(&mon_end); lv_test_assert_int_lt(sizeof(void*) * 8, mon_start.free_size - mon_end.free_size, "Style memory leak"); - lv_test_print("Add styles"); lv_mem_monitor(&mon_start); for(i = 0; i < 100; i++) { @@ -537,7 +528,6 @@ static void mem_leak(void) _lv_style_list_remove_style(&style_list, &style2); _lv_style_list_add_style(&style_list, &style1); - if(i % 2 != 0) _lv_style_list_set_local_color(&style_list, LV_STYLE_LINE_COLOR, LV_COLOR_RED); _lv_style_list_reset(&style_list); @@ -551,8 +541,6 @@ static void mem_leak(void) lv_mem_monitor(&mon_end); lv_test_assert_int_lt(sizeof(void*) * 8, mon_start.free_size - mon_end.free_size, "Style memory leak"); - - lv_test_print("Complex test"); lv_mem_monitor(&mon_start); @@ -569,7 +557,6 @@ static void mem_leak(void) _lv_style_list_add_style(&style_list, &style1); - if(i % 4 == 0) { _lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE); } diff --git a/tests/lv_test_fonts/font_1.c b/tests/lv_test_fonts/font_1.c index cb26d658d8..6ac794b30b 100644 --- a/tests/lv_test_fonts/font_1.c +++ b/tests/lv_test_fonts/font_1.c @@ -709,7 +709,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0xe2, 0xdb, 0xbb, 0x80, 0xb2, 0x88, 0xb0, 0x80 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -904,7 +903,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -1334,7 +1332,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -1362,7 +1359,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 1 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -1380,4 +1376,3 @@ lv_font_t font_1 = { }; #endif /*#if FONT_1*/ - diff --git a/tests/lv_test_fonts/font_2.c b/tests/lv_test_fonts/font_2.c index cb20ac7940..9d9c302189 100644 --- a/tests/lv_test_fonts/font_2.c +++ b/tests/lv_test_fonts/font_2.c @@ -739,7 +739,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0x0, 0x0, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -934,7 +933,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = * KERNING *----------------*/ - /*Map glyph_ids to kern left classes*/ static const uint8_t kern_left_class_mapping[] = { @@ -1364,7 +1362,6 @@ static const int8_t kern_class_values[] = 0, 0, 0, 0, 0 }; - /*Collect the kern class' data in one place*/ static const lv_font_fmt_txt_kern_classes_t kern_classes = { @@ -1392,7 +1389,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 0 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -1410,4 +1406,3 @@ lv_font_t font_2 = { }; #endif /*#if FONT_2*/ - diff --git a/tests/lv_test_fonts/font_3.c b/tests/lv_test_fonts/font_3.c index c0dd3cfbbe..d028e8ec59 100644 --- a/tests/lv_test_fonts/font_3.c +++ b/tests/lv_test_fonts/font_3.c @@ -794,7 +794,6 @@ static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { 0xc1, 0x64, 0xa1, 0x0, 0x54, 0x9a, 0x96, 0x0 }; - /*--------------------- * GLYPH DESCRIPTION *--------------------*/ @@ -902,8 +901,6 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { * CHARACTER MAPPING *--------------------*/ - - /*Collect the unicode lists and glyph_id offsets*/ static const lv_font_fmt_txt_cmap_t cmaps[] = { @@ -913,8 +910,6 @@ static const lv_font_fmt_txt_cmap_t cmaps[] = } }; - - /*-------------------- * ALL CUSTOM DATA *--------------------*/ @@ -932,7 +927,6 @@ static lv_font_fmt_txt_dsc_t font_dsc = { .bitmap_format = 1 }; - /*----------------- * PUBLIC FONT *----------------*/ @@ -950,4 +944,3 @@ lv_font_t font_3 = { }; #endif /*#if FONT_3*/ - diff --git a/tests/lv_test_main.c b/tests/lv_test_main.c index dd7854dcc8..db68accf89 100644 --- a/tests/lv_test_main.c +++ b/tests/lv_test_main.c @@ -26,7 +26,6 @@ int main(void) return 0; } - #if LV_USE_FILESYSTEM static void * open_cb(struct _lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode) { @@ -147,4 +146,3 @@ uint32_t custom_tick_get(void) } #endif - diff --git a/tests/lv_test_widgets/lv_test_label.c b/tests/lv_test_widgets/lv_test_label.c index 3d0435a2e0..586ebd2865 100644 --- a/tests/lv_test_widgets/lv_test_label.c +++ b/tests/lv_test_widgets/lv_test_label.c @@ -51,7 +51,6 @@ void lv_test_label(void) #endif } - /********************** * STATIC FUNCTIONS **********************/ diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 0000000000..eb317c3ce8 --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,2 @@ +build: + cmake: .