Compare commits

...

254 Commits

Author SHA1 Message Date
Gabor Kiss-Vamosi
e30efb716f Release v7.1.0 2020-07-07 09:37:00 +02:00
Gabor Kiss-Vamosi
43f5e4d2e0 Run code formatter 2020-07-07 09:36:59 +02:00
Gabor Kiss-Vamosi
d8585d2ea3 update release.py 2020-07-07 09:32:21 +02:00
Amir Gonnen
9e56f750a7 Prevent compiler warning in lv_draw_rect.c (#1637) 2020-07-04 19:50:14 -04:00
guoweilkd
e6fe8436f4 Fix #1634: bug in lv_tileview_scrl_signal (#1636) 2020-07-04 07:30:07 -04:00
Gabor Kiss-Vamosi
e9d3001dbf img: improve hit test for transformed images 2020-07-03 14:48:54 +02:00
Gabor Kiss-Vamosi
fd186eeb15 roller: fix copy 2020-07-03 14:24:23 +02:00
Petri HARRI
4b2c3e560b lv_slider: add knob-only feature and fix bug with symmetrical slider (#1578) 2020-07-01 10:14:14 -04:00
Gabor Kiss-Vamosi
1051e3f5a4 roller: fix copy. Closes #1628 2020-07-01 15:15:12 +02:00
Gabor Kiss-Vamosi
0b68c21840 Merge pull request #1627 from xiaogangly/master
Fix a memory leak bug in function "lv_objmask_remove_mask" .
2020-07-01 15:09:10 +02:00
jbamaral
ac26442ca6 Fix lv_textarea_add_char on big endian (#1620) 2020-07-01 09:08:45 -04:00
Gabor Kiss-Vamosi
6b246b2fed fix default theme colors 2020-07-01 10:53:23 +02:00
xiaogangly
86f74e3da2 Fix a memory leak bug in function "lv_objmask_remove_mask" .
There is a little memory leak When you call function "lv_objmask_remove_mask" to remove a specified mask.
It's need free the memory of list's node.
2020-07-01 15:26:37 +08:00
Gabor Kiss-Vamosi
6d1da27b3c Create merge-to-dev.yml 2020-06-30 09:43:58 +02:00
Gabor Kiss-Vamosi
bae04005d3 update old function name in comment 2020-06-29 20:47:55 +02:00
Gabor Kiss-Vamosi
edeca8c01b Merge pull request #1619 from liangyongxiang/master
Add conditional macro LV_USE_GROUP to more GROUP related singles:
2020-06-29 14:52:18 +02:00
Gabor Kiss-Vamosi
069e24bdb2 add examples folder with arduio examples and move porting folder there 2020-06-28 20:37:32 +02:00
Gabor Kiss-Vamosi
d0db0bab5c add Arduino library files 2020-06-28 20:10:30 +02:00
Themba Dube
421f1b2c01 lv_gpu: fix #1617 by renaming internal macros
This avoids conflicts with STM32Cube.
2020-06-28 09:16:25 -04:00
Gabor Kiss-Vamosi
92027cc06f lv_hal_tick: revert using uint32_t as tick_irq_flag
uint8_t surely can be written in 1 instruction even on 16 bit MCUs
2020-06-28 13:32:40 +02:00
liangyongxiang
d055944ebb Add conditional macro LV_USE_GROUP to more GROUP related singles:
- LV_SIGNAL_CONTROL
- LV_SIGNAL_GET_EDITABLE
2020-06-28 12:48:37 +08:00
Gabor Kiss-Vamosi
3e8b39c404 Merge pull request #1613 from 3096/lv_win-style-fix
material theme: fix lv_win uninitialed styles
2020-06-27 10:35:18 +02:00
3096
e06201f042 material theme: fix lv_win uninitialed styles 2020-06-26 22:27:52 -07:00
Gabor Kiss-Vamosi
6056bc3b95 clraify the tricky loop in lv_tick_get 2020-06-26 14:35:30 +02:00
Gabor Kiss-Vamosi
274d0b522d Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-26 09:39:29 +02:00
Gabor Kiss-Vamosi
ac7527fecf minor optimization in lv_obj_init_draw_img_dsc 2020-06-26 09:39:19 +02:00
Gabor Kiss-Vamosi
2ed6b4e2f5 Merge pull request #1607 from jbamaral/fix-img-big-endian-pr
fix image demos on big endian systems
2020-06-25 17:11:46 +02:00
embeddedt
3761db65e0 Fix spelling issue 2020-06-25 07:32:45 -04:00
Gabor Kiss-Vamosi
52cca1dd9b use void * as theme user data for backward compatibility 2020-06-25 06:38:17 +02:00
Gabor Kiss-Vamosi
859f72eb84 add user_data to themes 2020-06-25 06:25:40 +02:00
embeddedt
b77d484a27 Fix #1610: don't assert an expected null pointer 2020-06-24 12:25:16 -04:00
jbamaral
1733508e9a move bug logs to their right position in changelog 2020-06-24 10:01:42 -03:00
jbamaral
5f6c7743ad update internal configuration 2020-06-24 08:38:44 -03:00
jbamaral
2550368d30 fix image demos on big endian systems 2020-06-24 08:30:45 -03:00
Gabor Kiss-Vamosi
63aba1b3de lv_textarea fix cursor alignment with empty textarea when the text alignment is center or right 2020-06-24 11:36:35 +02:00
Gabor Kiss-Vamosi
42f79763e1 fix build error 2020-06-24 11:28:51 +02:00
Gabor Kiss-Vamosi
be19e91e91 fix focusing/defocusing for pages 2020-06-24 11:24:07 +02:00
Gabor Kiss-Vamosi
9561aa767d style: minor fix on getting style attributes + formatting 2020-06-24 10:45:32 +02:00
Gabor Kiss-Vamosi
4c629ec23f update changelog 2020-06-24 10:04:30 +02:00
Gabor Kiss-Vamosi
8864cd87ee lv_img: fix invalidation area when angle or zoom changes 2020-06-24 10:03:37 +02:00
jbamaral
916f5b343a Improve big endian support (#1599) 2020-06-23 08:30:33 -04:00
Gabor Kiss-Vamosi
c0223977d1 roller: fix misaligned option after setting new options 2020-06-23 11:44:06 +02:00
Gabor Kiss-Vamosi
e1c5d8950f Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-23 11:11:57 +02:00
Gabor Kiss-Vamosi
20c46ca640 In lv_init test if the the strings are UTF-8 encoded 2020-06-23 11:11:45 +02:00
Gabor Kiss-Vamosi
188205399b Merge pull request #1598 from DeonMarais64/patch-1
Add missing lv_font_montserrat_34
2020-06-22 10:08:22 +02:00
Deon Marais
f9512f55cc Add missing lv_font_montserrat_34
if you do not mind me asking, and on matters of fonts why was Roboto changed to Montserrat when V7 was released ?
2020-06-20 09:08:59 +02:00
embeddedt
8dbd685a90 Fix #1596: typo in lv_api_map.h 2020-06-19 10:13:53 -04:00
Gabor Kiss-Vamosi
0f4aeede79 Update README.md 2020-06-18 16:29:18 +02:00
Gabor Kiss-Vamosi
5d4873aa95 Update README.md 2020-06-18 16:19:57 +02:00
Gabor Kiss-Vamosi
8ac337d515 Update README.md 2020-06-18 16:13:04 +02:00
Gabor Kiss-Vamosi
2678068a86 Update CONTRIBUTING.md 2020-06-18 16:09:07 +02:00
Gabor Kiss-Vamosi
64be5e2096 Update CONTRIBUTING.md 2020-06-18 16:08:17 +02:00
Gabor Kiss-Vamosi
1521d64784 _lv_img_buf_get_transformed_area: do not calculate trivial case 2020-06-18 15:17:03 +02:00
Amir Gonnen
25fbcea31a Ensure mem_max_size is only used on non custom mem (#1588) 2020-06-18 06:40:39 -04:00
Gabor Kiss-Vamosi
51e064d836 Update CHANGELOG.md 2020-06-18 12:37:02 +02:00
Gabor Kiss-Vamosi
295337ac7e Merge pull request #1590 from diegoherranz/lv_conf_checker
lv_conf_checker.py: change requirement of python 3.6 to >=3.6
2020-06-18 12:32:13 +02:00
Diego Herranz
d2d664a69b lv_conf_checker.py: change requirement of python 3.6 to >=3.6
Many current OSes ship newer versions (e.g. 3.8) and they work OK
for this, so I don't think 3.6 is required specifically.
Versions older than 3.6 wouldn't work, though, since f-strings
are used.
2020-06-17 21:04:46 +01:00
Gabor Kiss-Vamosi
7af64df008 upadte version numer to v7.1.0-dev 2020-06-16 13:57:20 +02:00
Gabor Kiss-Vamosi
975ab3f4cc Merge branch 'dev' 2020-06-16 13:56:42 +02:00
Gabor Kiss-Vamosi
122ef1d862 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-16 13:56:00 +02:00
Gabor Kiss-Vamosi
4174ad844c relase.py minor fixes 2020-06-16 13:55:45 +02:00
Gabor Kiss-Vamosi
41e65d9df1 Run code formatter 2020-06-16 13:47:04 +02:00
Gabor Kiss-Vamosi
2d0480c03d Release v7.0.2 2020-06-16 13:42:34 +02:00
Gabor Kiss-Vamosi
b0c9c8778d CHANGELOG set v7.0.2 released 2020-06-16 13:38:37 +02:00
Gabor Kiss-Vamosi
91c98f147f Merge pull request #1580 from DaPa/master
Code comments spelling fixes
2020-06-16 13:36:36 +02:00
DaPa
0bdeb00838 Resolve conflict with 4668bc0 2020-06-16 14:27:08 +03:00
DaPa
eee2184d10 Revert part of last commit to keep _xcb naming into lv_task_create 2020-06-16 14:10:51 +03:00
Gabor Kiss-Vamosi
df9801eac3 Merge pull request #1584 from BesitzeRuf/dev
Fixes drawing of the image border
2020-06-16 13:10:36 +02:00
Gabor Kiss-Vamosi
eacc9d8ce7 chart: fix memory leak 2020-06-16 13:03:54 +02:00
Gabor Kiss-Vamosi
d6e7187d01 fix crash when drawing gradient to the same color 2020-06-16 12:47:09 +02:00
Gabor Kiss-Vamosi
f61f045135 CHANGELOG: fix typo 2020-06-16 12:05:13 +02:00
Gabor Kiss-Vamosi
4668bc0ee3 fix typo in the API 2020-06-16 12:03:32 +02:00
besitzeruf
ae93ee067c Merge branch 'dev-fix-Asymmetric-border-thickness-on-image-objects' into dev 2020-06-16 11:22:30 +02:00
besitzeruf
59165f077e - Fix when border of the image (bottom and right sides) are drawn with different width ( decreased by 1) 2020-06-16 11:18:45 +02:00
Gabor Kiss-Vamosi
00f8af0fb5 minor fixes 2020-06-16 10:28:10 +02:00
Themba Dube
10ee9e5e99 Merge branch 'dev' of github.com:littlevgl/lvgl into dev 2020-06-15 17:06:39 -04:00
DaPa
33de1ffdc7 Fixed @embeddedt's review comments
- change the wording to say "message box" and not "button matrix"
 - parameter name should be cb and not xcb due MicroPython
 - also corrected comment for lv_async_call in lv_async.h
2020-06-15 19:48:44 +03:00
DaPa
585bc329e6 Code comments spelling fixes
Also 2 files have tracing strings affected (shorter with 1 character):
 - lv_obj.c, 1078: LV_LOG_WARN
 - lv_hal_indev.c, 76: LV_LOG_WARN
2020-06-15 17:12:48 +03:00
Gabor Kiss-Vamosi
c20e62d472 lv_gaguge: make lv_gauge_get_angle_offset() offset the labels and needles too
Fixes #1579
2020-06-15 14:16:06 +02:00
Gabor Kiss-Vamosi
9260f9e0aa lv_btnm: fix sending events for hidden buttons 2020-06-14 21:07:42 +02:00
Gabor Kiss-Vamosi
8532bf80df Update CHANGELOG.md 2020-06-14 12:40:49 +02:00
Gabor Kiss-Vamosi
a2bb4099e6 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-06-14 12:39:35 +02:00
Gabor Kiss-Vamosi
182cbb1aa4 Update LV_OPA_MIN and LV_OPA_MAX to widien the opacity processed range
https://forum.lvgl.io/t/blending-fading-of-body-shadow/2466
2020-06-14 12:36:57 +02:00
nchurly
ccff331e3d Fix #1570: uninitialized variable in lv_draw_img.c (#1574) 2020-06-13 12:28:47 -04:00
OH1BDF
43cc512e5a Added functions to set multiple paddings and margins at once (#1565) 2020-06-12 07:28:11 -04:00
Carlos Diaz
a265165038 Add lv_win_add_btn_left (#1566)
Closes #1535
2020-06-12 07:26:59 -04:00
Themba Dube
8117a70608 Merge branch 'master' into dev 2020-06-12 07:23:47 -04:00
Gabor Kiss-Vamosi
dca12fcd7a Update CHANGELOG.md 2020-06-10 10:14:12 +02:00
Gabor Kiss-Vamosi
e2dabe167d Merge pull request #1562 from arturv2000/MaxMemUsed
Added max_used propriety to lv_mem_monitor_t struct
2020-06-10 10:13:34 +02:00
Gabor Kiss-Vamosi
14a359679a Update CHANGELOG.md 2020-06-09 13:41:24 +02:00
Gabor Kiss-Vamosi
3b111c794c Merge pull request #1561 from microwavesafe/master
Remove dependency on ST CubeMX Hal
2020-06-09 13:40:41 +02:00
Gabor Kiss-Vamosi
1ca1934dbe Merge pull request #1563 from C47D/update_spinner
lv_spinner: Replace remaining pre loader references with spinner
2020-06-09 13:28:53 +02:00
arturv2000
ce8d333407 Update src/lv_misc/lv_mem.c
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-06-09 09:46:42 +01:00
microwavesafe
71e23c4e13 Added example include defines 2020-06-09 09:45:12 +01:00
C47D
84776ca5f7 lv_spinner: Replace remaining pre loader references with spinner 2020-06-08 18:12:21 -05:00
arturv2000
91acf877c6 Attempt to correct error in tests 2020-06-08 21:00:12 +01:00
artur.vieira
0ebcf7e266 Added Max Used propriety to lv_mem_monitor_t struct 2020-06-08 20:22:06 +01:00
andrew
3c70a1b5a2 Fixed typo in include define
Added help in lv_conf_template.h
2020-06-08 18:36:30 +01:00
Gabor Kiss-Vamosi
4effebb3ea Update README.md 2020-06-08 16:41:06 +02:00
Gabor Kiss-Vamosi
9eff0d1cd8 Update CHANGELOG.md 2020-06-08 16:36:16 +02:00
Gabor Kiss-Vamosi
07ddc9bf8a Update CONTRIBUTING.md 2020-06-08 16:14:33 +02:00
Gabor Kiss-Vamosi
9048bcc6a0 Update README.md 2020-06-08 15:51:18 +02:00
Gabor Kiss-Vamosi
94b2e0f1a3 Update CHANGELOG.md 2020-06-08 14:16:25 +02:00
Gabor Kiss-Vamosi
a62b03743d Merge pull request #1560 from DeonMarais64/master
Add lv_btnmatrix_set/get_align capability
2020-06-08 14:15:49 +02:00
Gabor Kiss-Vamosi
4754935038 Update CHANGELOG.md 2020-06-08 14:15:14 +02:00
Gabor Kiss-Vamosi
ee44433f86 Merge pull request #1522 from fhorinek/encoder-buttons
Encoder input proc support for buttons
2020-06-08 14:14:32 +02:00
Gabor Kiss-Vamosi
9c8c8aee72 update CHANGLEOG 2020-06-08 14:13:33 +02:00
Gabor Kiss-Vamosi
2739753f20 Merge pull request #1509 from fhorinek/master
Added focus parent for v7
2020-06-08 14:11:40 +02:00
Gabor Kiss-Vamosi
14de809fa5 fix warings 2020-06-08 14:10:30 +02:00
Gabor Kiss-Vamosi
06fa5b3b8f fix conflicts 2020-06-08 14:02:04 +02:00
Gabor Kiss-Vamosi
1b9ccf9cc6 add the dev branch to CI 2020-06-08 13:56:45 +02:00
Gabor Kiss-Vamosi
36e825f093 Update README.md 2020-06-08 13:51:19 +02:00
Gabor Kiss-Vamosi
13a53d077d lv_textarea: fix character delete in password mode 2020-06-08 13:23:41 +02:00
Gabor Kiss-Vamosi
479851e968 : restructure to allow asserting in from too 2020-06-08 13:10:56 +02:00
andrew
0867f72cb9 Rename attribute define to match existing options style
Moved static array declaration to top of file
Added attribute define to template and checker headers
2020-06-08 08:40:50 +01:00
embeddedt
df08d0bd54 Fix old documentation link in lv_conf_template.h
https://forum.lvgl.io/t/lv-conf-template-h-font-usage-points-to-wrong-domain/2424
2020-06-05 17:08:00 -04:00
andrew
bb5c6437ff Added GPU init to lv_init
Changed blend buffer attr to more general LV_DMA_ATTR
Added define for CMSIS header
Fixed bug with turning on peripheral clock
2020-06-05 14:04:52 +01:00
Gabor Kiss-Vamosi
e1af20997d : fix if not the {0;0} tile is created first 2020-06-05 12:31:02 +02:00
andrew
cd9f34076e Modified DMA2D fill, copy and blend functions to use direct
register writes
2020-06-05 11:10:51 +01:00
andrew
0d897136c9 Added LV_BLEND_BUF_ATTR as blend_buf MUST be in DMA accessible RAM 2020-06-05 11:10:11 +01:00
Deon Marais
0e1b02e328 Add lv_btnmatrix_set/gett_align capability 2020-06-05 12:05:34 +02:00
Deon Marais
e3b5a14275 Add align-member and set/get functions 2020-06-05 11:58:33 +02:00
Gabor Kiss-Vamosi
643bc92958 fix warning 2020-06-05 11:06:32 +02:00
Gabor Kiss-Vamosi
1c88c1e8d4 lv_dropdown: fix missing event when used with encoder 2020-06-05 10:54:13 +02:00
Gabor Kiss-Vamosi
c3f051ac52 Add log in true double buffering mode with 2020-06-05 10:43:26 +02:00
Gabor Kiss-Vamosi
673c493694 include the version number in lv_conf_template.h
https://forum.lvgl.io/t/add-lvgl-version-to-lv-conf-h/2396/3
2020-06-05 10:36:16 +02:00
embeddedt
4f3dac6477 Fix #1557: use of uninitialized linked list 2020-06-04 09:51:26 -04:00
Gabor Kiss-Vamosi
d667e9d221 Update CHANGELOG.md 2020-06-04 11:58:32 +02:00
Gabor Kiss-Vamosi
21e4427e57 theme material: fix list button focus. 2020-06-04 11:56:57 +02:00
Gabor Kiss-Vamosi
7d29b40425 fix crash when text area cleared. Fixes #1556 2020-06-04 11:47:53 +02:00
Gabor Kiss-Vamosi
93055bc57c Do not call for transparent pixel 2020-06-04 11:47:53 +02:00
Gabor Kiss-Vamosi
d5a3b81737 fix gestures 2020-06-04 11:47:53 +02:00
Gabor Kiss-Vamosi
950ac3b993 Merge pull request #1553 from MiSimon/issue_deinit_log
Write to logfile before setting the log callback to NULL
2020-06-03 15:34:35 +02:00
MiSimon
beb496e3ed Write to logfile before setting the log callback to NULL 2020-06-03 12:37:43 +02:00
Pete Bone
822435748a Fix compiler waring in lv_ll.c (#1550) 2020-06-02 07:27:36 -04:00
Gabor Kiss-Vamosi
140904e201 fix build error 2020-06-02 11:03:00 +02:00
Gabor Kiss-Vamosi
25b4d9c34d Update README.md 2020-06-02 08:54:58 +02:00
Gabor Kiss-Vamosi
a49e7e8295 improve size rounding to 4 or 8 in lv_mem, and lv_ll 2020-06-02 08:51:22 +02:00
Gabor Kiss-Vamosi
542fa7e76d linked list: simplify settings next/prev node
https://forum.lvgl.io/t/data-abort-at-start-lvgl-v7-0-compiled-with-full-speed-optimisation-only/2286/25
2020-06-02 08:44:04 +02:00
Gabor Kiss-Vamosi
28f4092247 label: fix lv_label_get_letter_on if BIDI enabled 2020-06-02 07:13:41 +02:00
Gabor Kiss-Vamosi
6adcdda06a fix minor warings 2020-06-01 22:56:10 +02:00
Gabor Kiss-Vamosi
d953d2b9fe Update CHANGELOG.md 2020-06-01 22:44:46 +02:00
Gabor Kiss-Vamosi
7040084fbd Merge pull request #1545 from pete-pjb/32bit_idx
Change all text related indices from 16-bit to 32-bit integers throughout whole library.
2020-06-01 22:44:30 +02:00
Gabor Kiss-Vamosi
6921d872a3 remove debig code 2020-06-01 22:31:30 +02:00
Gabor Kiss-Vamosi
1544bd7b07 relase script: fix wontg file name (lv_version.h instead of lvgl.h) 2020-06-01 22:28:59 +02:00
Gabor Kiss-Vamosi
d28ac991ec update version number in lvgl.h 2020-06-01 22:25:28 +02:00
Gabor Kiss-Vamosi
9c90130fb3 Update CHANGELOG.md 2020-06-01 22:23:53 +02:00
Mike Fellows
765a97383a Fix visual studio compile errors in lv_anim code
unary negation operator was being applied to an usigned int in three
places.  I'm not sure what the other compilers are doing to accept
the current code , but I have cast the unsigned ints to a signed one
before applying the unary operator.
2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
5cb287c3c7 Update CHANGELOG.md 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
32eebbbc0c Update CHANGELOG.md 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
a535b43290 Release v7.0.1 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
63b1f6805a lv_ta: fix wrong cursor positon when clicked after the last character 2020-06-01 22:23:53 +02:00
Gabor Kiss-Vamosi
884e00ee8f rename release_patch.py to release.py 2020-06-01 21:12:29 +02:00
Gabor Kiss-Vamosi
f3d8d98807 extend the release script with lv_examples and lv_drivers handling 2020-06-01 21:11:46 +02:00
Gabor Kiss-Vamosi
4d8ae98621 Merge pull request #1542 from MCF/vs-compile-error-fixes
Fix visual studio compile errors in lv_anim code
2020-06-01 21:06:36 +02:00
Gabor Kiss-Vamosi
e8a0413ad5 Update CHANGELOG.md 2020-06-01 20:39:59 +02:00
Gabor Kiss-Vamosi
ff7e8ea315 Update CHANGELOG.md 2020-06-01 20:39:03 +02:00
Gabor Kiss-Vamosi
91b997769e Release v7.0.1 2020-06-01 20:28:32 +02:00
Gabor Kiss-Vamosi
6654444e0f update release script 2020-06-01 20:23:07 +02:00
PeterB
3561d9e063 Changed all text related indices from 16 bit to 32 bit integers. 2020-06-01 17:51:47 +01:00
Themba Dube
c5c5b2a393 lv_printf: condition floating-point on value not definition 2020-06-01 12:08:48 -04:00
Themba Dube
0c4c6cf199 lv_printf: expose floating-point configuration option 2020-06-01 12:08:08 -04:00
PeterB
a0583f6feb Merge remote-tracking branch 'origin/master' into 32bit_idx 2020-06-01 12:31:14 +01:00
Themba Dube
0673dd0b12 Change dropdown to use 32-bit indexes 2020-06-01 07:18:31 -04:00
Gabor Kiss-Vamosi
ef1242f234 Update LICENCE.txt 2020-05-31 23:03:38 +02:00
Gabor Kiss-Vamosi
f8c7485d82 Update CHANGELOG.md 2020-05-31 22:54:40 +02:00
Gabor Kiss-Vamosi
88b54456ef Update README.md 2020-05-31 21:46:12 +02:00
Gabor Kiss-Vamosi
2be298fc3f Update README.md 2020-05-31 21:45:36 +02:00
Themba Dube
af812b0c55 keyboard: allow backspace to auto-repeat in numeric mode (lv_examples#58) 2020-05-31 08:33:21 -04:00
Mike Fellows
09fb1e60e3 Fix visual studio compile errors in lv_anim code
unary negation operator was being applied to an usigned int in three
places.  I'm not sure what the other compilers are doing to accept
the current code , but I have cast the unsigned ints to a signed one
before applying the unary operator.
2020-05-30 13:05:25 -07:00
Mike Fellows
4575fec915 Fix a few links in README (#1541)
* To some of the simulator/IDE github projects
* To the one of the STM32F7 github projects
2020-05-30 09:13:53 -04:00
Gabor Kiss-Vamosi
4c3db9e02f clarify the usage of template theme 2020-05-29 06:42:29 +02:00
embeddedt
99f1d1bc7a Remove duplicate docs link 2020-05-28 19:22:28 -04:00
Gabor Kiss-Vamosi
ec5b10142f add lv_obj_remove_style 2020-05-28 07:58:10 +02:00
Gabor Kiss-Vamosi
8d5dfa1ec2 chart: fix X tick drawing 2020-05-28 07:57:47 +02:00
Gabor Kiss-Vamosi
27ef3a1d07 fix chart x axix label drawing 2020-05-28 07:52:00 +02:00
Gabor Kiss-Vamosi
91f8b3060e fix verical dashed line 2020-05-28 07:52:00 +02:00
Gabor Kiss-Vamosi
86307c669f remove leftover code 2020-05-27 16:39:00 +02:00
Gabor Kiss-Vamosi
207ec2997f DMA2D: minor fix with double buffering 2020-05-27 16:21:35 +02:00
Gabor Kiss-Vamosi
65c9b64f9a Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-27 16:01:14 +02:00
Gabor Kiss-Vamosi
70162562b2 speed up true double buffering 2020-05-27 16:00:56 +02:00
tgillbe
25a5623e77 Fix lv_slider knob size off-by-one bug (#1531) 2020-05-27 09:19:54 -04:00
Gabor Kiss-Vamosi
4f386f19fe chart: fix y axis label drawing 2020-05-27 11:59:39 +02:00
Gabor Kiss-Vamosi
2be22d3bef list: leaving edit mode with encoder 2020-05-27 11:22:01 +02:00
Gabor Kiss-Vamosi
0a9d8a6133 remove memcpy from lv_ll 2020-05-27 10:36:24 +02:00
Gabor Kiss-Vamosi
6a35a384b8 Merge branch 'encoder-buttons' of https://github.com/fhorinek/lvgl into fhorinek-encoder-buttons 2020-05-27 10:35:58 +02:00
Gabor Kiss-Vamosi
a8904b39ea Merge pull request #1529 from lvgl/kisvegabor-patch-1
Update README.md - CLA test again
2020-05-27 10:09:32 +02:00
Gabor Kiss-Vamosi
08bd2ae669 Update README.md 2020-05-27 10:08:17 +02:00
Gabor Kiss-Vamosi
65a0046891 Merge pull request #1528 from lvgl/kisvegabor-patch-1
Update README.md - Test CLA
2020-05-27 10:03:08 +02:00
Gabor Kiss-Vamosi
421e1fc9f8 Update README.md 2020-05-27 10:01:51 +02:00
Gabor Kiss-Vamosi
306405bcff Merge branch 'master' into speed/shadow 2020-05-26 11:00:09 +02:00
Gabor Kiss-Vamosi
7fb49693f4 minor speed up on rectangle drawing 2020-05-26 10:59:49 +02:00
Gabor Kiss-Vamosi
19c3f9306f improve DMA2D blending dupport 2020-05-26 10:59:29 +02:00
Gabor Kiss-Vamosi
b056315410 add LV_COLOR_MIX_ROUND_OFS to adjust color mix to GPU's algorithms 2020-05-26 10:58:52 +02:00
František Horínek
691ce77800 Modified version for encoder input proc.
Now you can also pass buttons LEFT/RIGHT to emulate the encoder, good for joysticks or small keypads.
All other keys are passed trought.
2020-05-25 15:51:20 +02:00
Gabor Kiss-Vamosi
966b4b11f6 lv_color_mix_with_alpha: fix initialization 2020-05-25 12:44:54 +02:00
Gabor Kiss-Vamosi
b4de4c5ca1 remove dead code 2020-05-25 12:42:38 +02:00
Gabor Kiss-Vamosi
0072a2ade5 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-25 11:55:12 +02:00
Gabor Kiss-Vamosi
eda752ab94 add lv_theme_get_color_secondary 2020-05-25 11:49:04 +02:00
Gabor Kiss-Vamosi
89206c51c3 optimize shdow drawing 2020-05-25 11:13:13 +02:00
Gabor Kiss-Vamosi
21a172ca0d Update README.md 2020-05-25 09:29:17 +02:00
Gabor Kiss-Vamosi
2e64db0261 Update README.md 2020-05-25 08:29:57 +02:00
Gabor Kiss-Vamosi
b4b37b98aa Update README.md 2020-05-25 06:41:06 +02:00
Gabor Kiss-Vamosi
dfb7c6731c Update CODING_STYLE.md 2020-05-25 06:35:00 +02:00
Gabor Kiss-Vamosi
2078e4a01a Update CONTRIBUTING.md 2020-05-25 06:26:30 +02:00
Gabor Kiss-Vamosi
11c80b626c Update CONTRIBUTING.md 2020-05-25 06:26:04 +02:00
Gabor Kiss-Vamosi
e3f63e09cf Update CONTRIBUTING.md 2020-05-25 06:24:33 +02:00
Gabor Kiss-Vamosi
07efe31ff4 Update CONTRIBUTING.md 2020-05-25 06:23:12 +02:00
Gabor Kiss-Vamosi
3837988f2d README: change littlevgl to lvgl 2020-05-25 05:54:38 +02:00
Gabor Kiss-Vamosi
5ea142eaf0 Update config.yml 2020-05-25 05:44:24 +02:00
Gabor Kiss-Vamosi
38944883b1 Update config.yml 2020-05-25 05:44:01 +02:00
Gabor Kiss-Vamosi
ab6d69445e Create config.yml 2020-05-25 05:40:04 +02:00
Gabor Kiss-Vamosi
6c34280b66 Merge pull request #1520 from rene-dev/master
fixed RGB palette name in config template
2020-05-24 13:58:04 +02:00
Gabor Kiss-Vamosi
279e594d3e minor formatting 2020-05-24 13:14:42 +02:00
Gabor Kiss-Vamosi
a2c973bd5b fix warings 2020-05-24 13:13:07 +02:00
Rene Hopf
96ba7df9d3 fixed RGB palette name in config template 2020-05-24 01:38:05 +02:00
Gabor Kiss-Vamosi
7e4e5b7271 Merge branch 'master' of https://github.com/fhorinek/lvgl into fhorinek-master 2020-05-23 14:54:18 +02:00
Gabor Kiss-Vamosi
1666c8cb4f handle focus_parent in pointer indevs 2020-05-23 14:53:23 +02:00
Gabor Kiss-Vamosi
1c9830b715 Update README.md 2020-05-23 14:41:11 +02:00
Gabor Kiss-Vamosi
b10dece511 Update README.md 2020-05-23 14:14:02 +02:00
Gabor Kiss-Vamosi
d8a37e8fd8 update themes to avoid garbage collection of styles 2020-05-22 22:36:24 +02:00
Gabor Kiss-Vamosi
2ea96eaf83 fix warning 2020-05-22 22:05:51 +02:00
Gabor Kiss-Vamosi
a8a3c2a3c7 minor rework on button states 2020-05-22 21:45:11 +02:00
Gabor Kiss-Vamosi
ab4d8c9165 fix infinite roller with encoder 2020-05-22 21:36:22 +02:00
František Horínek
8f19010b17 Update src/lv_core/lv_obj.c
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2020-05-21 17:27:37 +02:00
Gabor Kiss-Vamosi
4fade082e5 Merge branch 'master' of https://github.com/fhorinek/lvgl into fhorinek-master 2020-05-21 15:17:19 +02:00
Gabor Kiss-Vamosi
2a78353ca4 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-21 15:17:07 +02:00
Gabor Kiss-Vamosi
efaf84f6f7 fix material theme init 2020-05-21 15:13:14 +02:00
Gabor Kiss-Vamosi
6f5b756786 update old function names 2020-05-21 15:01:34 +02:00
Gabor Kiss-Vamosi
bebe1f07df img_draw: fix releasing buffer with DMA2D 2020-05-21 14:23:03 +02:00
František Horínek
b23d945ed4 changed behavior to focus_parent flag 2020-05-21 14:09:56 +02:00
Gabor Kiss-Vamosi
82ad0f0c5c img drawing fixes with 32 bit color depth 2020-05-21 12:46:04 +02:00
Gabor Kiss-Vamosi
f248d47a36 fix typo 2020-05-21 11:33:07 +02:00
Gabor Kiss-Vamosi
fa58aed475 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-21 11:28:00 +02:00
Gabor Kiss-Vamosi
4eb2340f2a img: fix cover check 2020-05-21 11:27:52 +02:00
Gabor Kiss-Vamosi
474b8e0920 CJK: fix built-in SimSun font and wrong UTF-8 decoding in Arabic processor 2020-05-21 10:40:16 +02:00
Gabor Kiss-Vamosi
c77ab45dd3 add material theme to GC_ROOTS 2020-05-21 09:37:37 +02:00
Gabor Kiss-Vamosi
76ae5934ba Update library.json 2020-05-20 14:50:02 +02:00
Amir Gonnen
8233483477 Add missing LV_GC_INCLUDE (#1511) 2020-05-19 20:15:49 -04:00
František Horínek
10ca6d4215 replaced #ifdef to #if 2020-05-19 15:45:09 +02:00
František Horínek
2712f0aeaa Added macro LV_USE_GROUP_FOCUS_PARENT to automatic tests 2020-05-19 15:31:34 +02:00
František Horínek
aaa78ba949 Added focus parent for v7 2020-05-19 15:22:38 +02:00
Gabor Kiss-Vamosi
080d06b838 fix lv_misc.mk. Fixes: #1508 2020-05-19 14:56:14 +02:00
Gabor Kiss-Vamosi
00176b2c7e rename _mask_list to lv_draw_mask_list 2020-05-19 13:29:21 +02:00
Gabor Kiss-Vamosi
f2ff87f820 add LV_DC_ROOT prefix to _mask_list 2020-05-19 13:27:19 +02:00
Gabor Kiss-Vamosi
6a10f3e116 Merge branch 'master' of https://github.com/littlevgl/lvgl 2020-05-19 13:20:38 +02:00
Gabor Kiss-Vamosi
38ae98a565 move (draw) mask_list to gc roots 2020-05-19 13:20:29 +02:00
Gabor Kiss-Vamosi
f2be14868e Update README.md 2020-05-19 11:35:18 +02:00
Gabor Kiss-Vamosi
e6829f6d4b Update CHANGELOG.md 2020-05-19 10:59:21 +02:00
Gabor Kiss-Vamosi
469b676237 Update CHANGELOG.md 2020-05-19 10:57:50 +02:00
Gabor Kiss-Vamosi
5e4456335a Update README.md 2020-05-19 10:57:07 +02:00
Gabor Kiss-Vamosi
46376a4a11 set version number to 7.0.1-dev 2020-05-19 10:31:49 +02:00
Gabor Kiss-Vamosi
72c79b58a8 disable LV_MEM_JUNK 2020-05-19 10:31:13 +02:00
Gabor Kiss-Vamosi
de0d93c47e Update ccpp.yml 2020-05-18 19:05:48 +02:00
151 changed files with 14548 additions and 13864 deletions

14
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Documentation
url: https://docs.lvgl.io
about: Be sure to read to documentation first
- name: Forum
url: https://forum.lvgl.io
about: For how-to questions use the forum
- name: CONTIBUTING.md
url: https://github.com/lvgl/lvgl/blob/master/docs/CONTRIBUTING.md#faq-about-contributing
about: The basic rules of contributing
- name: CODING_STYLE.md
url: https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md
about: Quick summary of LVGL's code style

View File

@@ -2,9 +2,9 @@ name: C/C++ CI
on:
push:
branches: [ dev-7.0 ]
branches: [ master, dev ]
pull_request:
branches: [ dev-7.0 ]
branches: [master, dev ]
jobs:
build:

17
.github/workflows/merge-to-dev.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Merge master branch to dev
on:
push:
branches:
- 'master'
jobs:
merge-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge to dev branch
uses: devmasx/merge-branch@v1.1.0
with:
type: now
target_branch: 'dev'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@@ -1,7 +1,67 @@
# Changelog
## v7.1.0 (planned on 07.07.2020)
*Available in the `master` branch*
### New features
- Add `focus_parent` attribute to `lv_obj`
- Allow using buttons in encoder input device
- Add lv_btnmatrix_set/get_align capability
- DMA2D: Remove dependency on ST CubeMX HAL
- Added `max_used` propriety to `lv_mem_monitor_t` struct
- In `lv_init` test if the the strings are UTF-8 encoded.
- Add `user_data` to themes
### Bugfixes
- `lv_img` fix invalidation area when angle or zoom changes
- Update the style handling to support Big endian MCUs
- Change some methods to support big endian hardware.
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
- Fix inserting chars in text area in big endian hardware.
## v7.0.2 (16.06.2020)
### Bugfixes
- `lv_textarea` fix wrong cursor position when clicked after the last character
- Change all text related indices from 16-bit to 32-bit integers throughout whole library. #1545
- Fix gestures
- Do not call `set_px_cb` for transparent pixel
- Fix list button focus in material theme
- Fix crash when the a text area is cleared with the backspace of a keyboard
- Add version number to `lv_conf_template.h`
- Add log in true double buffering mode with `set_px_cb`
- `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder
- `lv_tileview`: fix if not the {0;0} tile is created first
- `lv_debug`: restructure to allow asserting in from `lv_misc` too
- add assert if `_lv_mem_buf_get()` fails
- `lv_textarea`: fix character delete in password mode
- Update `LV_OPA_MIN` and `LV_OPA_MAX` to widen the opacity processed range
- `lv_btnm` fix sending events for hidden buttons
- `lv_gaguge` make `lv_gauge_set_angle_offset` offset the labels and needles too
- Fix typo in the API `scrllable` -> `scrollable`
- `tabview` by default allow auto expanding the page only to right and bottom (#1573)
- fix crash when drawing gradient to the same color
- chart: fix memory leak
- `img`: improve hit test for transformed images
## v7.0.1 (01.06.2020)
### Bugfixes
- Make the Microptyhon working by adding the required variables as GC_ROOT
- Prefix some internal API functions with `_` to reduce the API of LVGL
- Fix built-in SimSun CJK font
- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled
- Fix DMA2D usage when 32 bit images directly blended
- Fix lv_roller in infinite mode when used with encoder
- Add `lv_theme_get_color_secondary()`
- Add `LV_COLOR_MIX_ROUND_OFS` to adjust color mixing to make it compatible with the GPU
- Improve DMA2D blending
- Remove memcpy from `lv_ll` (caused issues with some optimization settings)
- `lv_chart` fix X tick drawing
- Fix vertical dashed line drawing
- Some additonal minor fixes and formattings
## v7.0.0 (18.05.2020)
To try the new version use the `dev-7.0` branch of LVGL and the [Simulator](https://github.com/littlevgl/lv_sim_eclipse_sdl/tree/dev-7.0).
### Documentation
The docs for v7 is available at https://docs.littlevgl.com/v7/en/html/index.html

View File

@@ -1,5 +1,5 @@
MIT licence
Copyright (c) 2016 Gábor Kiss-Vámosi
Copyright (c) 2020 LVGL LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

259
README.md
View File

@@ -1,11 +1,11 @@
<h1 align="center"> LVGL - Little and Versatile Graphics Library</h1>
<h1 align="center"> LVGL - Light and Versatile Graphics Library</h1>
<p align="center">
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
<a href="https://github.com/littlevgl/lvgl/releases/tag/v7.0.0"><img src="https://img.shields.io/badge/version-6.1.2-blue.svg"></a>
<a href="https://github.com/lvgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
<a href="https://github.com/lvgl/lvgl/releases/tag/v7.0.0"><img src="https://img.shields.io/badge/version-7.0.0-blue.svg"></a>
</p>
<p align="center">
<img src="https://littlevgl.com/github/cover_ori_reduced_2.gif">
<img src="https://lvgl.io/assets/images/img_1.png">
</p>
<p align="center">
@@ -14,221 +14,73 @@ LVGL provides everything you need to create embedded GUI with easy-to-use graphi
<h4 align="center">
<a href="https://lvgl.io">Website </a> &middot;
<a href="https://lvgl.io/demos">Live demo</a> &middot;
<a href="https://docs.littlevgl.com/v7/en/html/get-started/pc-simulator.html">Simulator</a> &middot;
<a href="https://forum.lvgl.io">Forum</a> &middot;
<a href="https://docs.lvgl.io/">Docs</a> &middot;
<a href="https://blog.lvgl.io/">Blog</a>
<a href="https://lvgl.io/demos">Online demo</a> &middot;
<a href="https://docs.lvgl.io/">Docs</a> &middot;
<a href="https://forum.lvgl.io">Forum</a> &middot;
</h4>
---
- [Features](#features)
- [Supported devices](#supported-devices)
- [Quick start in a simulator](#quick-start-in-a-simulator)
- [Add LittlevGL to your project](#add-littlevgl-to-your-project)
- [Learn the basics](#learn-the-basics)
- [Examples](#examples)
- [Contributing](#contributing)
## Features
* **Powerful building blocks** buttons, charts, lists, sliders, images, etc.
* **Advanced graphics** with animations, anti-aliasing, opacity, smooth scrolling
* **Simultaneously use various input devices** touchscreen, mouse, keyboard, encoder, buttons, etc.
* **Simultaneously use multiple displays** i.e. monochrome and color display
* **Multi-language support** with UTF-8 encoding
* **Fully customizable** graphical elements
* **Hardware independent** to use with any microcontroller or display
* **Scalable** to operate with little memory (64 kB Flash, 10 kB RAM)
* **OS, External memory and GPU** supported but not required
* **Single frame buffer** operation even with advances graphical effects
* **Written in C** for maximal compatibility (C++ compatible)
* **Micropython Binding** exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
* **Simulator** to develop on PC without embedded hardware
* **Tutorials, examples, themes** for rapid development
* **Documentation** and API references
* Powerful building blocks: buttons, charts, lists, sliders, images, etc.
* Advanced graphics: animations, anti-aliasing, opacity, smooth scrolling
* Simultaneously use various input devices: touchscreen, mouse, keyboard, encoder, buttons, etc.
* Simultaneously use multiple displays: e.g. monochrome and color display
* Multi-language support with UTF-8 encoding, Bidirectional support, and Arabic text handling
* Fully customizable graphical elements via CSS-like styles
* Hardware independent to use with any microcontroller or display
* Scalable to operate with little memory (64 kB Flash, 10 kB RAM)
* OS, External memory and GPU are supported but not required
* Single frame buffer operation even with advances graphical effects
* Written in C for maximal compatibility (C++ compatible)
* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
* Simulator to develop on PC without embedded hardware
* Tutorials, examples, themes for rapid development
* Documentation and API references
## Supported devices
Basically, every modern controller - which is able to drive a display - is suitable to run LittlevGL. The minimal requirements:
Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are:
- 16, 32 or 64 bit microcontroller or processor
- &gt; 16 MHz clock speed is recommended
- Flash/ROM: &gt; 64 kB for the very essential components (&gt; 180 kB is recommended)
- RAM:
- Static RAM usage: ~8..16 kB depending on the used features and objects types
- Stack: &gt; 2kB (&gt; 4 kB is recommended)
- Dynamic data (heap): &gt; 4 KB (&gt; 16 kB is recommended if using several objects).
- Static RAM usage: ~2 kB depending on the used features and objects types
- Stack: &gt; 2kB (&gt; 8 kB is recommended)
- Dynamic data (heap): &gt; 2 KB (&gt; 16 kB is recommended if using several objects).
Set by `LV_MEM_SIZE` in *lv_conf.h*.
- Display buffer: &gt; *"Horizontal resolution"* pixels (&gt; 10 &times; *"Horizontal resolution"* is recommended)
- C99 or newer compiler
- C99 or newer compiler
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
Just to mention some **platforms**:
- STM32F1, STM32F3, [STM32F4](https://blog.lvgl.io/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/littlevgl/stm32f746_disco_no_os_sw4stm32)
Just to mention some platforms:
- STM32F1, STM32F3, [STM32F4](https://blog.lvgl.io/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/lvgl/lv_port_stm32f746_disco_sw4stm32), STM32L4
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
- NXP Kinetis, LPC, iMX
- NXP: Kinetis, LPC, iMX, iMX RT
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
- [Raspberry PI](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
- Nordic nrf52
- [Infineon aurix](https://github.com/lvgl/lv_port_aurix)
- Nordic NRF52
- Quectell M66
## Quick start in a simulator
The easiest way to get started with LittlevGL is to run it in a simulator on your PC without any embedded hardware.
Choose a project with your favourite IDE:
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
|-------------|-------------|---------------|-----------|------------|
| [![Eclipse](https://littlevgl.com/logo/ide/eclipse.jpg)](https://github.com/lvgl/pc_simulator_sdl_eclipse) | [![CodeBlocks](https://littlevgl.com/logo/ide/codeblocks.jpg)](https://github.com/lvgl/pc_simulator_win_codeblocks) | [![VisualStudio](https://littlevgl.com/logo/ide/visualstudio.jpg)](https://github.com/lvgl/visual_studio_2017_sdl_x64) | [![PlatformIO](https://littlevgl.com/logo/ide/platformio.jpg)](https://github.com/lvgl/pc_simulator_sdl_platformio) | [![QtCreator](https://littlevgl.com/logo/ide/qtcreator.jpg)](https://blog.lvgl.io/2019-01-03/qt-creator) |
| Cross-platform<br>with SDL<br>(Recommended on<br>Linux and Mac) | Native Windows | Windows<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
## Add LittlevGL to your project
The steps below show how to setup LVGL on an embedded system with a display and a touchpad.
You can use the [Simulators](https://docs.lvgl.io/v7/en/html/get-started/pc-simulator) to get ready to use projects which can be run on your PC.
1. [Download](https://lvgl.com/developers) or [Clone](https://github.com/lvgl/lvgl) the library
2. Copy the `lvgl` folder into your project
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. Don't forget to **change the `#if 0` statement near the top of the file to `#if 1`**, otherwise you will get compilation errors.
4. Include `lvgl/lvgl.h` where you need to use LVGL related functions.
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LVGL.
6. Call `lv_init()`
7. Create a display buffer for LVGL
```c
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10]; /*Declare a buffer for 10 lines*/
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
```
8. Implement and register a function which can **copy a pixel array** to an area of your display:
```c
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/
disp_drv.buffer = &disp_buf; /*Assign the buffer to the display*/
lv_disp_drv_register(&disp_drv); /*Finally register the driver*/
void my_disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p)
{
int32_t x, y;
for(y = area->y1; y <= area->y2; y++) {
for(x = area->x1; x <= area->x2; x++) {
set_pixel(x, y, *color_p); /* Put a pixel to the display.*/
color_p++;
}
}
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
}
```
9. Implement and register a function which can **read an input device**. E.g. for a touch pad:
```c
lv_indev_drv_init(&indev_drv); /*Descriptor of a input device driver*/
indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
/*Save the state and save the pressed coordinate*/
data->state = touchpad_is_pressed() ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y);
/*Set the coordinates (if released use the last pressed coordinates)*/
data->point.x = last_x;
data->point.y = last_y;
return false; /*Return `false` because we are not buffering and no more data to read*/
}
```
10. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task.
It will redraw the screen if required, handle input devices etc.
## Learn the basics
In this section you can ready the very basics. For a more detailed guide check the [Quick overview]
(https://docs.littlevgl.com/v7/en/html/get-started/quick-overview.html#learn-the-basics) in the documentation.
### Widgets (Objects)
The graphical elements like Buttons, Labels, Sliders, Charts etc are called objects in LittelvGL. Go to [Object types](https://docs.littlevgl.com/v7/en/html/widgets/index) to see the full list of available types.
Every object has a parent object. The child object moves with the parent and if you delete the parent the children will be deleted too. Children can be visible only on their parent.
The *screen* are the "root" parents. To get the current screen call `lv_scr_act()`.
You can create a new object with `lv_<type>_create(parent, obj_to_copy)`. It will return an `lv_obj_t *` variable which should be used as a reference to the object to set its parameters.
The first parameter is the desired *parent*, the second parameters can be an object to copy (`NULL` if unused).
For example:
```c
lv_obj_t * slider1 = lv_slider_create(lv_scr_act(), NULL);
```
To set some basic attribute `lv_obj_set_<paramters_name>(obj, <value>)` function can be used. For example:
```c
lv_obj_set_x(btn1, 30);
lv_obj_set_y(btn1, 10);
lv_obj_set_size(btn1, 200, 50);
```
The objects has type specific parameters too which can be set by `lv_<type>_set_<paramters_name>(obj, <value>)` functions. For example:
```c
lv_slider_set_value(slider1, 70, LV_ANIM_ON);
```
To see the full API visit the documentation of the object types or the related header file (e.g. `lvgl/src/lv_objx/lv_slider.h`).
### Styles
Widgets are created with a default appearance but it can be changed by adding new styles to the object. A new style can be created like this:
```c
static lv_style_t style1; /*Should be static, global or dynamically allocated*/
lv_style_init(&style1);
lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_RED); /*Default background color*/
lv_style_set_bg_color(&style1, LV_STATE_PRESSED, LV_COLOR_BLUE); /*Pressed background color*/
```
The wigedt have *parts* which can be referenced via `LV_<TYPE>_PART_<PART_NAME>`. E.g. `LV_BRN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. See the documentation of the widgets to see the exisitng parts.
To add the style to a button:
```
lv_obj_add_style(btn1, LV_BTN_PART_MAIN, &style1);
```
To remove all styles from an object use:
```c
lv_obj_reset_style_list(obj, LV_OBJ_PART_MAIN);
```
Learn more in [Style overview](https://docs.lvgl.io/v7/en/html/overview/style) section.
### Events
Events are used to inform the user if something has happened with an object. You can assign a callback to an object which will be called if the object is clicked, released, dragged, being deleted etc. It should look like this:
```c
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
...
void btn_event_cb(lv_obj_t * btn, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
}
}
```
Learn more about the events in the [Event overview](https://docs.littlevgl.com/en/html/overview/event) section.
## Get started
his list shows the recommended way of learning the library:
1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes)
2. Read the [Introduction](https://docs.lvgl.io/latest/en/html/intro/index.html) page of the documentation (5 minutes)
3. Read the [Quick overview](https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html) page of the documentation (15 minutes)
4. Set up a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) (10 minutes)
5. Try out some [Examples](https://github.com/lvgl/lv_examples/)
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/latest/en/html/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=)
7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library. (2-3 hours)
8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage
9. If you have questions got to the [Forum](http://forum.lvgl.io/)
10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes)
## Examples
For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository.
### Button with label
```c
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
@@ -248,9 +100,9 @@ void btn_event_cb(lv_obj_t * btn, lv_event_t event)
}
}
```
![LVGL button with label example](https://docs.lvgl.io/v7/en/misc/simple_button_example.gif)
![LVGL button with label example](https://raw.githubusercontent.com/lvgl/docs/latest/misc/simple_button_example.gif)
### Use LVGL from Micropython
### LVGL from Micropython
Learn more about [Micropython](https://docs.lvgl.io/en/html/get-started/micropython).
```python
# Create a Button and a Label
@@ -265,17 +117,4 @@ lv.scr_load(scr)
```
## Contributing
To ask questions please use the [Forum](https://forum.lvgl.io).
For development-related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/lvgl/lvgl/issues).
If you are interested in contributing to LVGL you can
- **Help others** in the [Forum](https://forum.lvgl.io).
- **Inspire people** by speaking about your project in [My project](https://forum.lvgl.io/c/my-projects) category in the Forum.
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/lvgl/docs) repository to learn more
- **Write a blog post** about your experiences. See how to do it in the [Blog](https://github.com/littlevgl/blog) repository
- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues)
- **Help in the developement**. Check the [Open issues](https://github.com/lvgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/lvgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature.
Before sending Pull requests, please read the following guides:
- [Contributing guide](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md)
- [Coding style guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.

View File

@@ -1,6 +1,7 @@
# Coding style
## File format
Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/littlevgl/lvgl/blob/master/src/lv_misc/lv_templ.h)
Use [lv_misc/lv_templ.c](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.h)
## Naming conventions
* Words are separated by '_'
@@ -15,17 +16,18 @@ Use [lv_misc/lv_templ.c](https://github.com/littlevgl/lvgl/blob/master/src/lv_mi
* prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name`
* always end `typedef struct` and `typedef enum` type names with `_t`
* Abbreviations:
* Use abbreviations on public names only if they become longer than 32 characters
* Use only very straightforward (e.g. pos: position) or well-established (e.g. pr: press) abbreviations
* Only words longer or equal than 6 characters can be abbreviated.
* Abbreviate only if it makes the word at least half as long
* Use only very straightforward and well-known abbreviations (e.g. pos: position, def: default, btn: button)
## Coding guide
* Functions:
* Try to write function shorter than is 50 lines
* Always shorter than 100 lines (except very straightforwards)
* Always shorter than 200 lines (except very straightforwards)
* Variables:
* One line, one declaration (BAD: char x, y;)
* Use `<stdint.h>` (*uint8_t*, *int32_t* etc)
* Declare variables when needed (not all at function start)
* Declare variables where needed (not all at function start)
* Use the smallest required scope
* Variables in a file (outside functions) are always *static*
* Do not use global variables (use functions to set/get static variables)
@@ -84,11 +86,4 @@ void lv_label_set_text(lv_obj_t * label, const char * text)
Use 4 spaces indentation instead of tab.
You can use **astyle** to format the code. The required config flies are: `docs/astyle_c` and `docs/astyle_h`.
To format the source files:
`$ find . -type f -name "*.c" | xargs astyle --options=docs/astyle_c`
To format the header files:
`$ find . -type f -name "*.h" | xargs astyle --options=docs/astyle_h`
Append `-n` to the end to skip creation of backup file OR use `$ find . -type f -name "*.bak" -delete` (for source file's backups) and `find . -type f -name "*.orig" -delete` (for header file's backups)
You can use **astyle** to format the code. Run `code-formatter.sh` from the `scrips` folder.

View File

@@ -1,114 +1,5 @@
# Contributing to LVGL
**Do you have some free time to spend with programming?
Are you working on an Embedded GUI project with LittlevGL?
See how can you help to improve the graphics library!**
Thank you for considering contributing to LVGL.
There are many ways to join the community. If you have some time to work with us I'm sure you will find something that fits you! You can:
- **Help others** in the [Forum](https://forum.lvgl.io).
- **Inspire people** by speaking about your project in [My project](https://forum.lvgl.io/c/my-projects) category in the Forum.
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/lvgl/docs) repository to learn more
- **Write a blog post** about your experiences. See how to do it in the [Blog](https://github.com/littlevgl/blog) repository
- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues)
- **Help in the developement**. Check the [Open issues](https://github.com/lvgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/lvgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature.
But first, start with the most Frequently Asked Questions.
# FAQ about contributing
## Where can I write my question and remarks?
We use the [Forum](https://forum.lvgl.io/) to ask and answer questions and [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues) for development-related discussion.
We have some simple rules:
- Be kind and friendly.
- Speak about one thing in one issue/topic.
- Give feedback and close the issue or mark the topic as solved if your question is answered.
- Tell what you experience or expect. _"The button is not working"_ is not enough info to get help.
- If possible send an absolute minimal code example in order to reproduce the issue
- Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to format your post.
## How can I send fixes and improvements?
Merging new code happens via Pull Requests. If you are still not familiar with the Pull Requests (PR for short) here is a quick guide:
1. **Fork** the [lvgl repository](https://github.com/lvgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`)
2. **Clone** the forked repository and add your changes
3. **Create a PR** on GitHub from the page of your `lvgl` repository (`https://github.com/your_name/lvgl`) by hitting the "New pull request" button
4. **Set the base branch**. It means where you want to merge your update. Fixes go to `master`, new features to feature branch.
5. **Describe** what is in the update. An example code is welcome if applicable.
Some advice:
- For non-trivial fixes and features it's better open an issue first to discuss the details.
- Maybe your fix or update won't be perfect at first. Don't be afraid, just improve it and push the new commits. The PR will be updated accordingly.
- If your update needs some extra work it's okay to say: _"I'm busy now and I will improve it soon"_ or _"Sorry, I don't have time to improve it, I hope it helps in this form too"_.
So it's better to say don't have time to continue than saying nothing.
- Please read and follow this [guide about the coding style](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
If you implemented a new feature it's important to record it in the documentation and if applicable create an example for it:
- Go to the [docs](https://github.com/littlevgl/docs/tree/master/v7/en) repository and update the relevant part of the English documentation.
- Go to the [examples](https://github.com/littlevgl/lv_examples) repository and add a new file about the new feature i nthe related directory.
## Where is the documentation?
You can read the documentation here: <https://docs.lvgl.io/v7>
You can edit the documentation here: <https://github.com/lvgl/doc>
# So how and where can you contribute?
## Help others in the Forum
It's a great way to contribute to the library if you already use it.
Just go to [https://forum.lvgl.io/](https://forum.lvgl.io/) a register (Google and GitHub login also works).
Log in, read the titles and if you are already familiar with a topic, don't be shy, and write your suggestion.
## Improving and/or translating the documentation
If you would like to contribute to LVGL the documentation is the best place to start.
### Fix typos, add missing parts
If you find a typo, an obscure sentence or something which is not explained well enough in the [English documentation](https://docs.lvgl.io/en/html/index.html)
click the *"Edit on GitHub"* button in the top right corner and fix the issue by sending a Pull Request.
### Translate the documentation
If you have time and interest you can translate the documentation to your native language or any language you speak well.
You can join others to work on an already existing language or you can start a new one.
To translate the documentation we use [Zanata](https://zanata.org) which is an online translation platform.
You will find the LVGL project here: [LVGL on Zanata](https://translate.zanata.org/iteration/view/littlevgl-docs/v6.0-doc1?dswid=3430)
To get started you need to:
- register at [Zanata](https://zanata.org) which is an online translation platform.
- comment to [this post](https://forum.lvgl.io/t/translate-the-documentation/238?u=kisvegabor)
- tell your username at *Zanata* and your selected language(s) to get permission the edit the translations
Note that a translation will be added to the documentation only if the following parts are translated:
- [Home page](https://docs.lvgl.io/en/v7/)
- [Porting section](https://docs.lvgl.io/en/v7/html/porting/index.html)
- [Quick overview](https://docs.lvgl.io/v7/en/html/get-started/quick-overview.html)
## Writing a blog post about your experiences
Have you ported LVGL to a new platform? Have you created a fancy GUI? Do you know a great trick?
You can share your knowledge on LVGL's blog! It's super easy to add your own post:
- Fork and clone the [blog repository](https://github.com/lvgl/blog)
- Add your post in Markdown to the `_posts` folder.
- Store the images and other resources in a dedicated folder in `assets`
- Create a Pull Request
The blog uses [Jekyll](https://jekyllrb.com/) to convert the `.md` files to a webpage. You can easily [run Jekyll offline](https://jekyllrb.com/docs/) to check your post before creating the Pull request
## Reporting and/or fixing bugs
For simple bugfixes (typos, missing error handling, fixing a warning) is fine to send a Pull request directly. However, for more complex bugs it's better to open an issue first. In the issue, you should describe how to reproduce the bug and even add the minimal code snippet.
## Suggesting and/or implementing new features
If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LVGL well enough. We will help you to get started.
During the implementation don't forget the [Code style guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md).
# Summary
I hope you have taken a liking to contribute to LVGL. A helpful and friendly community is waiting for you! :)
For a detailed description of contribution opportunities, please visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.

View File

@@ -0,0 +1,119 @@
#include <lvgl.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10];
#if USE_LV_LOG != 0
/* Serial debugging */
void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
{
Serial.printf("%s@%d->%s\r\n", file, line, dsc);
Serial.flush();
}
#endif
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
tft.pushColors(&color_p->full, w * h, true);
tft.endWrite();
lv_disp_flush_ready(disp);
}
/*Read the touchpad*/
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
{
uint16_t touchX, touchY;
bool touched = tft.getTouch(&touchX, &touchY, 600);
if(!touched)
{
data->state = LV_INDEV_STATE_REL;
return false;
}
else
{
data->state = LV_INDEV_STATE_PR;
}
if(touchX>screenWidth || touchY > screenHeight)
{
Serial.println("Y or y outside of expected parameters..");
Serial.print("y:");
Serial.print(touchX);
Serial.print(" x:");
Serial.print(touchY);
}
else
{
/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;
Serial.print("Data x");
Serial.println(touchX);
Serial.print("Data y");
Serial.println(touchY);
}
return false; /*Return `false` because we are not buffering and no more data to read*/
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
lv_init();
#if USE_LV_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif
tft.begin(); /* TFT init */
tft.setRotation(1); /* Landscape orientation */
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
tft.setTouch(calData);
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
/*Initialize the display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = 320;
disp_drv.ver_res = 240;
disp_drv.flush_cb = my_disp_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
/*Initialize the (dummy) input device driver*/
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
/* Try an example from the lv_examples repository
* https://github.com/lvgl/lv_examples*/
lv_ex_btn_1();
}
void loop()
{
lv_task_handler(); /* let the GUI do its work */
delay(5);
}

View File

@@ -0,0 +1,44 @@
# Example for lv_arduino using a slider
This example has the screen set to 320x480 (ILI9488), change this by altering the following lines in the main ino file:
```C
int screenWidth = 480;
int screenHeight = 320;
```
## Backlight
Change pin 32 to your preferred backlight pin using a PNP transistor (2N3906) or remove the following code and connect directly to +ve:
```C
ledcSetup(10, 5000/*freq*/, 10 /*resolution*/);
ledcAttachPin(32, 10);
analogReadResolution(10);
ledcWrite(10,768);
```
## Theme selection
Change the following to change the theme:
```C
lv_theme_t * th = lv_theme_night_init(210, NULL); //Set a HUE value and a Font for the Night Theme
lv_theme_set_current(th);
```
## Calibration
This is using the bodmer tft_espi driver for touch. To correctly set the calibration load the calibration sketch and replace the following with your values:
```C
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
```
## Screen rotation
Check the following if you need to alter your screen rotation:
```C
tft.setRotation(3);
```

View File

@@ -0,0 +1,37 @@
# LVGL Arduino examples
LVGL can be installed via Arduino IDE Library Manager or as an .ZIP library.
It will install [lv_exmaples](https://github.com/lvgl/lv_examples) which contains a lot of examples and demos to try LVGL.
## Example
There are simple examples which use the [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) library as a TFT driver to simplify testing.
To get all this to work you have to setup TFT_eSPI to work with your TFT display type via editing the `User_Setup.h` file in TFT_eSPI library folder, or by selecting your own configurtion in the `User_Setup_Select.h` file in TFT_eSPI library folder.
LVGL library has its own configuration file called `lv_conf.h`. When LVGL is installed to followings needs to be done to configure it:
1. Go to directory of the installed Arduno libraries
2. Go to `lvgl` and copy `lv_conf_template.h` as `lvgl.h` next to the `lvgl` folder.
3. Open `lv_conf.h` and change the first `#if 0` to `#if 1`
4. Set the resolution of your display in `LV_HOR_RES_MAX` and `LV_VER_RES_MAX`
5. Set the color depth of you display in `LV_COLOR_DEPTH`
6. Set `LV_TICK_CUSTOM 1`
## Debugging
In case of trouble there are debug informations inside LVGL. In the `ESP32_TFT_eSPI` example there is `my_print` method, which allow to send this debug informations to the serial interface. To enable this feature you have to edit `lv_conf.h` file and enable logging in section `log settings`:
```c
/*Log settings*/
#define USE_LV_LOG 1 /*Enable/disable the log module*/
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
```
After enabling log module and setting LV_LOG_LEVEL accordingly the output log is sent to the `Serial` port @ 115200 Bd.

View File

@@ -1,6 +1,6 @@
{
"name": "lvgl",
"version": "v7.0.0",
"version": "v7.1.0",
"keywords": "graphics, gui, embedded, littlevgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository":

View File

@@ -1,6 +1,6 @@
/**
* @file lv_conf.h
*
* Configuration file for LVGL v7.1.0
*/
/*
@@ -25,7 +25,7 @@
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 8: RGB332
* - 16: RGB565
* - 32: ARGB8888
*/
@@ -178,6 +178,9 @@ typedef void * lv_group_user_data_t;
/* 1: Enable GPU interface*/
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
#define LV_USE_GPU_STM32_DMA2D 0
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
#define LV_GPU_DMA2D_CMSIS_INCLUDE
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
@@ -219,6 +222,10 @@ typedef void * lv_img_decoder_user_data_t;
/*=====================
* Compiler settings
*====================*/
/* For big endian systems set to 1 */
#define LV_BIG_ENDIAN_SYSTEM 0
/* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TICK_INC
@@ -249,6 +256,10 @@ typedef void * lv_img_decoder_user_data_t;
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
/* Prefix variables that are used in GPU accelerated operations, often these need to be
* placed in RAM sections that are DMA accessible */
#define LV_ATTRIBUTE_DMA
/*===================
* HAL settings
*==================*/
@@ -257,8 +268,8 @@ typedef void * lv_img_decoder_user_data_t;
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 0
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
@@ -330,7 +341,7 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.lvgl.com/#Fonts
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
*/
@@ -417,8 +428,8 @@ typedef void * lv_font_user_data_t;
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16
@@ -478,6 +489,8 @@ typedef void * lv_font_user_data_t;
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#else /*!LV_SPRINTF_CUSTOM*/
# define LV_SPRINTF_DISABLE_FLOAT 1
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
@@ -496,7 +509,7 @@ typedef void * lv_obj_user_data_t;
#endif
#endif
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.

4
lvgl.h
View File

@@ -77,9 +77,9 @@ extern "C" {
*********************/
/*Current version of LVGL*/
#define LVGL_VERSION_MAJOR 7
#define LVGL_VERSION_MINOR 0
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO ""
#define LVGL_VERSION_INFO ""
/**********************
* TYPEDEFS

Binary file not shown.

Binary file not shown.

View File

@@ -2,6 +2,12 @@
import os
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c')
exit()
print("Generating 12 px")
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12.c')
@@ -87,7 +93,7 @@ os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28_compressed.
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28_compressed.c')
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SIMSUN.ttf -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c')
print("Generating 16 px Hebrew, Persian")

View File

@@ -1,12 +1,17 @@
#!/usr/bin/env python3.6
#!/usr/bin/env python3
'''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
'''
import sys
import re
if sys.version_info < (3,6,0):
print("Python >=3.6 is required", file=sys.stderr)
exit(1)
fin = open("../lv_conf_template.h", "r")
fout = open("../src/lv_conf_internal.h", "w")

View File

@@ -11,29 +11,28 @@ def title(t):
def cmd(c):
print("\n" + c)
os.system(c)
def increment(s):
""" look for the last sequence of number(s) in a string and increment """
m = lastNum.search(s)
if m:
next = str(int(m.group(1))+1)
start, end = m.span(1)
s = s[:max(end-len(next), start)] + next + s[end:]
return s, str(next)
r = os.system(c)
if r:
print("Exit due to previous error")
exit(r)
def lvgl_clone():
title("lvgl: Clone")
cmd("git clone https://github.com/littlevgl/lvgl.git")
cmd("git clone https://github.com/lvgl/lvgl.git")
os.chdir("./lvgl")
cmd("git co master")
def lvgl_format():
title("lvgl: Run code formatter")
os.chdir("./scripts")
cmd("./code-format.sh")
cmd("git ci -am 'Run code formatter'")
os.chdir("..")
def lvgl_update_version():
title("lvgl: Update version number")
f = open("./src/lv_version.h", "r")
f = open("./lvgl.h", "r")
outbuf = ""
major_ver = -1
@@ -53,7 +52,8 @@ def lvgl_update_version():
r = re.search(r'^#define LVGL_VERSION_PATCH ', i)
if r:
i, patch_ver = increment(i)
m = lastNum.search(i)
if m: patch_ver = m.group(1)
r = re.search(r'^#define LVGL_VERSION_INFO ', i)
@@ -64,7 +64,7 @@ def lvgl_update_version():
f.close()
f = open("./src/lv_version.h", "w")
f = open("./lvgl.h", "w")
f.write(outbuf)
f.close()
@@ -96,6 +96,11 @@ def lvgl_update_library_json(v):
f.write(outbuf)
f.close()
def lvgl_update_lv_conf_templ(ver_str):
title("lvgl: Update version number in lv_conf_template.h")
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' lv_conf_template.h ")
def lvgl_commit_push(v):
title("lvgl: commit and push release")
@@ -103,6 +108,15 @@ def lvgl_commit_push(v):
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
cmd('git push origin master')
cmd('git push origin ' + v)
def lvgl_merge_to_release_branch(v):
title("lvgl: merge to release branch")
cmd('git co release/v7')
cmd('git merge master')
cmd('git push origin release/v7')
os.chdir("../")
def lvgl_update_api_docs():
title("lvgl: Update API with Doxygen")
@@ -110,19 +124,63 @@ def lvgl_update_api_docs():
cmd("cd scripts; doxygen");
def examples_clone():
title("examples: Clone")
cmd("git clone https://github.com/lvgl/lv_examples.git")
os.chdir("./lv_examples")
cmd("git co master")
def examples_commit_push(v):
title("examples: commit and push release")
cmd('git ci -am "Release ' + v + '"')
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
cmd('git push origin master')
cmd('git push origin ' + v)
def examples_merge_to_release_branch(v):
title("examples: merge to release branch")
cmd('git co release/v7')
cmd('git merge master')
cmd('git push origin release/v7')
os.chdir("../")
def drivers_clone():
title("drivers: Clone")
cmd("git clone https://github.com/lvgl/lv_drivers.git")
os.chdir("./lv_drivers")
cmd("git co master")
def drivers_commit_push(v):
title("drivers: commit and push release")
cmd('git ci -am "Release ' + v + '"')
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
cmd('git push origin master')
cmd('git push origin ' + v)
def drivers_merge_to_release_branch(v):
title("drivers: merge to release branch")
cmd('git co release/v7')
cmd('git merge master')
cmd('git push origin release/v7')
os.chdir("../")
def docs_clone():
title("docs: Clone")
os.chdir("../")
cmd("git clone --recursive https://github.com/littlevgl/docs.git")
cmd("git clone --recursive https://github.com/lvgl/docs.git")
os.chdir("./docs")
cmd("git co master")
def docs_get_api():
title("docs: Get API files")
cmd("git co latest")
cmd("rm -rf xml");
cmd("cp -r ../lvgl/docs/api_doc/xml .");
cmd("cp -r ../../lvgl/docs/api_doc/xml .");
cmd("git add xml");
cmd('git commit -m "update API"')
def docs_update_version(v):
title("docs: Update version number")
@@ -148,6 +206,8 @@ def docs_update_version(v):
f.write(outbuf)
f.close()
cmd("git add conf.py")
cmd('git ci -m "update conf.py to ' + v '"')
def docs_update_trans():
title("docs: Update translations")
@@ -155,34 +215,35 @@ def docs_update_trans():
def docs_build():
title("docs: Build")
cmd("./build.py clean")
def docs_commit_push(v):
title("docs: Commit release")
cmd('git add .')
cmd('git ci -am "Release ' + v + '"')
cmd('git tag -a ' + v + ' -m "Release ' + v +'"')
cmd('git push origin master')
cmd('git push origin ' + v)
cmd("git checkout master")
cmd("./update.py latest")
def clean_up():
title("Clean up repos")
os.chdir("..")
cmd("rm -rf lvgl docs")
os.chdir("../..")
cmd("rm -rf lvgl docs lv_examples lv_drivers")
lvgl_clone()
lvgl_format()
lvgl_update_api_docs()
ver_str = lvgl_update_version()
lvgl_update_library_json(ver_str)
lvgl_update_library_json(ver_str)
lvgl_update_lv_conf_templ(ver_str)
lvgl_commit_push(ver_str)
lvgl_merge_to_release_branch(ver_str)
examples_clone()
examples_commit_push(ver_str)
examples_merge_to_release_branch(ver_str)
drivers_clone()
drivers_commit_push(ver_str)
drivers_merge_to_release_branch(ver_str)
docs_clone()
docs_get_api()
docs_update_version(ver_str)
docs_update_trans()
#docs_update_trans() # Zanata is not working now
docs_build()
docs_commit_push(ver_str)
clean_up()

View File

@@ -153,7 +153,7 @@ static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w)
#define lv_scrlbar_mode_t lv_scrollbar_mode_t
#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF
#define LV_SCRLBAR_MODE_ON LV_SCRILLBAR_MODE_ON
#define LV_SCRLBAR_MODE_ON LV_SCROLLBAR_MODE_ON
#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG
#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO
#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE
@@ -172,10 +172,19 @@ static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page)
static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
{
return lv_page_get_scrllable(page);
return lv_page_get_scrollable(page);
}
#endif
#if LV_USE_WIN
static inline lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src)
{
return lv_win_add_btn_right(win, img_src);
}
#endif
#endif /*LV_USE_API_EXTENSION_V6*/
/**********************

View File

@@ -40,7 +40,7 @@
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB233
* - 8: RGB332
* - 16: RGB565
* - 32: ARGB8888
*/
@@ -266,6 +266,11 @@
#ifndef LV_USE_GPU_STM32_DMA2D
#define LV_USE_GPU_STM32_DMA2D 0
#endif
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
#ifndef LV_GPU_DMA2D_CMSIS_INCLUDE
#define LV_GPU_DMA2D_CMSIS_INCLUDE
#endif
/* 1: Enable file system (might be required for images */
#ifndef LV_USE_FILESYSTEM
@@ -319,6 +324,12 @@
/*=====================
* Compiler settings
*====================*/
/* For big endian systems set to 1 */
#ifndef LV_BIG_ENDIAN_SYSTEM
#define LV_BIG_ENDIAN_SYSTEM 0
#endif
/* Define a custom attribute to `lv_tick_inc` function */
#ifndef LV_ATTRIBUTE_TICK_INC
#define LV_ATTRIBUTE_TICK_INC
@@ -363,6 +374,12 @@
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
#endif
/* Prefix variables that are used in GPU accelerated operations, often these need to be
* placed in RAM sections that are DMA accessible */
#ifndef LV_ATTRIBUTE_DMA
#define LV_ATTRIBUTE_DMA
#endif
/*===================
* HAL settings
*==================*/
@@ -374,10 +391,10 @@
#endif
#if LV_TICK_CUSTOM == 1
#ifndef LV_TICK_CUSTOM_INCLUDE
#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#endif
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif
#endif /*LV_TICK_CUSTOM*/
@@ -468,7 +485,7 @@
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.lvgl.com/#Fonts
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
*/
@@ -621,10 +638,10 @@
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#endif
#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY
#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#endif
#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY
#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#endif
#ifndef LV_THEME_DEFAULT_FLAG
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
@@ -721,6 +738,10 @@
#ifndef lv_vsnprintf
# define lv_vsnprintf vsnprintf
#endif
#else /*!LV_SPRINTF_CUSTOM*/
#ifndef LV_SPRINTF_DISABLE_FLOAT
# define LV_SPRINTF_DISABLE_FLOAT 1
#endif
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
@@ -744,7 +765,7 @@
#endif
#endif
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
#ifndef LV_USE_OBJ_REALIGN
#define LV_USE_OBJ_REALIGN 1
#endif

View File

@@ -4,7 +4,6 @@ CSRCS += lv_disp.c
CSRCS += lv_obj.c
CSRCS += lv_refr.c
CSRCS += lv_style.c
CSRCS += lv_debug.c
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core

View File

@@ -9,7 +9,7 @@
#include "lv_group.h"
#if LV_USE_GROUP != 0
#include <stddef.h>
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_gc.h"
@@ -242,7 +242,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
if(res != LV_RES_OK) return;
lv_obj_invalidate(*g->obj_focus);
/*If the object or its parent has `top == true` bring it to the foregorund*/
/*If the object or its parent has `top == true` bring it to the foreground*/
obj_to_foreground(*g->obj_focus);
}
break;
@@ -508,7 +508,7 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
lv_res_t res = lv_event_send(*group->obj_focus, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return;
/*If the object or its parent has `top == true` bring it to the foregorund*/
/*If the object or its parent has `top == true` bring it to the foreground*/
obj_to_foreground(*group->obj_focus);
lv_obj_invalidate(*group->obj_focus);

View File

@@ -155,7 +155,7 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c);
void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb);
/**
* Set whether the next or previous item in a group is focused if the currently focussed obj is
* Set whether the next or previous item in a group is focused if the currently focused obj is
* deleted.
* @param group pointer to a group
* @param new refocus policy enum

View File

@@ -607,8 +607,163 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
indev_obj_act = lv_group_get_focused(g);
if(indev_obj_act == NULL) return;
/*Process the steps first. They are valid only with released button*/
if(data->state == LV_INDEV_STATE_REL) {
/*Process the steps they are valid only with released button*/
if(data->state != LV_INDEV_STATE_REL) {
data->enc_diff = 0;
}
/*Refresh the focused object. It might change due to lv_group_focus_prev/next*/
indev_obj_act = lv_group_get_focused(g);
if(indev_obj_act == NULL) return;
/*Button press happened*/
if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) {
i->proc.pr_timestamp = lv_tick_get();
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
if(lv_group_get_editing(g) == true || editable == false) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
}
}
else if(data->key == LV_KEY_LEFT) {
/*emulate encoder left*/
data->enc_diff--;
}
else if(data->key == LV_KEY_RIGHT) {
/*emulate encoder right*/
data->enc_diff++;
}
else if(data->key == LV_KEY_ESC) {
/*Send the ESC as a normal KEY*/
lv_group_send_data(g, LV_KEY_ESC);
lv_event_send(indev_obj_act, LV_EVENT_CANCEL, NULL);
if(indev_reset_check(&i->proc)) return;
}
/*Just send other keys to the object (e.g. 'A' or `LV_GROUP_KEY_RIGHT`)*/
else {
lv_group_send_data(g, data->key);
}
}
/*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_PR) {
/* Long press*/
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
i->proc.long_pr_sent = 1;
i->proc.longpr_rep_timestamp = lv_tick_get();
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
/*On enter long press toggle edit mode.*/
if(editable) {
/*Don't leave edit mode if there is only one object (nowhere to navigate)*/
if(_lv_ll_is_empty(&g->obj_ll) == false) {
lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/
}
}
/*If not editable then just send a long press signal*/
else {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
}
}
i->proc.long_pr_sent = 1;
}
/*Long press repeated time has elapsed?*/
else if(i->proc.long_pr_sent != 0 && lv_tick_elaps(i->proc.longpr_rep_timestamp) > i->driver.long_press_rep_time) {
i->proc.longpr_rep_timestamp = lv_tick_get();
if(data->key == LV_KEY_ENTER) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS_REP, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
if(indev_reset_check(&i->proc)) return;
}
else if(data->key == LV_KEY_LEFT) {
/*emulate encoder left*/
data->enc_diff--;
}
else if(data->key == LV_KEY_RIGHT) {
/*emulate encoder right*/
data->enc_diff++;
}
else {
lv_group_send_data(g, data->key);
if(indev_reset_check(&i->proc)) return;
}
}
}
/*Release happened*/
else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) {
if(data->key == LV_KEY_ENTER) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
/*The button was released on a non-editable object. Just send enter*/
if(editable == false) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
}
/*An object is being edited and the button is released. */
else if(g->editing) {
/*Ignore long pressed enter release because it comes from mode switch*/
if(!i->proc.long_pr_sent || _lv_ll_is_empty(&g->obj_ll)) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_group_send_data(g, LV_KEY_ENTER);
}
}
/*If the focused object is editable and now in navigate mode then on enter switch edit
mode*/
else if(editable && !g->editing && !i->proc.long_pr_sent) {
lv_group_set_editing(g, true); /*Set edit mode*/
}
}
i->proc.pr_timestamp = 0;
i->proc.long_pr_sent = 0;
}
indev_obj_act = NULL;
/*if encoder steps or simulated steps via left/right keys*/
if(data->enc_diff != 0) {
/*In edit mode send LEFT/RIGHT keys*/
if(lv_group_get_editing(g)) {
int32_t s;
@@ -631,96 +786,6 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
}
}
/*Refresh the focused object. It might change due to lv_group_focus_prev/next*/
indev_obj_act = lv_group_get_focused(g);
if(indev_obj_act == NULL) return;
/*Button press happened*/
if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_REL) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
i->proc.pr_timestamp = lv_tick_get();
if(lv_group_get_editing(g) == true || editable == false) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
}
}
/*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && last_state == LV_INDEV_STATE_PR) {
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
/*On enter long press toggle edit mode.*/
if(editable) {
/*Don't leave edit mode if there is only one object (nowhere to navigate)*/
if(_lv_ll_is_empty(&g->obj_ll) == false) {
lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/
}
}
/*If not editable then just send a long press signal*/
else {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_LONG_PRESS, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_LONG_PRESSED, NULL);
if(indev_reset_check(&i->proc)) return;
}
i->proc.long_pr_sent = 1;
}
}
/*Release happened*/
else if(data->state == LV_INDEV_STATE_REL && last_state == LV_INDEV_STATE_PR) {
bool editable = false;
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_GET_EDITABLE, &editable);
/*The button was released on a non-editable object. Just send enter*/
if(editable == false) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
if(i->proc.long_pr_sent == 0) lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
}
/*An object is being edited and the button is released. */
else if(g->editing) {
/*Ignore long pressed enter release because it comes from mode switch*/
if(!i->proc.long_pr_sent || _lv_ll_is_empty(&g->obj_ll)) {
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_SHORT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_CLICKED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_RELEASED, NULL);
if(indev_reset_check(&i->proc)) return;
lv_group_send_data(g, LV_KEY_ENTER);
}
}
/*If the focused object is editable and now in navigate mode then on enter switch edit
mode*/
else if(editable && !g->editing && !i->proc.long_pr_sent) {
lv_group_set_editing(g, true); /*Set edit mode*/
}
i->proc.pr_timestamp = 0;
i->proc.long_pr_sent = 0;
}
indev_obj_act = NULL;
#else
(void)data; /*Unused*/
(void)i; /*Unused*/
@@ -791,7 +856,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
&proc->types.pointer.act_point);
new_obj_searched = true;
}
/*If a dragable or a protected object was the last then keep it*/
/*If a draggable or a protected object was the last then keep it*/
else {
}
@@ -1049,7 +1114,7 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev)
/**
* Search the most top, clickable object by a point
* @param obj pointer to a start object, typically the screen
* @param point pointer to a point for searhing the most top child
* @param point pointer to a point for searching the most top child
* @return pointer to the found object or NULL if there was no suitable object
*/
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
@@ -1086,14 +1151,15 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
}
/**
* Handle focus/defocus on click for POINTER inpt devices
* Handle focus/defocus on click for POINTER input devices
* @param proc pointer to the state of the indev
*/
static void indev_click_focus(lv_indev_proc_t * proc)
{
/*Handle click focus*/
lv_obj_t * obj_to_focus = lv_obj_get_focused_obj(indev_obj_act);
if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false &&
proc->types.pointer.last_pressed != indev_obj_act) {
proc->types.pointer.last_pressed != obj_to_focus) {
#if LV_USE_GROUP
lv_group_t * g_act = lv_obj_get_group(indev_obj_act);
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
@@ -1122,11 +1188,6 @@ static void indev_click_focus(lv_indev_proc_t * proc)
}
/*The object are not in the same group (in different group or one in not a group)*/
else {
/*Focus to the act. its group*/
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
}
/*If the prev. obj. is not in a group then defocus it.*/
if(g_prev == NULL && proc->types.pointer.last_pressed) {
lv_signal_send(proc->types.pointer.last_pressed, LV_SIGNAL_DEFOCUS, NULL);
@@ -1152,7 +1213,14 @@ static void indev_click_focus(lv_indev_proc_t * proc)
if(indev_reset_check(proc)) return;
}
}
}
/*Focus to the act. in its group*/
if(g_act) {
lv_group_focus_obj(indev_obj_act);
if(indev_reset_check(proc)) return;
}
else {
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
if(indev_reset_check(proc)) return;
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
@@ -1172,7 +1240,7 @@ static void indev_click_focus(lv_indev_proc_t * proc)
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
if(indev_reset_check(proc)) return;
#endif
proc->types.pointer.last_pressed = indev_obj_act;
proc->types.pointer.last_pressed = obj_to_focus;
}
}
@@ -1399,7 +1467,7 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
/**
* Get the really dragged object by taking `drag_parent` into account.
* @param obj the start obejct
* @param obj the start object
* @return the object to really drag
*/
static lv_obj_t * get_dragged_obj(lv_obj_t * obj)
@@ -1426,13 +1494,14 @@ static void indev_gesture(lv_indev_proc_t * proc)
lv_obj_t * gesture_obj = proc->types.pointer.act_obj;
/*If gesture parent is active check recursively the drag_parent attribute*/
/*If gesture parent is active check recursively the gesture attribute*/
while(gesture_obj && lv_obj_get_gesture_parent(gesture_obj)) {
gesture_obj = lv_obj_get_parent(gesture_obj);
}
if(gesture_obj == NULL) return;
if((LV_MATH_ABS(proc->types.pointer.vect.x) < indev_act->driver.gesture_min_velocity) &&
(LV_MATH_ABS(proc->types.pointer.vect.y) < indev_act->driver.gesture_min_velocity)) {
proc->types.pointer.gesture_sum.x = 0;

View File

@@ -160,7 +160,7 @@ lv_obj_t * lv_indev_get_obj_act(void);
/**
* Search the most top, clickable object by a point
* @param obj pointer to a start object, typically the screen
* @param point pointer to a point for searhing the most top child
* @param point pointer to a point for searching the most top child
* @return pointer to the found object or NULL if there was no suitable object
*/
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);

View File

@@ -11,7 +11,7 @@
#include "lv_refr.h"
#include "lv_group.h"
#include "lv_disp.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_anim.h"
@@ -38,6 +38,10 @@
#include LV_THEME_DEFAULT_INCLUDE
#if LV_USE_GPU_STM32_DMA2D
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#endif
/*********************
* DEFINES
*********************/
@@ -92,6 +96,7 @@ static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
static void fade_in_anim_ready(lv_anim_t * a);
#endif
static void lv_event_mark_deleted(lv_obj_t * obj);
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
static void lv_obj_del_async_cb(void * obj);
static void obj_del_core(lv_obj_t * obj);
@@ -139,8 +144,16 @@ void lv_init(void)
_lv_group_init();
#endif
#if LV_USE_GPU_STM32_DMA2D
/*Initialize DMA2D GPU*/
lv_gpu_stm32_dma2d_init();
#endif
_lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(lv_style_trans_t));
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY,
LV_THEME_DEFAULT_FLAG,
LV_THEME_DEFAULT_FONT_SMALL, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE, LV_THEME_DEFAULT_FONT_TITLE);
@@ -149,15 +162,20 @@ void lv_init(void)
/*Initialize the screen refresh system*/
_lv_refr_init();
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
/*Init the input device handling*/
_lv_indev_init();
_lv_img_decoder_init();
lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE);
/*Test if the IDE has UTF-8 encoding*/
char * txt = "Á";
uint8_t * txt_u8 = (uint8_t *) txt;
if(txt_u8[0] != 0xc3 || txt_u8[1] != 0x81 || txt_u8[2] != 0x00) {
LV_LOG_WARN("The strings has no UTF-8 encoding. Some characters won't be displayed.")
}
lv_initialized = true;
LV_LOG_INFO("lv_init ready");
}
@@ -171,16 +189,16 @@ void lv_init(void)
void lv_deinit(void)
{
_lv_gc_clear_roots();
#if LV_USE_LOG
lv_log_register_print_cb(NULL);
#endif
lv_disp_set_default(NULL);
_lv_mem_deinit();
lv_initialized = false;
LV_LOG_INFO("lv_deinit done");
#if LV_USE_LOG
lv_log_register_print_cb(NULL);
#endif
LV_LOG_INFO("lv_deinit done");
}
#endif
@@ -297,6 +315,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
#if LV_USE_GROUP
new_obj->group_p = NULL;
#endif
/*Set attributes*/
@@ -310,7 +329,8 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->top = 0;
new_obj->protect = LV_PROTECT_NONE;
new_obj->parent_event = 0;
new_obj->gesture_parent = 1;
new_obj->gesture_parent = parent ? 1 : 0;
new_obj->focus_parent = 0;
new_obj->state = LV_STATE_DEFAULT;
new_obj->ext_attr = NULL;
@@ -837,7 +857,7 @@ void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h)
/**
* Set the width of an object by taking the left and right margin into account.
* The object width will be `obj_w = w - margon_left - margin_right`
* The object width will be `obj_w = w - margin_left - margin_right`
* @param obj pointer to an object
* @param w new height including margins
*/
@@ -851,7 +871,7 @@ void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w)
/**
* Set the height of an object by taking the top and bottom margin into account.
* The object height will be `obj_h = h - margon_top - margin_bottom`
* The object height will be `obj_h = h - margin_top - margin_bottom`
* @param obj pointer to an object
* @param h new height including margins
*/
@@ -1072,7 +1092,7 @@ void lv_obj_realign(lv_obj_t * obj)
lv_obj_align(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs);
#else
(void)obj;
LV_LOG_WARN("lv_obj_realaign: no effect because LV_USE_OBJ_REALIGN = 0");
LV_LOG_WARN("lv_obj_realign: no effect because LV_USE_OBJ_REALIGN = 0");
#endif
}
@@ -1132,7 +1152,7 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
*--------------------*/
/**
* Add a new stye to the style list of an object.
* Add a new style to the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
@@ -1144,7 +1164,7 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
if(style_dsc == NULL) {
LV_LOG_WARN("lv_obj_add_style: can't find style with `type`");
LV_LOG_WARN("Can't find style with part: %d", part);
return;
}
@@ -1155,6 +1175,30 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
}
/**
* Remove a style from the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param style pointer to a style to remove
*/
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
{
if(style == NULL) return;
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
if(style_dsc == NULL) {
LV_LOG_WARN("Can't find style with part: %d", part);
return;
}
_lv_style_list_remove_style(style_dsc, style);
#if LV_USE_ANIMATION
trans_del(obj, part, 0xFF, NULL);
#endif
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
}
/**
* Reset a style to the default (empty) state.
* Release all used memories and cancel pending related transitions.
@@ -1289,7 +1333,7 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @note shouldn't be used directly. Use the specific property remove functions instead.
* For example: `lv_obj_style_remove_border_opa()`
* @return true: the property was found and removed; false: teh property was not found
* @return true: the property was found and removed; false: the property was not found
*/
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
{
@@ -1458,7 +1502,7 @@ void lv_obj_set_top(lv_obj_t * obj, bool en)
/**
* Enable the dragging of an object
* @param obj pointer to an object
* @param en true: make the object dragable
* @param en true: make the object draggable
*/
void lv_obj_set_drag(lv_obj_t * obj, bool en)
{
@@ -1518,6 +1562,31 @@ void lv_obj_set_gesture_parent(lv_obj_t * obj, bool en)
obj->gesture_parent = (en == true ? 1 : 0);
}
/**
* Enable to use parent for focus state.
* When object is focused the parent will get the state instead (visual only)
* @param obj pointer to an object
* @param en true: enable the 'focus parent' for the object
*/
void lv_obj_set_focus_parent(lv_obj_t * obj, bool en)
{
if(lv_obj_is_focused(obj)) {
if(en) {
obj->focus_parent = 1;
lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED);
lv_obj_set_state(lv_obj_get_focused_obj(obj), LV_STATE_FOCUSED);
}
else {
lv_obj_clear_state(lv_obj_get_focused_obj(obj), LV_STATE_FOCUSED | LV_STATE_EDITED);
lv_obj_set_state(obj, LV_STATE_FOCUSED);
obj->focus_parent = 0;
}
}
else {
obj->focus_parent = (en == true ? 1 : 0);
}
}
/**
* Propagate the events to the parent too
* @param obj pointer to an object
@@ -2168,7 +2237,7 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
/**
* Get the height of an object by taking the top and bottom margin into account.
* The returned height will be `obj_h + margon_top + margin_bottom`
* The returned height will be `obj_h + margin_top + margin_bottom`
* @param obj pointer to an object
* @return the height including thee margins
*/
@@ -2182,7 +2251,7 @@ lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj)
/**
* Get the width of an object by taking the left and right margin into account.
* The returned width will be `obj_w + margon_left + margin_right`
* The returned width will be `obj_w + margin_left + margin_right`
* @param obj pointer to an object
* @return the height including thee margins
*/
@@ -2380,7 +2449,7 @@ lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_styl
lv_style_property_t prop_ori = prop;
lv_style_attr_t attr;
attr.full = prop_ori >> 8;
attr = prop_ori >> 8;
lv_style_int_t value_act;
lv_res_t res = LV_RES_INV;
@@ -2394,7 +2463,7 @@ lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_styl
res = _lv_style_list_get_int(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act;
if(attr.bits.inherit == 0) break;
if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break;
/*If not found, check the `MAIN` style first*/
if(part != LV_OBJ_PART_MAIN) {
@@ -2443,7 +2512,7 @@ lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_
lv_style_property_t prop_ori = prop;
lv_style_attr_t attr;
attr.full = prop_ori >> 8;
attr = prop_ori >> 8;
lv_color_t value_act;
lv_res_t res = LV_RES_INV;
@@ -2457,7 +2526,7 @@ lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_
res = _lv_style_list_get_color(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act;
if(attr.bits.inherit == 0) break;
if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break;
/*If not found, check the `MAIN` style first*/
if(part != LV_OBJ_PART_MAIN) {
@@ -2499,7 +2568,7 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
lv_style_property_t prop_ori = prop;
lv_style_attr_t attr;
attr.full = prop_ori >> 8;
attr = prop_ori >> 8;
lv_opa_t value_act;
lv_res_t res = LV_RES_INV;
@@ -2513,7 +2582,7 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
res = _lv_style_list_get_opa(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act;
if(attr.bits.inherit == 0) break;
if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break;
/*If not found, check the `MAIN` style first*/
if(part != LV_OBJ_PART_MAIN) {
@@ -2556,7 +2625,7 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
lv_style_property_t prop_ori = prop;
lv_style_attr_t attr;
attr.full = prop_ori >> 8;
attr = prop_ori >> 8;
const void * value_act;
lv_res_t res = LV_RES_INV;
@@ -2570,7 +2639,7 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
res = _lv_style_list_get_ptr(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act;
if(attr.bits.inherit == 0) break;
if(LV_STYLE_ATTR_GET_INHERIT(attr) == 0) break;
/*If not found, check the `MAIN` style first*/
if(part != LV_OBJ_PART_MAIN) {
@@ -2654,7 +2723,7 @@ bool lv_obj_get_click(const lv_obj_t * obj)
/**
* Get the top enable attribute of an object
* @param obj pointer to an object
* @return true: the auto top feture is enabled
* @return true: the auto top feature is enabled
*/
bool lv_obj_get_top(const lv_obj_t * obj)
{
@@ -2666,7 +2735,7 @@ bool lv_obj_get_top(const lv_obj_t * obj)
/**
* Get the drag enable attribute of an object
* @param obj pointer to an object
* @return true: the object is dragable
* @return true: the object is draggable
*/
bool lv_obj_get_drag(const lv_obj_t * obj)
{
@@ -2719,6 +2788,16 @@ bool lv_obj_get_gesture_parent(const lv_obj_t * obj)
return obj->gesture_parent == 0 ? false : true;
}
/**
* Get the focus parent attribute of an object
* @param obj pointer to an object
* @return true: focus parent is enabled
*/
bool lv_obj_get_focus_parent(const lv_obj_t * obj)
{
return obj->focus_parent == 0 ? false : true;
}
/**
* Get the drag parent attribute of an object
* @param obj pointer to an object
@@ -2785,7 +2864,7 @@ lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part)
/*If a real part is asked, then use the object's signal to get its state.
* A real object can be in different state then the main part
* and only the object itseld knows who to get it's state. */
* and only the object itself knows who to get it's state. */
lv_get_state_info_t info;
info.part = part;
info.result = LV_STATE_DEFAULT;
@@ -2929,6 +3008,7 @@ void * lv_obj_get_group(const lv_obj_t * obj)
#if LV_USE_GROUP
return obj->group_p;
#else
LV_UNUSED(obj);
return NULL;
#endif
}
@@ -2948,6 +3028,7 @@ bool lv_obj_is_focused(const lv_obj_t * obj)
}
return false;
#else
LV_UNUSED(obj);
return false;
#endif
}
@@ -3217,8 +3298,9 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint8_t part, lv_draw_img_dsc_t *
draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2;
draw_dsc->recolor_opa = lv_obj_get_style_image_recolor_opa(obj, part);
draw_dsc->recolor = lv_obj_get_style_image_recolor(obj, part);
if(draw_dsc->recolor_opa > 0) {
draw_dsc->recolor = lv_obj_get_style_image_recolor(obj, part);
}
#if LV_USE_BLEND_MODES
draw_dsc->blend_mode = lv_obj_get_style_image_blend_mode(obj, part);
#endif
@@ -3257,7 +3339,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t
/**
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
* @param obj poinr to an object
* @param obj pointer to an object
* @param part part of the object
*/
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
@@ -3379,6 +3461,52 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
#endif
}
/**
* Check if any object has a given type
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
{
if(obj_type[0] == '\0') return true;
lv_obj_type_t types;
lv_obj_get_type((lv_obj_t *)obj, &types);
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
if(types.type[i] == NULL) break;
if(strcmp(types.type[i], obj_type) == 0) return true;
}
return false;
}
/**
* Check if any object is still "alive", and part of the hierarchy
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_valid(const lv_obj_t * obj)
{
lv_disp_t * disp = lv_disp_get_next(NULL);
while(disp) {
lv_obj_t * scr;
_LV_LL_READ(disp->scr_ll, scr) {
if(scr == obj) return true;
bool found = obj_valid_child(scr, obj);
if(found) return true;
}
disp = lv_disp_get_next(disp);
}
return false;
}
/**********************
* STATIC FUNCTIONS
**********************/
@@ -3565,6 +3693,23 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
return LV_DESIGN_RES_OK;
}
/**
* Get the really focused object by taking `focus_parent` into account.
* @param obj the start object
* @return the object to really focus
*/
lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj)
{
if(obj == NULL) return NULL;
const lv_obj_t * focus_obj = obj;
while(lv_obj_get_focus_parent(focus_obj) != false && focus_obj != NULL) {
focus_obj = lv_obj_get_parent(focus_obj);
}
return (lv_obj_t *)focus_obj;
}
/**
* Signal function of the basic object
* @param obj pointer to an object
@@ -3608,22 +3753,36 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
lv_obj_clear_state(obj, LV_STATE_PRESSED);
}
#if LV_USE_GROUP
else if(sign == LV_SIGNAL_FOCUS) {
if(lv_group_get_editing(lv_obj_get_group(obj))) {
bool editing = false;
#if LV_USE_GROUP
editing = lv_group_get_editing(lv_obj_get_group(obj));
#endif
if(editing) {
uint8_t state = LV_STATE_FOCUSED;
state |= LV_STATE_EDITED;
/*if using focus mode, change target to parent*/
obj = lv_obj_get_focused_obj(obj);
lv_obj_add_state(obj, state);
}
else {
/*if using focus mode, change target to parent*/
obj = lv_obj_get_focused_obj(obj);
lv_obj_add_state(obj, LV_STATE_FOCUSED);
lv_obj_clear_state(obj, LV_STATE_EDITED);
}
}
else if(sign == LV_SIGNAL_DEFOCUS) {
/*if using focus mode, change target to parent*/
obj = lv_obj_get_focused_obj(obj);
lv_obj_clear_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED);
}
#endif
else if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
}
@@ -3723,7 +3882,7 @@ static void base_dir_refr_children(lv_obj_t * obj)
* @param part the part of the object to apply the transaction
* @param prev_state the previous state of the objects
* @param new_state the new state of the object
* @return pointer to the allocated `the transaction` variable or `NULL` if no transtion created
* @return pointer to the allocated `the transaction` variable or `NULL` if no transition created
*/
static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
lv_state_t new_state)
@@ -3828,12 +3987,12 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
}
/**
* Remove the transition from objectt's part's property.
* Remove the transition from object's part's property.
* - Remove the transition from `_lv_obj_style_trans_ll` and free it
* - Delete pending transitions
* @param obj pointer to an object which transition(s) should be removed
* @param part a part of object or 0xFF to remove from all parts
* @param prop a property or 0xFF to remove all porpeties
* @param prop a property or 0xFF to remove all properties
* @param tr_limit delete transitions only "older" then this. `NULL` is not used
*/
static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_trans_t * tr_limit)
@@ -3975,4 +4134,17 @@ static void lv_event_mark_deleted(lv_obj_t * obj)
}
}
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
{
/*Check all children of `parent`*/
lv_obj_t * child;
_LV_LL_READ(parent->child_ll, child) {
if(child == obj_to_find) return true;
/*Check the children*/
bool found = obj_valid_child(child, obj_to_find);
if(found) return true;
}
return false;
}

View File

@@ -21,6 +21,7 @@ extern "C" {
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal.h"
#include "../lv_draw/lv_draw_rect.h"
#include "../lv_draw/lv_draw_label.h"
@@ -90,7 +91,7 @@ enum {
LV_EVENT_DRAG_BEGIN,
LV_EVENT_DRAG_END,
LV_EVENT_DRAG_THROW_BEGIN,
LV_EVENT_GESTURE, /**< The object has been getture*/
LV_EVENT_GESTURE, /**< The object has been gesture*/
LV_EVENT_KEY,
LV_EVENT_FOCUSED,
LV_EVENT_DEFOCUSED,
@@ -209,7 +210,7 @@ typedef struct _lv_obj_t {
lv_area_t ext_click_pad; /**< Extra click padding area. */
#endif
lv_coord_t ext_draw_pad; /**< EXTtend the size in every direction for drawing. */
lv_coord_t ext_draw_pad; /**< EXTend the size in every direction for drawing. */
/*Attributes and states*/
uint8_t click : 1; /**< 1: Can be pressed by an input device*/
@@ -220,7 +221,8 @@ typedef struct _lv_obj_t {
uint8_t top : 1; /**< 1: If the object or its children is clicked it goes to the foreground*/
uint8_t parent_event : 1; /**< 1: Send the object's events to the parent too. */
uint8_t adv_hittest : 1; /**< 1: Use advanced hit-testing (slower) */
uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/
uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/
uint8_t focus_parent : 1; /**< 1: Parent will be focused instead*/
lv_drag_dir_t drag_dir : 3; /**< Which directions the object can be dragged in */
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
@@ -439,7 +441,7 @@ void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h);
/**
* Set the width of an object by taking the left and right margin into account.
* The object width will be `obj_w = w - margon_left - margin_right`
* The object width will be `obj_w = w - margin_left - margin_right`
* @param obj pointer to an object
* @param w new height including margins
*/
@@ -447,7 +449,7 @@ void lv_obj_set_width_margin(lv_obj_t * obj, lv_coord_t w);
/**
* Set the height of an object by taking the top and bottom margin into account.
* The object height will be `obj_h = h - margon_top - margin_bottom`
* The object height will be `obj_h = h - margin_top - margin_bottom`
* @param obj pointer to an object
* @param h new height including margins
*/
@@ -502,7 +504,7 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
*--------------------*/
/**
* Add a new stye to the style list of an object.
* Add a new style to the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
@@ -510,6 +512,15 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
*/
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
/**
* Remove a style from the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param style pointer to a style to remove
*/
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
/**
* Reset a style to the default (empty) state.
* Release all used memories and cancel pending related transitions.
@@ -609,7 +620,7 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property
* E.g. `LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED << LV_STYLE_STATE_POS)`
* @note shouldn't be used directly. Use the specific property remove functions instead.
* For example: `lv_obj_style_remove_border_opa()`
* @return true: the property was found and removed; false: teh property was not found
* @return true: the property was found and removed; false: the property was not found
*/
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
@@ -649,7 +660,7 @@ void lv_obj_set_top(lv_obj_t * obj, bool en);
/**
* Enable the dragging of an object
* @param obj pointer to an object
* @param en true: make the object dragable
* @param en true: make the object draggable
*/
void lv_obj_set_drag(lv_obj_t * obj, bool en);
@@ -675,6 +686,14 @@ void lv_obj_set_drag_throw(lv_obj_t * obj, bool en);
*/
void lv_obj_set_drag_parent(lv_obj_t * obj, bool en);
/**
* Enable to use parent for focus state.
* When object is focused the parent will get the state instead (visual only)
* @param obj pointer to an object
* @param en true: enable the 'focus parent' for the object
*/
void lv_obj_set_focus_parent(lv_obj_t * obj, bool en);
/**
* Enable to use parent for gesture related operations.
* If trying to gesture the object the parent will be moved instead
@@ -838,7 +857,6 @@ lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
/**
* Get the display of an object
* @param scr pointer to an object
* @return pointer the object's display
*/
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj);
@@ -947,7 +965,7 @@ lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);
/**
* Get the height of an object by taking the top and bottom margin into account.
* The returned height will be `obj_h + margon_top + margin_bottom`
* The returned height will be `obj_h + margin_top + margin_bottom`
* @param obj pointer to an object
* @return the height including thee margins
*/
@@ -955,7 +973,7 @@ lv_coord_t lv_obj_get_height_margin(lv_obj_t * obj);
/**
* Get the width of an object by taking the left and right margin into account.
* The returned width will be `obj_w + margon_left + margin_right`
* The returned width will be `obj_w + margin_left + margin_right`
* @param obj pointer to an object
* @return the height including thee margins
*/
@@ -1034,7 +1052,7 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
*---------------*/
/**
* Get the style list of an obejct's part.
* Get the style list of an object's part.
* @param obj pointer to an object.
* @param part part the part of the object which style list should be get.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
@@ -1153,7 +1171,7 @@ bool lv_obj_get_top(const lv_obj_t * obj);
/**
* Get the drag enable attribute of an object
* @param obj pointer to an object
* @return true: the object is dragable
* @return true: the object is draggable
*/
bool lv_obj_get_drag(const lv_obj_t * obj);
@@ -1178,6 +1196,15 @@ bool lv_obj_get_drag_throw(const lv_obj_t * obj);
*/
bool lv_obj_get_drag_parent(const lv_obj_t * obj);
/**
* Get the focus parent attribute of an object
* @param obj pointer to an object
* @return true: focus parent is enabled
*/
bool lv_obj_get_focus_parent(const lv_obj_t * obj);
/**
* Get the drag parent attribute of an object
* @param obj pointer to an object
@@ -1309,6 +1336,13 @@ void * lv_obj_get_group(const lv_obj_t * obj);
*/
bool lv_obj_is_focused(const lv_obj_t * obj);
/**
* Get the really focused object by taking `focus_parent` into account.
* @param obj the start object
* @return the object to really focus
*/
lv_obj_t * lv_obj_get_focused_obj(const lv_obj_t * obj);
/*-------------------
* OTHER FUNCTIONS
*------------------*/
@@ -1339,7 +1373,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t
/**
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
* @param obj poinr to an object
* @param obj pointer to an object
* @param part part of the object
*/
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part);
@@ -1360,6 +1394,23 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
*/
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
/**
* Check if any object has a given type
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
/**
* Check if any object is still "alive", and part of the hierarchy
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
/**********************
* MACROS
**********************/
@@ -1369,7 +1420,7 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
* Will be expanded to: `static void <name> (lv_obj_t * obj, lv_event_t e)`
*
* Examples:
* LV_EVENT_CB_DECLARE(my_event1); //Protoype declaration
* LV_EVENT_CB_DECLARE(my_event1); //Prototype declaration
*
* LV_EVENT_CB_DECLARE(my_event1)
* {
@@ -1380,6 +1431,32 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
*/
#define LV_EVENT_CB_DECLARE(name) static void name(lv_obj_t * obj, lv_event_t e)
#if LV_USE_DEBUG
# ifndef LV_DEBUG_IS_OBJ
# define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \
lv_debug_check_obj_valid(obj_p) && \
lv_debug_check_obj_type(obj_p, obj_type))
# endif
# if LV_USE_ASSERT_OBJ
# ifndef LV_ASSERT_OBJ
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p);
# endif
# else /* LV_USE_ASSERT_OBJ == 0 */
# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p)
# else
# define LV_ASSERT_OBJ(obj_p, obj_type) true
# endif
# endif
#else
# define LV_ASSERT_OBJ(obj, obj_type) true
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -199,6 +199,102 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _col
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
static inline void lv_obj_set_style_local_pad_all(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_top(obj, part, state, value);
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
lv_obj_set_style_local_pad_left(obj, part, state, value);
lv_obj_set_style_local_pad_right(obj, part, state, value);
}
static inline void lv_style_set_pad_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_top(style, state, value);
lv_style_set_pad_bottom(style, state, value);
lv_style_set_pad_left(style, state, value);
lv_style_set_pad_right(style, state, value);
}
static inline void lv_obj_set_style_local_pad_hor(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_left(obj, part, state, value);
lv_obj_set_style_local_pad_right(obj, part, state, value);
}
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_left(style, state, value);
lv_style_set_pad_right(style, state, value);
}
static inline void lv_obj_set_style_local_pad_ver(lv_obj_t * obj, uint8_t part, lv_state_t state, lv_style_int_t value)
{
lv_obj_set_style_local_pad_top(obj, part, state, value);
lv_obj_set_style_local_pad_bottom(obj, part, state, value);
}
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_pad_top(style, state, value);
lv_style_set_pad_bottom(style, state, value);
}
static inline void lv_obj_set_style_local_margin_all(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
}
static inline void lv_style_set_margin_all(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_top(style, state, value);
lv_style_set_margin_bottom(style, state, value);
lv_style_set_margin_left(style, state, value);
lv_style_set_margin_right(style, state, value);
}
static inline void lv_obj_set_style_local_margin_hor(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_left(obj, part, state, value);
lv_obj_set_style_local_margin_right(obj, part, state, value);
}
static inline void lv_style_set_margin_hor(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_left(style, state, value);
lv_style_set_margin_right(style, state, value);
}
static inline void lv_obj_set_style_local_margin_ver(lv_obj_t * obj, uint8_t part, lv_state_t state,
lv_style_int_t value)
{
lv_obj_set_style_local_margin_top(obj, part, state, value);
lv_obj_set_style_local_margin_bottom(obj, part, state, value);
}
static inline void lv_style_set_margin_ver(lv_style_t * style, lv_state_t state, lv_style_int_t value)
{
lv_style_set_margin_top(style, state, value);
lv_style_set_margin_bottom(style, state, value);
}
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -17,6 +17,7 @@
#include "../lv_misc/lv_gc.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_font/lv_font_fmt_txt.h"
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
#if LV_USE_PERF_MONITOR
#include "../lv_widgets/lv_label.h"
@@ -158,7 +159,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void)
/**
* Set the display which is being refreshed.
* It shouldn1t be used directly by the user.
* It shouldn't be used directly by the user.
* It can be used to trick the drawing functions about there is an active display.
* @param the display being refreshed
*/
@@ -201,35 +202,59 @@ void _lv_disp_refr_task(lv_task_t * task)
if(disp_refr->inv_p != 0) {
/* In true double buffered mode copy the refreshed areas to the new VDB to keep it up to date.
* With set_px_cb we don't know anything about the buffer (even it's size) so skip copying.*/
if(lv_disp_is_true_double_buf(disp_refr) && disp_refr->driver.set_px_cb == NULL) {
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
if(lv_disp_is_true_double_buf(disp_refr)) {
if(disp_refr->driver.set_px_cb) {
LV_LOG_WARN("Can't handle 2 screen sized buffers with set_px_cb. Display is not refreshed.");
}
else {
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
/*Flush the content of the VDB*/
lv_refr_vdb_flush();
/*Flush the content of the VDB*/
lv_refr_vdb_flush();
/* With true double buffering the flushing should be only the address change of the
* current frame buffer. Wait until the address change is ready and copy the changed
* content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
while(vdb->flushing)
;
/* With true double buffering the flushing should be only the address change of the
* current frame buffer. Wait until the address change is ready and copy the changed
* content to the other frame buffer (new active VDB) to keep the buffers synchronized*/
while(vdb->flushing);
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
lv_color_t * copy_buf = NULL;
#if LV_USE_GPU_STM32_DMA2D
LV_UNUSED(copy_buf);
#else
copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t));
#endif
lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
uint16_t a;
for(a = 0; a < disp_refr->inv_p; a++) {
if(disp_refr->inv_area_joined[a] == 0) {
lv_coord_t y;
uint32_t start_offs =
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
_lv_memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
start_offs += hres * sizeof(lv_color_t);
lv_coord_t hres = lv_disp_get_hor_res(disp_refr);
uint16_t a;
for(a = 0; a < disp_refr->inv_p; a++) {
if(disp_refr->inv_area_joined[a] == 0) {
uint32_t start_offs =
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
#if LV_USE_GPU_STM32_DMA2D
lv_gpu_stm32_dma2d_copy((lv_color_t *)(buf_act + start_offs), disp_refr->driver.hor_res,
(lv_color_t *)(buf_ina + start_offs), disp_refr->driver.hor_res,
lv_area_get_width(&disp_refr->inv_areas[a]),
lv_area_get_height(&disp_refr->inv_areas[a]));
#else
lv_coord_t y;
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
/* The frame buffer is probably in an external RAM where sequential access is much faster.
* So first copy a line into a buffer and write it back the ext. RAM */
_lv_memcpy(copy_buf, buf_ina + start_offs, line_length);
_lv_memcpy(buf_act + start_offs, copy_buf, line_length);
start_offs += hres * sizeof(lv_color_t);
}
#endif
}
}
if(copy_buf) _lv_mem_buf_release(copy_buf);
}
} /*End of true double buffer handling*/

View File

@@ -72,7 +72,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void);
/**
* Set the display which is being refreshed.
* It shouldn1t be used directly by the user.
* It shouldn't be used directly by the user.
* It can be used to trick the drawing functions about there is an active display.
* @param the display being refreshed
*/

View File

@@ -7,7 +7,6 @@
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_anim.h"
@@ -37,6 +36,12 @@
**********************/
LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
static inline void style_resize(lv_style_t * style, size_t sz);
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx);
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx);
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx);
static inline size_t get_prop_size(uint8_t prop_id);
static inline size_t get_next_prop_index(uint8_t prop_id, size_t id);
/**********************
* GLOABAL VARIABLES
@@ -103,16 +108,12 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
lv_style_attr_t attr_found;
lv_style_attr_t attr_goal;
attr_found.full = *(style->map + id + 1);
attr_goal.full = (prop >> 8) & 0xFFU;
attr_found = get_style_prop_attr(style, id);
attr_goal = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
uint32_t map_size = _lv_style_get_mem_size(style);
uint8_t prop_size = sizeof(lv_style_property_t);
if((prop & 0xF) < LV_STYLE_ID_COLOR) prop_size += sizeof(lv_style_int_t);
else if((prop & 0xF) < LV_STYLE_ID_OPA) prop_size += sizeof(lv_color_t);
else if((prop & 0xF) < LV_STYLE_ID_PTR) prop_size += sizeof(lv_opa_t);
else prop_size += sizeof(const void *);
uint8_t prop_size = get_prop_size(prop);
/*Move the props to fill the space of the property to delete*/
uint32_t i;
@@ -120,7 +121,7 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
style->map[i] = style->map[i + prop_size];
}
style->map = lv_mem_realloc(style->map, map_size - prop_size);
style_resize(style, map_size - prop_size);
return true;
}
@@ -336,14 +337,9 @@ uint16_t _lv_style_get_mem_size(const lv_style_t * style)
if(style->map == NULL) return 0;
size_t i = 0;
while(style->map[i] != _LV_STYLE_CLOSEING_PROP) {
/*Go to the next property*/
if((style->map[i] & 0xF) < LV_STYLE_ID_COLOR) i += sizeof(lv_style_int_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_OPA) i += sizeof(lv_color_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_PTR) i += sizeof(lv_opa_t);
else i += sizeof(const void *);
i += sizeof(lv_style_property_t);
uint8_t prop_id;
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
i = get_next_prop_index(prop_id, i);
}
return i + sizeof(lv_style_property_t);
@@ -369,10 +365,10 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
lv_style_attr_t attr_found;
lv_style_attr_t attr_goal;
attr_found.full = *(style->map + id + 1);
attr_goal.full = (prop >> 8) & 0xFFU;
attr_found = get_style_prop_attr(style, id);
attr_goal = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
return;
}
@@ -386,7 +382,7 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
uint16_t size = _lv_style_get_mem_size(style);
if(size == 0) size += end_mark_size;
size += sizeof(lv_style_property_t) + sizeof(lv_style_int_t);
style->map = lv_mem_realloc(style->map, size);
style_resize(style, size);
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
@@ -415,10 +411,10 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
lv_style_attr_t attr_found;
lv_style_attr_t attr_goal;
attr_found.full = *(style->map + id + 1);
attr_goal.full = (prop >> 8) & 0xFFU;
attr_found = get_style_prop_attr(style, id);
attr_goal = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
return;
}
@@ -433,7 +429,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
if(size == 0) size += end_mark_size;
size += sizeof(lv_style_property_t) + sizeof(lv_color_t);
style->map = lv_mem_realloc(style->map, size);
style_resize(style, size);
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
@@ -462,10 +458,10 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
lv_style_attr_t attr_found;
lv_style_attr_t attr_goal;
attr_found.full = *(style->map + id + 1);
attr_goal.full = (prop >> 8) & 0xFFU;
attr_found = get_style_prop_attr(style, id);
attr_goal = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
return;
}
@@ -480,7 +476,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
if(size == 0) size += end_mark_size;
size += sizeof(lv_style_property_t) + sizeof(lv_opa_t);
style->map = lv_mem_realloc(style->map, size);
style_resize(style, size);
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
@@ -509,10 +505,10 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
lv_style_attr_t attr_found;
lv_style_attr_t attr_goal;
attr_found.full = *(style->map + id + 1);
attr_goal.full = (prop >> 8) & 0xFFU;
attr_found = get_style_prop_attr(style, id);
attr_goal = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
if(LV_STYLE_ATTR_GET_STATE(attr_found) == LV_STYLE_ATTR_GET_STATE(attr_goal)) {
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void *));
return;
}
@@ -527,7 +523,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
if(size == 0) size += end_mark_size;
size += sizeof(lv_style_property_t) + sizeof(const void *);
style->map = lv_mem_realloc(style->map, size);
style_resize(style, size);
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
@@ -561,12 +557,12 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
else {
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
attr_act = get_style_prop_attr(style, id);
lv_style_attr_t attr_goal;
attr_goal.full = (prop >> 8) & 0xFF;
attr_goal = (prop >> 8) & 0xFF;
return attr_act.bits.state & attr_goal.bits.state;
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
}
}
@@ -598,12 +594,12 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
else {
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
attr_act = get_style_prop_attr(style, id);
lv_style_attr_t attr_goal;
attr_goal.full = (prop >> 8) & 0xFF;
attr_goal = (prop >> 8) & 0xFF;
return attr_act.bits.state & attr_goal.bits.state;
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
}
}
@@ -632,12 +628,12 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
else {
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
attr_act = get_style_prop_attr(style, id);
lv_style_attr_t attr_goal;
attr_goal.full = (prop >> 8) & 0xFF;
attr_goal = (prop >> 8) & 0xFF;
return attr_act.bits.state & attr_goal.bits.state;
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
}
}
@@ -667,12 +663,12 @@ int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, vo
else {
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(const void *));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
attr_act = get_style_prop_attr(style, id);
lv_style_attr_t attr_goal;
attr_goal.full = (prop >> 8) & 0xFF;
attr_goal = (prop >> 8) & 0xFF;
return attr_act.bits.state & attr_goal.bits.state;
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
}
}
@@ -820,8 +816,8 @@ lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop
if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr;
attr.full = prop >> 8;
int16_t weight_goal = attr.full;
attr = prop >> 8;
int16_t weight_goal = attr;
int16_t weight = -1;
@@ -872,8 +868,8 @@ lv_res_t _lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pr
if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr;
attr.full = prop >> 8;
int16_t weight_goal = attr.full;
attr = prop >> 8;
int16_t weight_goal = attr;
int16_t weight = -1;
@@ -922,8 +918,8 @@ lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop
if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr;
attr.full = prop >> 8;
int16_t weight_goal = attr.full;
attr = prop >> 8;
int16_t weight_goal = attr;
int16_t weight = -1;
@@ -972,8 +968,8 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
if(list->style_list == NULL) return LV_RES_INV;
lv_style_attr_t attr;
attr.full = prop >> 8;
int16_t weight_goal = attr.full;
attr = prop >> 8;
int16_t weight_goal = attr;
int16_t weight = -1;
@@ -1003,6 +999,45 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
else return LV_RES_INV;
}
/**
* Check whether a style is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style(const lv_style_t * style)
{
if(style == NULL) return true; /*NULL style is still valid*/
#if LV_USE_ASSERT_STYLE
if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
/**
* Check whether a style list is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style_list(const lv_style_list_t * list)
{
if(list == NULL) return true; /*NULL list is still valid*/
#if LV_USE_ASSERT_STYLE
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
/**********************
* STATIC FUNCTIONS
**********************/
@@ -1023,40 +1058,36 @@ LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t
uint8_t id_to_find = prop & 0xFF;
lv_style_attr_t attr;
attr.full = (prop >> 8) & 0xFF;
attr = (prop >> 8) & 0xFF;
int16_t weight = -1;
int16_t id_guess = -1;
size_t i = 0;
while(style->map[i] != _LV_STYLE_CLOSEING_PROP) {
if(style->map[i] == id_to_find) {
uint8_t prop_id;
while((prop_id = get_style_prop_id(style, i)) != _LV_STYLE_CLOSEING_PROP) {
if(prop_id == id_to_find) {
lv_style_attr_t attr_i;
attr_i.full = style->map[i + 1];
attr_i = get_style_prop_attr(style, i);
/*If the state perfectly matches return this property*/
if(attr_i.bits.state == attr.bits.state) {
if(LV_STYLE_ATTR_GET_STATE(attr_i) == LV_STYLE_ATTR_GET_STATE(attr)) {
return i;
}
/* Be sure the property not specifies other state than the requested.
* E.g. For HOVER+PRESS, HOVER only is OK, but HOVER+FOCUS not*/
else if((attr_i.bits.state & (~attr.bits.state)) == 0) {
else if((LV_STYLE_ATTR_GET_STATE(attr_i) & (~LV_STYLE_ATTR_GET_STATE(attr))) == 0) {
/* Use this property if it describes better the requested state than the current candidate.
* E.g. for HOVER+FOCUS+PRESS prefer HOVER+FOCUS over FOCUS*/
if(attr_i.bits.state > weight) {
weight = attr_i.bits.state;
if(LV_STYLE_ATTR_GET_STATE(attr_i) > weight) {
weight = LV_STYLE_ATTR_GET_STATE(attr_i);
id_guess = i;
}
}
}
/*Go to the next property*/
if((style->map[i] & 0xF) < LV_STYLE_ID_COLOR) i += sizeof(lv_style_int_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_OPA) i += sizeof(lv_color_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_PTR) i += sizeof(lv_opa_t);
else i += sizeof(const void *);
i += sizeof(lv_style_property_t);
i = get_next_prop_index(prop_id, i);
}
return id_guess;
@@ -1081,9 +1112,85 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
}
lv_style_init(local_style);
/*Add the local style to the furst place*/
/*Add the local style to the first place*/
_lv_style_list_add_style(list, local_style);
list->has_local = 1;
return local_style;
}
/**
* Resizes a style map. Useful entry point for debugging.
* @param style pointer to the style to be resized.
* @param size new size
*/
static inline void style_resize(lv_style_t * style, size_t sz)
{
style->map = lv_mem_realloc(style->map, sz);
}
/**
* Get style property in index.
* @param style pointer to style.
* @param idx index of the style in style->map
* @return property in style->map + idx
*/
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx)
{
lv_style_property_t prop;
uint8_t * prop_p = (uint8_t *)&prop;
prop_p[0] = style->map[idx];
prop_p[1] = style->map[idx + 1];
return prop;
}
/**
* Get style property id in index.
* @param style pointer to style.
* @param idx index of the style in style->map
* @return id of property in style->map + idx
*/
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx)
{
return get_style_prop(style, idx) & 0xFF;
}
/**
* Get style property attributes for index.
* @param style pointer to style.
* @param idx index of the style in style->map
* @return attribute of property in style->map + idx
*/
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx)
{
return ((get_style_prop(style, idx) >> 8) & 0xFFU);
}
/**
* Get property size.
* @param prop_id property id.
* @param idx index of the style in style->map
* @return attribute of property in style->map + idx
*/
static inline size_t get_prop_size(uint8_t prop_id)
{
prop_id &= 0xF;
size_t size = sizeof(lv_style_property_t);
if(prop_id < LV_STYLE_ID_COLOR) size += sizeof(lv_style_int_t);
else if(prop_id < LV_STYLE_ID_OPA) size += sizeof(lv_color_t);
else if(prop_id < LV_STYLE_ID_PTR) size += sizeof(lv_opa_t);
else size += sizeof(const void *);
return size;
}
/**
* Get next property index, given current property and index.
* @param prop_id property id.
* @param idx index of the style in style->map
* @return index of next property in style->map
*/
static inline size_t get_next_prop_index(uint8_t prop_id, size_t idx)
{
return idx + get_prop_size(prop_id);
}

View File

@@ -19,6 +19,7 @@ extern "C" {
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_blend.h"
/*********************
@@ -80,13 +81,10 @@ enum {
typedef uint8_t lv_text_decor_t;
typedef union {
struct {
uint8_t state : 7; /* To which state the property refers to*/
uint8_t inherit : 1; /*1: The property can be inherited*/
} bits;
uint8_t full;
} lv_style_attr_t;
typedef uint8_t lv_style_attr_t;
#define LV_STYLE_ATTR_GET_INHERIT(f) ((f)&0x80)
#define LV_STYLE_ATTR_GET_STATE(f) ((f)&0x7F)
#define LV_STYLE_ID_VALUE 0x0 /*max 9 pcs*/
#define LV_STYLE_ID_COLOR 0x9 /*max 3 pcs*/
@@ -101,7 +99,7 @@ enum {
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_WIDTH, 0x0, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ANGLE, 0x0, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ZOOM, 0x0, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ZOOM, 0x0, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
LV_STYLE_PROP_INIT(LV_STYLE_PAD_TOP, 0x1, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
@@ -136,8 +134,8 @@ enum {
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_OPA, 0x4, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_WIDTH, 0x5, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_X, 0x5, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_Y, 0x5, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_X, 0x5, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_Y, 0x5, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_SPREAD, 0x5, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_BLEND_MODE, 0x5, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_COLOR, 0x5, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
@@ -193,12 +191,12 @@ enum {
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xC, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xC, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xC, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xC, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
};
typedef uint16_t lv_style_property_t;
@@ -541,6 +539,19 @@ lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop
*/
lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res);
/**
* Check whether a style is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style(const lv_style_t * style);
/**
* Check whether a style list is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style_list(const lv_style_list_t * list);
/*************************
* GLOBAL VARIABLES
@@ -562,6 +573,34 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy);
#if LV_USE_DEBUG
# ifndef LV_DEBUG_IS_STYLE
# define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
# endif
# ifndef LV_DEBUG_IS_STYLE_LIST
# define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
# endif
# if LV_USE_ASSERT_STYLE
# ifndef LV_ASSERT_STYLE
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
# endif
# ifndef LV_ASSERT_STYLE_LIST
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
# endif
# else
# define LV_ASSERT_STYLE(style_p) true
# define LV_ASSERT_STYLE_LIST(list_p) true
# endif
#else
# define LV_ASSERT_STYLE(p) true
# define LV_ASSERT_STYLE_LIST(p) true
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -60,6 +60,10 @@ 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
LV_ATTRIBUTE_DMA static lv_color_t blend_buf[LV_HOR_RES_MAX];
#endif
/**********************
* MACROS
**********************/
@@ -267,8 +271,10 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
for(y = draw_area->y1; y <= draw_area->y2; y++) {
for(x = draw_area->x1; x <= draw_area->x2; x++) {
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, color,
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
if(mask_tmp[x]) {
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, color,
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
}
}
mask_tmp += draw_area_w;
}
@@ -318,12 +324,13 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
disp->driver.gpu_fill_cb(&disp->driver, disp_buf, disp_w, draw_area, color);
return;
}
#endif
#if LV_USE_GPU_STM32_DMA2D
if(lv_area_get_size(draw_area) >= 240) {
lv_gpu_stm32_dma2d_fill(disp_buf_first, disp_w, color, draw_area_w, draw_area_h);
return;
}
#endif
#endif
/*Software rendering*/
for(y = 0; y < draw_area_h; y++) {
@@ -335,7 +342,6 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
else {
#if LV_USE_GPU
if(disp->driver.gpu_blend_cb && lv_area_get_size(draw_area) > GPU_SIZE_LIMIT) {
static lv_color_t blend_buf[LV_HOR_RES_MAX];
for(x = 0; x < draw_area_w ; x++) blend_buf[x].full = color.full;
for(y = draw_area->y1; y <= draw_area->y2; y++) {
@@ -345,6 +351,25 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
return;
}
#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);
lv_coord_t line_h = LV_HOR_RES_MAX / draw_area_w;
for(y = 0; y <= draw_area_h - line_h; y += line_h) {
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, blend_buf, opa, draw_area_w, draw_area_w, line_h);
disp_buf_first += disp_w * line_h;
}
if(y != draw_area_h) {
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, blend_buf, opa, draw_area_w, draw_area_w, draw_area_h - y);
}
return;
}
#endif
lv_color_t last_dest_color = LV_COLOR_BLACK;
lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa);
@@ -399,7 +424,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
for(y = 0; y < draw_area_h; y++) {
const lv_opa_t * mask_tmp_x = mask;
#if 0
for(x = draw_area->x1; x <= draw_area->x2; x++) {
for(x = 0; x < draw_area_w; x++) {
#if LV_COLOR_SCREEN_TRANSP
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
#else
@@ -622,8 +647,10 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
for(y = draw_area->y1; y <= draw_area->y2; y++) {
for(x = draw_area->x1; x <= draw_area->x2; x++) {
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x],
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
if(mask_tmp[x]) {
disp->driver.set_px_cb(&disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x],
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
}
}
mask_tmp += draw_area_w;
map_buf_tmp += map_w;
@@ -740,7 +767,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
for(y = 0; y < draw_area_h; y++) {
const lv_opa_t * mask_tmp_x = mask;
#if 0
for(x = draw_area->x1; x <= draw_area->x2; x++) {
for(x = 0; x < draw_area_w; x++) {
MAP_NORMAL_MASK_PX(x);
}
#else

View File

@@ -368,11 +368,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
/*The pixel size in byte is different if an alpha byte is added too*/
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
/*Build the image and a mask line-by-line*/
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
/*Go to the first displayed pixel of the map*/
int32_t map_w = lv_area_get_width(map_area);
const uint8_t * map_buf_tmp = map_p;
@@ -412,6 +407,11 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
return;
}
#endif
/*Build the image and a mask line-by-line*/
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
int32_t x;
int32_t y;
for(y = 0; y < draw_area_h; y++) {
@@ -457,6 +457,10 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
}
/*Most complicated case: transform or other mask or chroma keyed*/
else {
/*Build the image and a mask line-by-line*/
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
#if LV_USE_IMG_TRANSFORM
lv_img_transform_dsc_t trans_dsc;
@@ -533,7 +537,10 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
if(alpha_byte) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa < LV_OPA_MIN) {
if(px_opa == 0) {
#if LV_COLOR_DEPTH == 32
map2[px_i].full = 0;
#endif
continue;
}
}
@@ -541,7 +548,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
mask_buf[px_i] = 0xFF;
}
#if LV_COLOR_DEPTH == 8
#if LV_COLOR_DEPTH == 1
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 8
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 16
c.full = map_px[0] + (map_px[1] << 8);
@@ -552,6 +561,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
if(chroma_key) {
if(c.full == chroma_keyed_color.full) {
mask_buf[px_i] = LV_OPA_TRANSP;
#if LV_COLOR_DEPTH == 32
map2[px_i].full = 0;
#endif
continue;
}
}
@@ -583,6 +595,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
blend_area.y2 ++;
}
else {
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
blend_area.y1 = blend_area.y2 + 1;
@@ -598,15 +611,16 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
}
}
}
/*Flush the last part*/
if(blend_area.y1 != blend_area.y2) {
blend_area.y2--;
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
}
}
_lv_mem_buf_release(mask_buf);
_lv_mem_buf_release(map2);
_lv_mem_buf_release(mask_buf);
_lv_mem_buf_release(map2);
}
}
}

View File

@@ -11,7 +11,7 @@
#include "../lv_hal/lv_hal_disp.h"
#include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_bidi.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
/*********************
* DEFINES
@@ -206,10 +206,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
lv_opa_t opa = dsc->opa;
uint16_t sel_start = dsc->sel_start;
uint16_t sel_end = dsc->sel_end;
uint32_t sel_start = dsc->sel_start;
uint32_t sel_end = dsc->sel_end;
if(sel_start > sel_end) {
uint16_t tmp = sel_start;
uint32_t tmp = sel_start;
sel_start = sel_end;
sel_end = tmp;
}
@@ -225,7 +225,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
cmd_state_t cmd_state = CMD_STATE_WAIT;
uint32_t i;
uint16_t par_start = 0;
uint32_t par_start = 0;
lv_color_t recolor;
int32_t letter_w;
@@ -250,11 +250,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
#endif
while(i < line_end - line_start) {
uint16_t logical_char_pos = 0;
uint32_t logical_char_pos = 0;
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start);
uint16_t t = _lv_txt_encoded_get_char_id(bidi_txt, i);
uint32_t t = _lv_txt_encoded_get_char_id(bidi_txt, i);
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, dsc->bidi_dir, t, NULL);
#else
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start + i);
@@ -758,7 +758,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
}
/*Go to the next column*/
if(col_bit < 8 - bpp) {
if(col_bit < (int32_t)(8 - bpp)) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}
@@ -778,7 +778,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
}
}
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
if((int32_t) mask_p + (col_end - col_start) < mask_buf_size) {
map_area.y2 ++;
}
else {

View File

@@ -33,8 +33,8 @@ typedef struct {
lv_opa_t opa;
lv_style_int_t line_space;
lv_style_int_t letter_space;
uint16_t sel_start;
uint16_t sel_end;
uint32_t sel_start;
uint32_t sel_end;
lv_coord_t ofs_x;
lv_coord_t ofs_y;
lv_bidi_dir_t bidi_dir;

View File

@@ -188,7 +188,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
if(dashed) {
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
lv_style_int_t dash_cnt = dash_start;
uint32_t i;
lv_coord_t i;
for(i = 0; i < draw_area_w; i++, dash_cnt++) {
if(dash_cnt <= dsc->dash_width) {
int16_t diff = dsc->dash_width - dash_cnt;
@@ -279,7 +279,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
lv_style_int_t dash_start = 0;
if(dashed) {
dash_start = (vdb->area.x1 + draw_area.x1) % (dsc->dash_gap + dsc->dash_width);
dash_start = (vdb->area.y1 + draw_area.y1) % (dsc->dash_gap + dsc->dash_width);
}
lv_style_int_t dash_cnt = dash_start;

View File

@@ -13,20 +13,20 @@
#include "lv_draw_mask.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h"
#include "../lv_core/lv_debug.h"
#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
*********************/
#define LV_MASK_MAX_NUM 16
/**********************
* TYPEDEFS
**********************/
typedef struct {
void * param;
void * custom_id;
} lv_mask_saved_t;
/**********************
* STATIC PROTOTYPES
@@ -60,7 +60,6 @@ LV_ATTRIBUTE_FAST_MEM static inline void sqrt_approx(lv_sqrt_res_t * q, lv_sqrt_
/**********************
* STATIC VARIABLES
**********************/
static lv_mask_saved_t mask_list[LV_MASK_MAX_NUM];
/**********************
* MACROS
@@ -80,28 +79,28 @@ int16_t lv_draw_mask_add(void * param, void * custom_id)
{
/*Look for a free entry*/
uint8_t i;
for(i = 0; i < LV_MASK_MAX_NUM; i++) {
if(mask_list[i].param == NULL) break;
for(i = 0; i < _LV_MASK_MAX_NUM; i++) {
if(LV_GC_ROOT(_lv_draw_mask_list[i]).param == NULL) break;
}
if(i >= LV_MASK_MAX_NUM) {
if(i >= _LV_MASK_MAX_NUM) {
LV_LOG_WARN("lv_mask_add: no place to add the mask");
return LV_MASK_ID_INV;
}
mask_list[i].param = param;
mask_list[i].custom_id = custom_id;
LV_GC_ROOT(_lv_draw_mask_list[i]).param = param;
LV_GC_ROOT(_lv_draw_mask_list[i]).custom_id = custom_id;
return i;
}
/**
* Apply the added buffers on a line. Used internally by the library's drawing routins.
* Apply the added buffers on a line. Used internally by the library's drawing routines.
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
* @param abs_x absolute X coordinate where the line to calculate start
* @param abs_y absolute Y coordinate where the line to calculate start
* @param len length of the line to calculate (in pixel count)
* @return Oneof these values:
* @return One of these values:
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
@@ -112,7 +111,7 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
bool changed = false;
lv_draw_mask_common_dsc_t * dsc;
lv_mask_saved_t * m = mask_list;
_lv_draw_mask_saved_t * m = LV_GC_ROOT(_lv_draw_mask_list);
while(m->param) {
dsc = m->param;
@@ -138,9 +137,9 @@ void * lv_draw_mask_remove_id(int16_t id)
void * p = NULL;
if(id != LV_MASK_ID_INV) {
p = mask_list[id].param;
mask_list[id].param = NULL;
mask_list[id].custom_id = NULL;
p = LV_GC_ROOT(_lv_draw_mask_list[id]).param;
LV_GC_ROOT(_lv_draw_mask_list[id]).param = NULL;
LV_GC_ROOT(_lv_draw_mask_list[id]).custom_id = NULL;
}
return p;
@@ -156,11 +155,11 @@ void * lv_draw_mask_remove_custom(void * custom_id)
{
void * p = NULL;
uint8_t i;
for(i = 0; i < LV_MASK_MAX_NUM; i++) {
if(mask_list[i].custom_id == custom_id) {
p = mask_list[i].param;
mask_list[i].param = NULL;
mask_list[i].custom_id = NULL;
for(i = 0; i < _LV_MASK_MAX_NUM; i++) {
if(LV_GC_ROOT(_lv_draw_mask_list[i]).custom_id == custom_id) {
p = LV_GC_ROOT(_lv_draw_mask_list[i]).param;
LV_GC_ROOT(_lv_draw_mask_list[i]).param = NULL;
LV_GC_ROOT(_lv_draw_mask_list[i]).custom_id = NULL;
}
}
return p;
@@ -174,8 +173,8 @@ LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void)
{
uint8_t cnt = 0;
uint8_t i;
for(i = 0; i < LV_MASK_MAX_NUM; i++) {
if(mask_list[i].param) cnt++;
for(i = 0; i < _LV_MASK_MAX_NUM; i++) {
if(LV_GC_ROOT(_lv_draw_mask_list[i]).param) cnt++;
}
return cnt;
}
@@ -273,8 +272,8 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
/**
*Initialize a line mask from a point and an angle.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param px X coordiante of a point of the line
* @param py X coordiante of a point of the line
* @param px X coordinate of a point of the line
* @param py X coordinate of a point of the line
* @param angle right 0 deg, bottom: 90
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
@@ -371,7 +370,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
* @param rect coordinates of the rectangle to affect (absolute coordinates)
* @param radius radius of the rectangle
* @param inv: true: keep the pixels inside teh rectangle; keep teh pixels outside of the rectangle
* @param inv: true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
*/
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv)
{

View File

@@ -21,6 +21,7 @@ extern "C" {
* DEFINES
*********************/
#define LV_MASK_ID_INV (-1)
#define _LV_MASK_MAX_NUM 16
/**********************
* TYPEDEFS
@@ -161,6 +162,13 @@ typedef struct _lv_draw_mask_map_param_t {
} cfg;
} lv_draw_mask_map_param_t;
typedef struct {
void * param;
void * custom_id;
} _lv_draw_mask_saved_t;
typedef _lv_draw_mask_saved_t _lv_draw_mask_saved_arr_t[_LV_MASK_MAX_NUM];
/**********************
* GLOBAL PROTOTYPES
**********************/
@@ -182,7 +190,7 @@ int16_t lv_draw_mask_add(void * param, void * custom_id);
* @param abs_x absolute X coordinate where the line to calculate start
* @param abs_y absolute Y coordinate where the line to calculate start
* @param len length of the line to calculate (in pixel count)
* @return Oneof these values:
* @return One of these values:
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
@@ -237,8 +245,8 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
/**
*Initialize a line mask from a point and an angle.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param px X coordiante of a point of the line
* @param py X coordiante of a point of the line
* @param px X coordinate of a point of the line
* @param py X coordinate of a point of the line
* @param angle right 0 deg, bottom: 90
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
@@ -263,7 +271,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
* @param param param pointer to a `lv_draw_mask_param_t` to initialize
* @param rect coordinates of the rectangle to affect (absolute coordinates)
* @param radius radius of the rectangle
* @param inv: true: keep the pixels inside teh rectangle; keep teh pixels outside of the rectangle
* @param inv: true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
*/
void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, bool inv);

View File

@@ -11,7 +11,7 @@
#include "lv_draw_mask.h"
#include "../lv_misc/lv_math.h"
#include "../lv_core/lv_refr.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
/*********************
* DEFINES
@@ -112,6 +112,9 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect
*/
void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style)
{
LV_UNUSED(point);
LV_UNUSED(clip_area);
LV_UNUSED(style);
// lv_opa_t opa = style->body.opa;
// if(opa_scale != LV_OPA_COVER) opa = (opa * opa_scale) >> 8;
//
@@ -182,10 +185,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
/*Create a mask if there is a radius*/
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
lv_grad_dir_t grad_dir = dsc->bg_grad_dir;
if(dsc->bg_color.full == dsc->bg_grad_color.full) grad_dir = LV_GRAD_DIR_NONE;
uint16_t other_mask_cnt = lv_draw_mask_get_cnt();
bool simple_mode = true;
if(other_mask_cnt) simple_mode = false;
else if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR) simple_mode = false;
else if(grad_dir == LV_GRAD_DIR_HOR) simple_mode = false;
int16_t mask_rout_id = LV_MASK_ID_INV;
@@ -198,7 +204,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
if(rout > short_side >> 1) rout = short_side >> 1;
/*Most simple case: just a plain rectangle*/
if(simple_mode && rout == 0 && (dsc->bg_grad_dir == LV_GRAD_DIR_NONE)) {
if(simple_mode && rout == 0 && (grad_dir == LV_GRAD_DIR_NONE)) {
_lv_blend_fill(clip, &coords_bg,
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
dsc->bg_blend_mode);
@@ -219,7 +225,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
lv_color_t * grad_map = NULL;
/*In case of horizontal gradient pre-compute a line with a gradient*/
if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR && dsc->bg_color.full != dsc->bg_grad_color.full) {
if(grad_dir == LV_GRAD_DIR_HOR) {
grad_map = _lv_mem_buf_get(coords_w * sizeof(lv_color_t));
int32_t i;
@@ -231,6 +237,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
bool split = false;
if(lv_area_get_width(&coords_bg) - 2 * rout > SPLIT_LIMIT) split = true;
lv_opa_t opa2;
lv_area_t fill_area;
fill_area.x1 = coords_bg.x1;
fill_area.x2 = coords_bg.x2;
@@ -239,28 +247,35 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
for(h = draw_area.y1; h <= draw_area.y2; h++) {
int32_t y = h + vdb->area.y1;
opa2 = opa;
/*In not corner areas apply the mask only if required*/
if(y > coords_bg.y1 + rout + 1 &&
y < coords_bg.y2 - rout - 1) {
mask_res = LV_DRAW_MASK_RES_FULL_COVER;
if(simple_mode == false) {
_lv_memset_ff(mask_buf, draw_area_w);
_lv_memset(mask_buf, opa, draw_area_w);
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
}
}
/*In corner areas apply the mask anyway*/
else {
_lv_memset_ff(mask_buf, draw_area_w);
_lv_memset(mask_buf, opa, draw_area_w);
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
}
/*If mask will taken into account its base opacity was already set by memset above*/
if(mask_res == LV_DRAW_MASK_RES_CHANGED) {
opa2 = LV_OPA_COVER;
}
/*Get the current line color*/
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER && dsc->bg_color.full != dsc->bg_grad_color.full) {
if(grad_dir == LV_GRAD_DIR_VER) {
grad_color = grad_get(dsc, lv_area_get_height(&coords_bg), y - coords_bg.y1);
}
/* If there is not other mask and drawing the corner area split the drawing to corner and middle areas
* because it the middle mask shuldn't be taken into account (therefore its faster)*/
* because it the middle mask shouldn't be taken into account (therefore its faster)*/
if(simple_mode && split &&
(y < coords_bg.y1 + rout + 1 ||
y > coords_bg.y2 - rout - 1)) {
@@ -273,10 +288,10 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
fill_area2.y2 = fill_area.y2;
_lv_blend_fill(clip, &fill_area2,
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
/*Center part*/
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
if(grad_dir == LV_GRAD_DIR_VER) {
fill_area2.x1 = coords_bg.x1 + rout;
fill_area2.x2 = coords_bg.x2 - rout;
_lv_blend_fill(clip, &fill_area2,
@@ -290,28 +305,28 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
int32_t mask_ofs = (coords_bg.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
if(mask_ofs < 0) mask_ofs = 0;
_lv_blend_fill(clip, &fill_area2,
grad_color, mask_buf + mask_ofs, mask_res, opa, dsc->bg_blend_mode);
grad_color, mask_buf + mask_ofs, mask_res, opa2, dsc->bg_blend_mode);
}
else {
if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR) {
_lv_blend_map(clip, &fill_area, grad_map, mask_buf, mask_res, opa, dsc->bg_blend_mode);
if(grad_dir == LV_GRAD_DIR_HOR) {
_lv_blend_map(clip, &fill_area, grad_map, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
}
else if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
else if(grad_dir == LV_GRAD_DIR_VER) {
_lv_blend_fill(clip, &fill_area,
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
}
else if(other_mask_cnt != 0 || !split) {
_lv_blend_fill(clip, &fill_area,
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
grad_color, mask_buf, mask_res, opa2, dsc->bg_blend_mode);
}
}
fill_area.y1++;
fill_area.y2++;
}
if(dsc->bg_grad_dir == LV_GRAD_DIR_NONE && other_mask_cnt == 0 && split) {
if(grad_dir == LV_GRAD_DIR_NONE && other_mask_cnt == 0 && split) {
/*Central part*/
fill_area.x1 = coords_bg.x1 + rout;
fill_area.x2 = coords_bg.x2 - rout;
@@ -652,12 +667,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
#if LV_SHADOW_CACHE_SIZE
if(sh_cache_size == corner_size && sh_cache_r == r_sh) {
/*Use the cache if available*/
sh_buf = lv_mem_buf_get(corner_size * corner_size);
sh_buf = _lv_mem_buf_get(corner_size * corner_size);
_lv_memcpy(sh_buf, sh_cache, corner_size * corner_size);
}
else {
/*A larger buffer is required for calculation */
sh_buf = lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
sh_buf = _lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
shadow_draw_corner_buf(&sh_rect_area, (uint16_t *)sh_buf, dsc->shadow_width, r_sh);
/*Cache the corner if it fits into the cache size*/
@@ -701,7 +716,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
lv_area_t ca;
bool has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.y2 > h_half) ca.y2 = h_half;
if(ca.x1 <= w_half) ca.x1 = w_half + 1;
@@ -737,7 +752,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y2;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.y1 <= h_half) ca.y1 = h_half + 1;
if(ca.x1 <= w_half) ca.x1 = w_half + 1;
@@ -774,7 +789,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y2 - corner_size;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
if(simple_mode) ca.x1 = LV_MATH_MAX(ca.x1, coords->x2);
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -811,7 +826,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
/*Invert the shadow corner buffer and draw the corners on the left*/
sh_buf_tmp = sh_buf ;
for(y = 0; y < corner_size; y++) {
uint32_t x;
int32_t x;
for(x = 0; x < corner_size / 2; x++) {
lv_opa_t tmp = sh_buf_tmp[x];
sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1];
@@ -827,7 +842,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = a.y1 + corner_size - 1;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.y2 > h_half) ca.y2 = h_half;
if(ca.x2 > w_half) ca.x2 = w_half;
@@ -863,7 +878,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y2;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.y1 <= h_half) ca.y1 = h_half + 1;
if(ca.x2 > w_half) ca.x2 = w_half;
@@ -899,8 +914,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y2 - corner_size;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
if(simple_mode) ca.x2 = LV_MATH_MIN(coords->x1, ca.x2);
/*Draw vertical lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -938,7 +952,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y1 + corner_size - 1;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
if(simple_mode) ca.y2 = LV_MATH_MIN(ca.y2, coords->y1);
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -980,7 +994,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y2;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com) {
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
if(simple_mode) ca.y1 = LV_MATH_MAX(ca.y1, coords->y2);
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -1019,7 +1033,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
a.y2 = sh_area.y2 - corner_size;
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com && simple_mode == false) {
if(has_com && simple_mode == false && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);
lv_coord_t h = lv_area_get_height(&ca);
@@ -1097,7 +1111,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
_lv_mem_buf_release(mask_line);
if(sw == 1) {
uint32_t i;
int32_t i;
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
for(i = 0; i < size * size; i++) {
res_buf[i] = (sh_buf[i] >> SHADOW_UPSACALE_SHIFT);
@@ -1126,7 +1140,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
shadow_blur_corner(size, sw, sh_buf);
}
uint32_t x;
int32_t x;
lv_opa_t * res_buf = (lv_opa_t *)sh_buf;
for(x = 0; x < size * size; x++) {
res_buf[x] = sh_buf[x];

View File

@@ -60,7 +60,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
uint32_t px = dsc->header.w * y * px_size + x * px_size;
_lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
#if LV_COLOR_SIZE == 32
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a deafult alpha value*/
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a default alpha value*/
#endif
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
@@ -414,7 +414,7 @@ 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 tranform an image
* Initialize a descriptor to transform an image
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
*/
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
@@ -471,6 +471,15 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
lv_point_t * pivot)
{
#if LV_USE_IMG_TRANSFORM
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) {
res->x1 = 0;
res->y1 = 0;
res->x2 = w - 1;
res->y2 = h - 1;
return;
}
int32_t angle_low = angle / 10;
int32_t angle_hight = angle_low + 1;
int32_t angle_rem = angle - (angle_low * 10);
@@ -523,10 +532,13 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
res->y1 = LV_MATH_MIN4(lb.y, lt.y, rb.y, rt.y);
res->y2 = LV_MATH_MAX4(lb.y, lt.y, rb.y, rt.y);
#else
LV_UNUSED(angle);
LV_UNUSED(zoom);
LV_UNUSED(pivot);
res->x1 = 0;
res->y1 = 0;
res->x2 = w;
res->y2 = h;
res->x2 = w - 1;
res->y2 = h - 1;
#endif
}
@@ -542,7 +554,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
/*Get the fractional part of the source pixel*/
int xs_fract = dsc->tmp.xs & 0xff;
int ys_fract = dsc->tmp.ys & 0xff;
int32_t xn; /*x neightboor*/
int32_t xn; /*x neighbor*/
lv_opa_t xr; /*x mix ratio*/
if(xs_fract < 0x70) {
@@ -560,7 +572,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
xr = 0xFF;
}
int32_t yn; /*x neightboor*/
int32_t yn; /*x neighbor*/
lv_opa_t yr; /*x mix ratio*/
if(ys_fract < 0x70) {

View File

@@ -102,10 +102,26 @@ typedef uint8_t lv_img_cf_t;
/**
* LVGL image header
*/
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c
* On big endian systems the order is reversed so cf and always_zero must be at
* the end of the struct.
* */
#if LV_BIG_ENDIAN_SYSTEM
typedef struct {
uint32_t h : 11; /*Height of the image map*/
uint32_t w : 11; /*Width of the image map*/
uint32_t reserved : 2; /*Reserved to be used later*/
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
non-printable character*/
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
} lv_img_header_t;
#else
typedef struct {
/* The first 8 bit is very important to distinguish the different source types.
* For more info see `lv_img_get_src_type()` in lv_img.c */
uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
non-printable character*/
@@ -115,7 +131,7 @@ typedef struct {
uint32_t w : 11; /*Width of the image map*/
uint32_t h : 11; /*Height of the image map*/
} lv_img_header_t;
#endif
/** Image header it is compatible with
* the result from image converter utility*/

View File

@@ -6,7 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "lv_img_cache.h"
#include "lv_img_decoder.h"
#include "lv_draw_img.h"

View File

@@ -7,7 +7,7 @@
* INCLUDES
*********************/
#include "lv_img_decoder.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_img.h"
#include "../lv_misc/lv_ll.h"
#include "../lv_misc/lv_color.h"
@@ -568,6 +568,11 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d
return LV_RES_OK;
#else
LV_UNUSED(dsc);
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(len);
LV_UNUSED(buf);
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif

View File

@@ -171,6 +171,10 @@ LV_FONT_DECLARE(lv_font_montserrat_30)
LV_FONT_DECLARE(lv_font_montserrat_32)
#endif
#if LV_FONT_MONTSERRAT_34
LV_FONT_DECLARE(lv_font_montserrat_34)
#endif
#if LV_FONT_MONTSERRAT_36
LV_FONT_DECLARE(lv_font_montserrat_36)
#endif

View File

@@ -8,7 +8,7 @@
*********************/
#include "lv_font.h"
#include "lv_font_fmt_txt.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_log.h"
@@ -214,7 +214,8 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_8[rcp];
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
uint8_t * p = _lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
uint16_t key = rcp;
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
@@ -224,7 +225,8 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
}
}
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
uint8_t * p = _lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
uint16_t key = rcp;
uint8_t * p = _lv_utils_bsearch(&key, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
if(p) {
@@ -384,7 +386,7 @@ static inline void decompress_line(uint8_t * out, lv_coord_t w)
/**
* Read bits from an input buffer. The read can cross byte boundary.
* @param in the input buffer to read from.
* @param bit_pos index of teh first bit to read.
* @param bit_pos index of the first bit to read.
* @param len number of bits to read (must be <= 8).
* @return the read bits
*/

View File

@@ -135,7 +135,7 @@ typedef struct {
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 + (righ_class-1)]
3. value = class_pair_values[(left_class-1)*right_class_cnt + (right_class-1)]
*/
const int8_t * class_pair_values; /*left_class_num * right_class_num value*/
@@ -155,7 +155,7 @@ typedef enum {
/*Describe store additional data for fonts */
typedef struct {
/*The bitmaps os all glyphs*/
/*The bitmaps of all glyphs*/
const uint8_t * glyph_bitmap;
/*Describe the glyphs*/

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,7 @@ extern "C" {
#include "../lv_conf_internal.h"
/*-------------------------------
* Symbols from FontAwsome font
* Symbols from FontAwesome font
*-----------------------------*/
/* In the font converter use this list as range:

View File

@@ -11,19 +11,14 @@
#if LV_USE_GPU_STM32_DMA2D
#if defined(STM32F4)
#include "stm32f4xx_hal.h"
#elif defined(STM32F7)
#include "stm32f7xx_hal.h"
#else
#error "Not supported STM32 family to use DMA2D"
#endif
#include LV_GPU_DMA2D_CMSIS_INCLUDE
/*********************
* DEFINES
*********************/
#if LV_COLOR_16_SWAP
// TODO: F7 has red blue swap bit in control register for all layers and output
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
#endif
@@ -32,11 +27,9 @@
#endif
#if LV_COLOR_DEPTH == 16
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_RGB565
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_RGB565
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_RGB565
#elif LV_COLOR_DEPTH == 32
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_ARGB8888
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_ARGB8888
#define LV_DMA2D_COLOR_FORMAT LV_DMA2D_ARGB8888
#else
/*Can't use GPU with other formats*/
#endif
@@ -54,7 +47,6 @@ static void dma2d_wait(void);
/**********************
* STATIC VARIABLES
**********************/
static DMA2D_HandleTypeDef hdma2d;
/**********************
* MACROS
@@ -64,6 +56,21 @@ static DMA2D_HandleTypeDef hdma2d;
* GLOBAL FUNCTIONS
**********************/
/**
* Turn on the peripheral and set output color mode, this only needs to be done once
*/
void lv_gpu_stm32_dma2d_init(void)
{
/* Enable DMA2D clock */
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
/* Delay after setting peripheral clock */
volatile uint32_t temp = RCC->AHB1ENR;
/* set output colour mode */
DMA2D->OPFCCR = LV_DMA2D_COLOR_FORMAT;
}
/**
* Fill an area in the buffer with a color
* @param buf a buffer which should be filled
@@ -77,18 +84,16 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
{
invalidate_cache();
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_R2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
hdma2d.Init.OutputOffset = buf_w - fill_w;
hdma2d.LayerCfg[1].InputAlpha = DMA2D_NO_MODIF_ALPHA;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
hdma2d.LayerCfg[1].InputOffset = 0;
DMA2D->CR = 0x30000;
DMA2D->OMAR = (uint32_t)buf;
/* as input color mode is same as output we don't need to convert here do we? */
DMA2D->OCOLR = color.full;
DMA2D->OOR = buf_w - fill_w;
DMA2D->NLR = (fill_w << DMA2D_NLR_PL_Pos) | (fill_h << DMA2D_NLR_NL_Pos);
/* start transfer */
DMA2D->CR |= DMA2D_CR_START_Msk;
/* DMA2D Initialization */
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
HAL_DMA2D_Start(&hdma2d, (uint32_t)lv_color_to32(color), (uint32_t)buf, fill_w, fill_h);
dma2d_wait();
}
@@ -106,6 +111,7 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
{
#if 0
invalidate_cache();
/* Configure the DMA2D Mode, Color Mode and line output offset */
@@ -134,6 +140,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
dma2d_wait();
#endif
}
/**
@@ -141,7 +148,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
* @param buf a buffer where map should be copied
* @param buf_w width of the buffer in pixels
* @param map an "image" to copy
* @param map_w width of teh map in pixels
* @param map_w width of the map in pixels
* @param copy_w width of the area to copy in pixels (<= buf_w)
* @param copy_h height of the area to copy in pixels
* @note `map_w - fill_w` is offset to the next line after copy
@@ -151,22 +158,17 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
{
invalidate_cache();
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
hdma2d.Init.OutputOffset = buf_w - copy_w;
DMA2D->CR = 0;
/* copy output colour mode, this register controls both input and output colour format */
DMA2D->FGPFCCR = LV_DMA2D_COLOR_FORMAT;
DMA2D->FGMAR = (uint32_t)map;
DMA2D->FGOR = map_w - copy_w;
DMA2D->OMAR = (uint32_t)buf;
DMA2D->OOR = buf_w - copy_w;
DMA2D->NLR = (copy_w << DMA2D_NLR_PL_Pos) | (copy_h << DMA2D_NLR_NL_Pos);
/* Foreground layer */
hdma2d.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
hdma2d.LayerCfg[1].InputAlpha = 0xFF;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
/* DMA2D Initialization */
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
HAL_DMA2D_Start(&hdma2d, (uint32_t)map, (uint32_t)buf, copy_w, copy_h);
/* start transfer */
DMA2D->CR |= DMA2D_CR_START_Msk;
dma2d_wait();
}
@@ -176,7 +178,7 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
* @param buf_w width of the buffer in pixels
* @param map an "image" to copy
* @param opa opacity of `map`
* @param map_w width of teh map in pixels
* @param map_w width of the map in pixels
* @param copy_w width of the area to copy in pixels (<= buf_w)
* @param copy_h height of the area to copy in pixels
* @note `map_w - fill_w` is offset to the next line after copy
@@ -185,28 +187,26 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
{
invalidate_cache();
DMA2D->CR = 0x20000;
hdma2d.Instance = DMA2D;
hdma2d.Init.Mode = DMA2D_M2M_BLEND;
hdma2d.Init.ColorMode = DMA2D_OUTPUT_FORMAT;
hdma2d.Init.OutputOffset = buf_w - copy_w;
DMA2D->BGPFCCR = LV_DMA2D_COLOR_FORMAT;
DMA2D->BGMAR = (uint32_t)buf;
DMA2D->BGOR = buf_w - copy_w;
/* Background layer */
hdma2d.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA;
hdma2d.LayerCfg[0].InputColorMode = DMA2D_INPUT_FORMAT;
hdma2d.LayerCfg[0].InputOffset = buf_w - copy_w;
DMA2D->FGPFCCR = (uint32_t)LV_DMA2D_COLOR_FORMAT
/* alpha mode 2, replace with foreground * alpha value */
| (2 << DMA2D_FGPFCCR_AM_Pos)
/* alpha value */
| (opa << DMA2D_FGPFCCR_ALPHA_Pos);
DMA2D->FGMAR = (uint32_t)map;
DMA2D->FGOR = map_w - copy_w;
/* Foreground layer */
hdma2d.LayerCfg[1].AlphaMode = DMA2D_COMBINE_ALPHA;
hdma2d.LayerCfg[1].InputAlpha = opa;
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
DMA2D->OMAR = (uint32_t)buf;
DMA2D->OOR = buf_w - copy_w;
DMA2D->NLR = (copy_w << DMA2D_NLR_PL_Pos) | (copy_h << DMA2D_NLR_NL_Pos);
/* DMA2D Initialization */
HAL_DMA2D_Init(&hdma2d);
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t)map, (uint32_t)buf, (uint32_t)buf, copy_w, copy_h);
/* start transfer */
DMA2D->CR |= DMA2D_CR_START_Msk;
dma2d_wait();
}
@@ -226,7 +226,7 @@ static void invalidate_cache(void)
static void dma2d_wait(void)
{
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
while(HAL_DMA2D_PollForTransfer(&hdma2d, 0) == HAL_TIMEOUT) {
while(DMA2D->CR & DMA2D_CR_START_Msk) {
if(disp->driver.wait_cb) disp->driver.wait_cb(&disp->driver);
}
}

View File

@@ -20,6 +20,12 @@ extern "C" {
* DEFINES
*********************/
#define LV_DMA2D_ARGB8888 0
#define LV_DMA2D_RGB888 1
#define LV_DMA2D_RGB565 2
#define LV_DMA2D_ARGB1555 3
#define LV_DMA2D_ARGB4444 4
/**********************
* TYPEDEFS
**********************/
@@ -28,6 +34,11 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/
/**
* Turn on the peripheral and set output color mode, this only needs to be done once
*/
void lv_gpu_stm32_dma2d_init(void);
/**
* Fill an area in the buffer with a color
* @param buf a buffer which should be filled
@@ -60,7 +71,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
* @param buf a buffer where map should be copied
* @param buf_w width of the buffer in pixels
* @param map an "image" to copy
* @param map_w width of teh map in pixels
* @param map_w width of the map in pixels
* @param copy_w width of the area to copy in pixels (<= buf_w)
* @param copy_h height of the area to copy in pixels
* @note `map_w - fill_w` is offset to the next line after copy
@@ -73,7 +84,7 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
* @param buf_w width of the buffer in pixels
* @param map an "image" to copy
* @param opa opacity of `map`
* @param map_w width of teh map in pixels
* @param map_w width of the map in pixels
* @param copy_w width of the area to copy in pixels (<= buf_w)
* @param copy_h height of the area to copy in pixels
* @note `map_w - fill_w` is offset to the next line after copy

View File

@@ -14,7 +14,7 @@
#include "lv_hal.h"
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_gc.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_obj.h"
#include "../lv_core/lv_refr.h"
#include "../lv_themes/lv_theme.h"
@@ -158,6 +158,11 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
lv_task_ready(disp->refr_task); /*Be sure the screen will be refreshed immediately on start up*/
/*Can't handle this case later so add an error*/
if(lv_disp_is_true_double_buf(disp) && disp->driver.set_px_cb) {
LV_LOG_ERROR("Can't handle 2 screen sized buffers with set_px_cb. Display will not be refreshed.");
}
return disp;
}
@@ -257,6 +262,7 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp)
bool lv_disp_get_antialiasing(lv_disp_t * disp)
{
#if LV_ANTIALIAS == 0
LV_UNUSED(disp);
return false;
#else
if(disp == NULL) disp = lv_disp_get_default();
@@ -271,7 +277,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp)
* @param disp pointer to a display (NULL to use the default display)
* @return dpi of the display
*/
uint32_t lv_disp_get_dpi(lv_disp_t * disp)
lv_coord_t lv_disp_get_dpi(lv_disp_t * disp)
{
if(disp == NULL) disp = lv_disp_get_default();
if(disp == NULL) return LV_DPI; /*Do not return 0 because it might be a divider*/

View File

@@ -255,7 +255,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp);
* @param disp pointer to a display (NULL to use the default display)
* @return dpi of the display
*/
uint32_t lv_disp_get_dpi(lv_disp_t * disp);
lv_coord_t lv_disp_get_dpi(lv_disp_t * disp);
/**
* Get the size category of the display based on it's hor. res. and dpi.

View File

@@ -8,7 +8,7 @@
/*********************
* INCLUDES
*********************/
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal_indev.h"
#include "../lv_core/lv_indev.h"
#include "../lv_misc/lv_mem.h"
@@ -73,7 +73,7 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
if(driver->disp == NULL) driver->disp = lv_disp_get_default();
if(driver->disp == NULL) {
LV_LOG_WARN("lv_indev_drv_register: no display registered hence can't attache the indev to "
LV_LOG_WARN("lv_indev_drv_register: no display registered hence can't attach the indev to "
"a display");
return NULL;
}
@@ -143,6 +143,11 @@ bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
else if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) {
data->key = indev->proc.types.keypad.last_key;
}
/*For compatibility assume that used button was enter (encoder push) */
else if(indev->driver.type == LV_INDEV_TYPE_ENCODER) {
data->key = LV_KEY_ENTER;
data->enc_diff = 0;
}
if(indev->driver.read_cb) {
LV_LOG_TRACE("idnev read started");

View File

@@ -137,7 +137,7 @@ typedef struct _lv_indev_proc_t {
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
lv_point_t drag_throw_vect;
struct _lv_obj_t * act_obj; /*The object being pressed*/
struct _lv_obj_t * last_obj; /*The last obejct which was pressed (used by dragthrow and
struct _lv_obj_t * last_obj; /*The last object which was pressed (used by drag_throw and
other post-release event)*/
struct _lv_obj_t * last_pressed; /*The lastly pressed object*/

View File

@@ -56,12 +56,17 @@ LV_ATTRIBUTE_TICK_INC void lv_tick_inc(uint32_t tick_period)
uint32_t lv_tick_get(void)
{
#if LV_TICK_CUSTOM == 0
/* If `lv_tick_inc` is called from an interrupt while `sys_time` is read
* the result might be corrupted.
* This loop detects if `lv_tick_inc` was called while reading `sys_time`.
* If `tick_irq_flag` was cleared in `lv_tick_inc` try to read again
* until `tick_irq_flag` remains `1`. */
uint32_t result;
do {
tick_irq_flag = 1;
result = sys_time;
} while(!tick_irq_flag); /*'lv_tick_inc()' clears this flag which can be in an interrupt.
Continue until make a non interrupted cycle */
} while(!tick_irq_flag); /*Continue until see a non interrupted cycle */
return result;
#else

View File

@@ -11,7 +11,7 @@
#if LV_USE_ANIMATION
#include <stddef.h>
#include <string.h>
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal_tick.h"
#include "lv_task.h"
#include "lv_math.h"
@@ -64,7 +64,7 @@ void _lv_anim_core_init(void)
last_task_run = lv_tick_get();
_lv_anim_task = lv_task_create(anim_task, LV_DISP_DEF_REFR_PERIOD, LV_ANIM_TASK_PRIO, NULL);
anim_mark_list_change(); /*Turn off the animation task*/
anim_list_changed = false; /*The list has not actaully changed*/
anim_list_changed = false; /*The list has not actually changed*/
}
/**
@@ -73,7 +73,6 @@ void _lv_anim_core_init(void)
* lv_anim_t a;
* lv_anim_init(&a);
* lv_anim_set_...(&a);
* lv_anim_craete(&a);
* @param a pointer to an `lv_anim_t` variable to initialize
*/
void lv_anim_init(lv_anim_t * a)
@@ -224,6 +223,8 @@ void lv_anim_refr_now(void)
*/
lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t step;
if(a->time == a->act_time) {
@@ -250,6 +251,8 @@ lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t
*/
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
if(a->time == a->act_time)
@@ -274,6 +277,8 @@ lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_
*/
lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
@@ -299,6 +304,8 @@ lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim
*/
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
@@ -324,6 +331,8 @@ lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_a
*/
lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
@@ -350,6 +359,8 @@ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_ani
*/
lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
if(a->time == a->act_time)
@@ -412,6 +423,8 @@ lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t
*/
lv_anim_value_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
if(a->act_time >= a->time)
return a->end;
else
@@ -487,7 +500,7 @@ static void anim_task(lv_task_t * param)
* Called when an animation is ready to do the necessary thinks
* e.g. repeat, play back, delete etc.
* @param a pointer to an animation descriptor
* @return true: animation delete occurred nnd the `LV_GC_ROOT(_lv_anim_ll)` has changed
* @return true: animation delete occurred and the `LV_GC_ROOT(_lv_anim_ll)` has changed
* */
static bool anim_ready_handler(lv_anim_t * a)
{
@@ -515,11 +528,11 @@ static bool anim_ready_handler(lv_anim_t * a)
}
/*If the animation is not deleted then restart it*/
else {
a->act_time = -a->repeat_delay; /*Restart the animation*/
a->act_time = -(int32_t)(a->repeat_delay); /*Restart the animation*/
/*Swap the start and end values in play back mode*/
if(a->playback_time != 0) {
/*If now turning back use the 'playback_pause*/
if(a->playback_now == 0) a->act_time = -a->playback_delay;
if(a->playback_now == 0) a->act_time = -(int32_t)(a->playback_delay);
/*Toggle the play back state*/
a->playback_now = a->playback_now == 0 ? 1 : 0;

View File

@@ -83,7 +83,7 @@ typedef struct _lv_anim_t {
lv_anim_path_t path; /**< Describe the path (curve) of animations*/
int32_t start; /**< Start value*/
int32_t end; /**< End value*/
uint32_t time; /**< Animation time in ms*/
int32_t time; /**< Animation time in ms*/
int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/
uint32_t playback_delay; /**< Wait before play back*/
uint32_t playback_time; /**< Duration of playback animation*/
@@ -116,7 +116,6 @@ void _lv_anim_core_init(void);
* lv_anim_t a;
* lv_anim_init(&a);
* lv_anim_set_...(&a);
* lv_anim_create(&a);
* @param a pointer to an `lv_anim_t` variable to initialize
*/
void lv_anim_init(lv_anim_t * a);
@@ -160,7 +159,7 @@ static inline void lv_anim_set_time(lv_anim_t * a, uint32_t duration)
*/
static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay)
{
a->act_time = (int32_t)(-delay);
a->act_time = -(int32_t)(delay);
}
/**

View File

@@ -44,7 +44,7 @@ struct _lv_obj_t;
/**
* Call an asynchronous function the next time lv_task_handler() is run. This function is likely to return
* **before** the call actually happens!
* @param task_xcb a callback which is the task itself.
* @param async_xcb a callback which is the task itself.
* (the 'x' in the argument name indicates that its not a fully generic function because it not follows
* the `func_name(object, callback, ...)` convention)
* @param user_data custom parameter

View File

@@ -130,8 +130,8 @@ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt)
* Can be `NULL` is unused
* @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 vicual_pos the visual character position which logical position should be get
* @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context
* @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
* @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,
@@ -207,7 +207,7 @@ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
* Bidi process a paragraph of text
* @param str_in the string to process
* @param str_out store the result here
* @param len length of teh text
* @param len length of the text
* @param base_dir base dir of the text
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
* Can be `NULL` is unused

View File

@@ -71,8 +71,8 @@ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt);
* Can be `NULL` is unused
* @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 vicual_pos the visual character position which logical position should be get
* @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context
* @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
* @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,
@@ -97,7 +97,7 @@ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
* Bidi process a paragraph of text
* @param str_in the string to process
* @param str_out store the result here
* @param len length of teh text
* @param len length of the text
* @param base_dir base dir of the text
* @param pos_conv_out an `uint16_t` array to store the related logical position of the character.
* Can be `NULL` is unused

View File

@@ -72,8 +72,8 @@ enum {
LV_OPA_COVER = 255,
};
#define LV_OPA_MIN 5 /*Opacities below this will be transparent*/
#define LV_OPA_MAX 250 /*Opacities above this will fully cover*/
#define LV_OPA_MIN 2 /*Opacities below this will be transparent*/
#define LV_OPA_MAX 253 /*Opacities above this will fully cover*/
#if LV_COLOR_DEPTH == 1
#define LV_COLOR_SIZE 8
@@ -88,6 +88,22 @@ enum {
#endif
/* Adjust color mix functions rounding.
* GPUs might calculate color mix (blending) differently.
* Should be in range of 0..254
* 0: no adjustment, get the integer part of the result (round down)
* 64: round up from x.75
* 128: round up from half
* 192: round up from x.25
* 254: round up */
#ifndef LV_COLOR_MIX_ROUND_OFS
#if LV_COLOR_DEPTH == 32
#define LV_COLOR_MIX_ROUND_OFS 0
#else
#define LV_COLOR_MIX_ROUND_OFS 128
#endif
#endif
/*---------------------------------------
* Macros for all existing color depths
* to set/get values of the color channels
@@ -440,9 +456,12 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix(lv_color_t c1, lv_co
lv_color_t ret;
#if LV_COLOR_DEPTH != 1
/*LV_COLOR_DEPTH == 8, 16 or 32*/
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) * (255 - mix)));
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) * (255 - mix)));
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) * (255 - mix)));
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) *
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) *
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) *
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_A(ret, 0xFF);
#else
/*LV_COLOR_DEPTH == 1*/
@@ -459,6 +478,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_premult(lv_color_t c, uint8_t
out[1] = (uint16_t) LV_COLOR_GET_G(c) * mix;
out[2] = (uint16_t) LV_COLOR_GET_B(c) * mix;
#else
(void) mix;
/*Pre-multiplication can't be used with 1 bpp*/
out[0] = LV_COLOR_GET_R(c);
out[1] = LV_COLOR_GET_G(c);
@@ -482,9 +502,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, (uint16_t)((uint16_t) premult_c1[0] + LV_COLOR_GET_R(c2) * mix) >> 8);
LV_COLOR_SET_G(ret, (uint16_t)((uint16_t) premult_c1[1] + LV_COLOR_GET_G(c2) * mix) >> 8);
LV_COLOR_SET_B(ret, (uint16_t)((uint16_t) premult_c1[2] + LV_COLOR_GET_B(c2) * mix) >> 8);
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) premult_c1[0] + LV_COLOR_GET_R(c2) * mix + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) premult_c1[1] + LV_COLOR_GET_G(c2) * mix + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) 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*/
@@ -533,9 +553,9 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_c
/*Save the parameters and the result. If they will be asked again don't compute again*/
static lv_opa_t fg_opa_save = 0;
static lv_opa_t bg_opa_save = 0;
static lv_color_t fg_color_save = {{0}};
static lv_color_t bg_color_save = {{0}};
static lv_color_t res_color_saved = {{0}};
static lv_color_t fg_color_save = {.full = 0};
static lv_color_t bg_color_save = {.full = 0};
static lv_color_t res_color_saved = {.full = 0};
static lv_opa_t res_opa_saved = 0;
if(fg_opa != fg_opa_save || bg_opa != bg_opa_save || fg_color.full != fg_color_save.full ||

View File

@@ -6,11 +6,13 @@
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "lv_debug.h"
#if LV_USE_DEBUG
#include "lv_mem.h"
#include <string.h>
/*********************
* DEFINES
*********************/
@@ -28,7 +30,6 @@
/**********************
* STATIC PROTOTYPES
**********************/
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
/**********************
* STATIC VARIABLES
@@ -54,68 +55,6 @@ bool lv_debug_check_mem_integrity(void)
return lv_mem_test() == LV_RES_OK ? true : false;
}
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
{
if(obj_type[0] == '\0') return true;
lv_obj_type_t types;
lv_obj_get_type((lv_obj_t *)obj, &types);
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
if(types.type[i] == NULL) break;
if(strcmp(types.type[i], obj_type) == 0) return true;
}
return false;
}
bool lv_debug_check_obj_valid(const lv_obj_t * obj)
{
lv_disp_t * disp = lv_disp_get_next(NULL);
while(disp) {
lv_obj_t * scr;
_LV_LL_READ(disp->scr_ll, scr) {
if(scr == obj) return true;
bool found = obj_valid_child(scr, obj);
if(found) return true;
}
disp = lv_disp_get_next(disp);
}
return false;
}
bool lv_debug_check_style(const lv_style_t * style)
{
if(style == NULL) return true; /*NULL style is still valid*/
#if LV_USE_ASSERT_STYLE
if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
bool lv_debug_check_style_list(const lv_style_list_t * list)
{
if(list == NULL) return true; /*NULL list is still valid*/
#if LV_USE_ASSERT_STYLE
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
bool lv_debug_check_str(const void * str)
{
const uint8_t * s = (const uint8_t *)str;
@@ -196,20 +135,6 @@ void lv_debug_log_error(const char * msg, uint64_t value)
* STATIC FUNCTIONS
**********************/
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
{
/*Check all children of `parent`*/
lv_obj_t * child;
_LV_LL_READ(parent->child_ll, child) {
if(child == obj_to_find) return true;
/*Check the children*/
bool found = obj_valid_child(child, obj_to_find);
if(found) return true;
}
return false;
}
#endif /*LV_USE_DEBUG*/

View File

@@ -13,9 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_obj.h"
#include "../lv_conf_internal.h"
#if LV_USE_DEBUG
#include <stdbool.h>
/*********************
* DEFINES
@@ -32,14 +33,6 @@ bool lv_debug_check_null(const void * p);
bool lv_debug_check_mem_integrity(void);
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
bool lv_debug_check_style(const lv_style_t * style);
bool lv_debug_check_style_list(const lv_style_list_t * list);
bool lv_debug_check_str(const void * str);
void lv_debug_log_error(const char * msg, uint64_t value);
@@ -77,20 +70,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
lv_debug_check_str(str))
#endif
#ifndef LV_DEBUG_IS_OBJ
#define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \
lv_debug_check_obj_valid(obj_p) && \
lv_debug_check_obj_type(obj_p, obj_type))
#endif
#ifndef LV_DEBUG_IS_STYLE
#define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
#endif
#ifndef LV_DEBUG_IS_STYLE_LIST
#define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
#endif
/*-----------------
* ASSERTS
*-----------------*/
@@ -133,30 +112,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
# endif
#endif
#if LV_USE_ASSERT_OBJ
# ifndef LV_ASSERT_OBJ
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p);
# endif
#else /* LV_USE_ASSERT_OBJ == 0 */
# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p)
# else
# define LV_ASSERT_OBJ(obj_p, obj_type) true
# endif
#endif
#if LV_USE_ASSERT_STYLE
# ifndef LV_ASSERT_STYLE
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
# endif
# ifndef LV_ASSERT_STYLE_LIST
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
# endif
#else
# define LV_ASSERT_STYLE(style_p) true
# define LV_ASSERT_STYLE_LIST(list_p) true
#endif
#else /* LV_USE_DEBUG == 0 */
@@ -167,8 +122,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
#define LV_ASSERT_MEM_INTEGRITY() true
#define LV_ASSERT_STR(p) true
#define LV_ASSERT_OBJ(obj, obj_type) true
#define LV_ASSERT_STYLE(p) true
#define LV_ASSERT_STYLE_LIST(p) true
#endif /* LV_USE_DEBUG */
/*clang-format on*/

View File

@@ -9,7 +9,7 @@
#include "lv_fs.h"
#if LV_USE_FILESYSTEM
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "lv_ll.h"
#include <string.h>
#include "lv_gc.h"
@@ -60,7 +60,7 @@ void _lv_fs_init(void)
}
/**
* Test if a drive is rady or not. If the `ready` function was not initialized `true` will be
* Test if a drive is ready or not. If the `ready` function was not initialized `true` will be
* returned.
* @param letter letter of the drive
* @return true: drive is ready; false: drive is not ready

View File

@@ -129,7 +129,7 @@ void lv_fs_drv_register(lv_fs_drv_t * drv_p);
lv_fs_drv_t * lv_fs_get_drv(char letter);
/**
* Test if a drive is rady or not. If the `ready` function was not initialized `true` will be
* Test if a drive is ready or not. If the `ready` function was not initialized `true` will be
* returned.
* @param letter letter of the drive
* @return true: drive is ready; false: drive is not ready

View File

@@ -19,7 +19,7 @@ extern "C" {
#include "lv_ll.h"
#include "lv_task.h"
#include "../lv_draw/lv_img_cache.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_draw_mask.h"
/*********************
* DEFINES
@@ -36,8 +36,13 @@ extern "C" {
f(lv_ll_t, _lv_img_defoder_ll) \
f(lv_ll_t, _lv_obj_style_trans_ll) \
f(lv_img_cache_entry_t*, _lv_img_cache_array) \
f(lv_task_t*, _lv_task_act) \
f(lv_task_t*, _lv_task_act) \
f(lv_mem_buf_arr_t , _lv_mem_buf) \
f(_lv_draw_mask_saved_arr_t , _lv_draw_mask_list) \
f(void * , _lv_theme_material_styles) \
f(void * , _lv_theme_template_styles) \
f(void * , _lv_theme_mono_styles) \
f(void * , _lv_theme_empty_styles) \
#define LV_DEFINE_ROOT(root_type, root_name) root_type root_name;
#define LV_ROOTS LV_ITERATE_ROOTS(LV_DEFINE_ROOT)

View File

@@ -51,18 +51,12 @@ void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size)
{
ll_p->head = NULL;
ll_p->tail = NULL;
#ifdef LV_MEM_ENV64
#ifdef LV_ARCH_64
/*Round the size up to 8*/
if(node_size & 0x7) {
node_size = node_size & (~0x7);
node_size += 8;
}
node_size = (node_size + 7) & (~0x7);
#else
/*Round the size up to 4*/
if(node_size & 0x3) {
node_size = node_size & (~0x3);
node_size += 4;
}
node_size = (node_size + 3) & (~0x3);
#endif
ll_p->n_size = node_size;
@@ -140,7 +134,7 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p)
if(n_new != NULL) {
node_set_next(ll_p, n_new, NULL); /*No next after the new tail*/
node_set_prev(ll_p, n_new, ll_p->tail); /*The prev. before new is tho old tail*/
node_set_prev(ll_p, n_new, ll_p->tail); /*The prev. before new is the old tail*/
if(ll_p->tail != NULL) { /*If there is old tail then the new comes after it*/
node_set_next(ll_p, ll_p->tail, n_new);
}
@@ -295,14 +289,13 @@ void * _lv_ll_get_tail(const lv_ll_t * ll_p)
*/
void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
{
void * next = NULL;
if(ll_p == NULL) return NULL;
if(ll_p != NULL) {
const lv_ll_node_t * n_act_d = n_act;
_lv_memcpy_small(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
}
return next;
/* Pointer to the next node is stored in the end of this node.
* Go there and return the address found there */
const lv_ll_node_t * n_act_d = n_act;
n_act_d += LL_NEXT_P_OFFSET(ll_p);
return *((lv_ll_node_t **)n_act_d);
}
/**
@@ -313,14 +306,13 @@ void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
*/
void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
{
void * prev = NULL;
if(ll_p == NULL) return NULL;
if(ll_p != NULL) {
const lv_ll_node_t * n_act_d = n_act;
_lv_memcpy_small(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
}
return prev;
/* Pointer to the prev. node is stored in the end of this node.
* Go there and return the address found there */
const lv_ll_node_t * n_act_d = n_act;
n_act_d += LL_PREV_P_OFFSET(ll_p);
return *((lv_ll_node_t **)n_act_d);
}
/**
@@ -341,7 +333,7 @@ uint32_t _lv_ll_get_len(const lv_ll_t * ll_p)
}
/**
* Move a nodw before an other node in the same linked list
* Move a node before an other node in the same linked list
* @param ll_p pointer to a linked list
* @param n_act pointer to node to move
* @param n_after pointer to a node which should be after `n_act`
@@ -393,7 +385,7 @@ bool _lv_ll_is_empty(lv_ll_t * ll_p)
**********************/
/**
* Set the 'pervious node pointer' of a node
* Set the previous node pointer of a node
* @param ll_p pointer to linked list
* @param act pointer to a node which prev. node pointer should be set
* @param prev pointer to a node which should be the previous node before 'act'
@@ -402,11 +394,14 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
{
if(act == NULL) return; /*Can't set the prev node of `NULL`*/
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(prev)
_lv_memcpy_small(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
else
_lv_memset_00(act + LL_PREV_P_OFFSET(ll_p), node_p_size);
uint8_t * act8 = (uint8_t *) act;
act8 += LL_PREV_P_OFFSET(ll_p);
lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8;
lv_ll_node_t ** prev_node_p = (lv_ll_node_t **) &prev;
*act_node_p = *prev_node_p;
}
/**
@@ -418,10 +413,11 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next)
{
if(act == NULL) return; /*Can't set the next node of `NULL`*/
uint8_t * act8 = (uint8_t *) act;
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(next)
_lv_memcpy_small(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
else
_lv_memset_00(act + LL_NEXT_P_OFFSET(ll_p), node_p_size);
act8 += LL_NEXT_P_OFFSET(ll_p);
lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8;
lv_ll_node_t ** next_node_p = (lv_ll_node_t **) &next;
*act_node_p = *next_node_p;
}

View File

@@ -139,7 +139,7 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p);
*/
/**
* Move a nodw before an other node in the same linked list
* Move a node before an other node in the same linked list
* @param ll_p pointer to a linked list
* @param n_act pointer to node to move
* @param n_after pointer to a node which should be after `n_act`

View File

@@ -45,7 +45,7 @@ static lv_log_print_g_cb_t custom_print_cb;
/**
* Register custom print/write function to call when a log is added.
* It can format its "File path", "Line number" and "Description" as required
* and send the formatted log message to a consol or serial port.
* and send the formatted log message to a console or serial port.
* @param print_cb a function pointer to print a log
*/
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb)

View File

@@ -56,7 +56,7 @@ typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t
/**
* Register custom print/write function to call when a log is added.
* It can format its "File path", "Line number" and "Description" as required
* and send the formatted log message to a consol or serial port.
* and send the formatted log message to a console or serial port.
* @param print_cb a function pointer to print a log
*/
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb);

View File

@@ -103,7 +103,7 @@ int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3)
/**
* Get the square root of a number
* @param x integer which square root should be calculatoed
* @param x integer which square root should be calculated
* @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit
* @param mask: optional to skip some iterations if the magnitude of the root is known.
* Set to 0x8000 by default.

View File

@@ -92,7 +92,7 @@ uint16_t _lv_atan2(int x, int y);
/**
* Get the square root of a number
* @param x integer which square root should be calculatoed
* @param x integer which square root should be calculated
* @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit
* @param mask: optional to skip some iterations if the magnitude of the root is known.
* Set to 0x8000 by default.

View File

@@ -25,7 +25,7 @@
*********************/
/*Add memory junk on alloc (0xaa) and free(0xbb) (just for testing purposes)*/
#ifndef LV_MEM_ADD_JUNK
#define LV_MEM_ADD_JUNK 1
#define LV_MEM_ADD_JUNK 0
#endif
#ifndef LV_MEM_FULL_DEFRAG_CNT
@@ -86,6 +86,9 @@ typedef struct {
static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/
#if LV_MEM_CUSTOM == 0
static uint32_t mem_max_size; /*Tracks the maximum total size of memory ever used from the internal heap*/
#endif
static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE];
static uint8_t mem_buf2_32[MEM_BUF_SMALL_SIZE];
@@ -108,7 +111,7 @@ static lv_mem_buf_t mem_buf_small[] = {{.p = mem_buf1_32, .size = MEM_BUF_SMALL_
**********************/
/**
* Initiaiize the dyn_mem module (work memory and other variables)
* Initialize the dyn_mem module (work memory and other variables)
*/
void _lv_mem_init(void)
{
@@ -118,6 +121,7 @@ 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
@@ -157,16 +161,10 @@ void * lv_mem_alloc(size_t size)
#ifdef LV_ARCH_64
/*Round the size up to 8*/
if(size & 0x7) {
size = size & (~0x7);
size += 8;
}
size = (size + 7) & (~0x7);
#else
/*Round the size up to 4*/
if(size & 0x3) {
size = size & (~0x3);
size += 4;
}
size = (size + 3) & (~0x3);
#endif
void * alloc = NULL;
@@ -206,7 +204,19 @@ void * lv_mem_alloc(size_t size)
if(alloc != NULL) _lv_memset(alloc, 0xaa, size);
#endif
if(alloc == NULL) LV_LOG_WARN("Couldn't allocate memory");
if(alloc == NULL) {
LV_LOG_WARN("Couldn't allocate memory");
}
else {
#if LV_MEM_CUSTOM == 0
/* just a safety check, should always be true */
if((uintptr_t) alloc > (uintptr_t) work_mem) {
if((((uintptr_t) alloc - (uintptr_t) work_mem) + size) > mem_max_size) {
mem_max_size = ((uintptr_t) alloc - (uintptr_t) work_mem) + size;
}
}
#endif
}
return alloc;
}
@@ -281,16 +291,10 @@ void * lv_mem_realloc(void * data_p, size_t new_size)
#ifdef LV_ARCH_64
/*Round the size up to 8*/
if(new_size & 0x7) {
new_size = new_size & (~0x7);
new_size += 8;
}
new_size = (new_size + 7) & (~0x7);
#else
/*Round the size up to 4*/
if(new_size & 0x3) {
new_size = new_size & (~0x3);
new_size += 4;
}
new_size = (new_size + 3) & (~0x3);
#endif
/*data_p could be previously freed pointer (in this case it is invalid)*/
@@ -436,6 +440,7 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p)
e = ent_get_next(e);
}
mon_p->total_size = LV_MEM_SIZE;
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;
@@ -525,14 +530,13 @@ void * _lv_mem_buf_get(uint32_t 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_LOG_ERROR("lv_mem_buf_get: Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size)")
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_LOG_ERROR("lv_mem_buf_get: no free buffer. Increase LV_DRAW_BUF_MAX_NUM.");
LV_DEBUG_ASSERT(false, "No free buffer. Increase LV_DRAW_BUF_MAX_NUM.", 0x00);
return NULL;
}
@@ -858,18 +862,13 @@ static 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*/
if(size & 0x7) {
size = size & (~0x7);
size += 8;
}
size = (size + 7) & (~0x7);
#else
/*Round the size up to 4*/
if(size & 0x3) {
size = size & (~0x3);
size += 4;
}
size = (size + 3) & (~0x3);
#endif
/*Don't let empty space only for a header without data*/

View File

@@ -41,6 +41,7 @@ typedef struct {
uint32_t free_size; /**< Size of available memory */
uint32_t free_biggest_size;
uint32_t used_cnt;
uint32_t max_used; /**< Max size of Heap memory used */
uint8_t used_pct; /**< Percentage used */
uint8_t frag_pct; /**< Amount of fragmentation */
} lv_mem_monitor_t;
@@ -59,7 +60,7 @@ extern lv_mem_buf_arr_t _lv_mem_buf;
**********************/
/**
* Initiaize the dyn_mem module (work memory and other variables)
* Initialize the dyn_mem module (work memory and other variables)
*/
void _lv_mem_init(void);

View File

@@ -14,7 +14,7 @@ CSRCS += lv_utils.c
CSRCS += lv_async.c
CSRCS += lv_printf.c
CSRCS += lv_bidi.c
CSRCS += lv_txt_ap.c
CSRCS += lv_debug.c
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc

View File

@@ -38,7 +38,7 @@
#include <stdint.h>
#define PRINTF_DISABLE_SUPPORT_FLOAT 1
#define PRINTF_DISABLE_SUPPORT_FLOAT LV_SPRINTF_DISABLE_FLOAT
// 'ntoa' conversion buffer size, this must be big enough to hold one converted
// numeric number including padded zeros (dynamically created on stack)
@@ -56,7 +56,7 @@
// support for the floating point type (%f)
// default: activated
#ifndef PRINTF_DISABLE_SUPPORT_FLOAT
#if !PRINTF_DISABLE_SUPPORT_FLOAT
#define PRINTF_SUPPORT_FLOAT
#endif

View File

@@ -9,7 +9,7 @@
*********************/
#include <stddef.h>
#include "lv_task.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal_tick.h"
#include "lv_gc.h"
@@ -193,9 +193,9 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void)
return time_till_next;
}
/**
* Create an "empty" task. It needs to initialzed with at least
* Create an "empty" task. It needs to initialized with at least
* `lv_task_set_cb` and `lv_task_set_period`
* @return pointer to the craeted task
* @return pointer to the created task
*/
lv_task_t * lv_task_create_basic(void)
{
@@ -256,13 +256,13 @@ lv_task_t * lv_task_create_basic(void)
* @param user_data custom parameter
* @return pointer to the new task
*/
lv_task_t * lv_task_create(lv_task_cb_t task_cb, uint32_t period, lv_task_prio_t prio, void * user_data)
lv_task_t * lv_task_create(lv_task_cb_t task_xcb, uint32_t period, lv_task_prio_t prio, void * user_data)
{
lv_task_t * new_task = lv_task_create_basic();
LV_ASSERT_MEM(new_task);
if(new_task == NULL) return NULL;
lv_task_set_cb(new_task, task_cb);
lv_task_set_cb(new_task, task_xcb);
lv_task_set_period(new_task, period);
lv_task_set_prio(new_task, prio);
new_task->user_data = user_data;
@@ -273,7 +273,7 @@ lv_task_t * lv_task_create(lv_task_cb_t task_cb, uint32_t period, lv_task_prio_t
/**
* Set the callback the task (the function to call periodically)
* @param task pointer to a task
* @param task_cb teh function to call periodically
* @param task_cb the function to call periodically
*/
void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb)
{

View File

@@ -88,9 +88,9 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void);
//! @endcond
/**
* Create an "empty" task. It needs to initialzed with at least
* Create an "empty" task. It needs to initialized with at least
* `lv_task_set_cb` and `lv_task_set_period`
* @return pointer to the craeted task
* @return pointer to the created task
*/
lv_task_t * lv_task_create_basic(void);

View File

@@ -147,7 +147,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t
*
* If the first character is a break character, returns the next index.
*
* Example calls from lv_txt_get_next_line() assuming sufficent max_width and
* Example calls from lv_txt_get_next_line() assuming sufficient max_width and
* txt = "Test text\n"
* 0123456789
*
@@ -169,7 +169,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t
* @param force Force return the fraction of the word that can fit in the provided space.
* @return the index of the first char of the next word (in byte index not letter index. With UTF-8 they are different)
*/
static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
static uint32_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
lv_coord_t letter_space, lv_coord_t max_width,
lv_txt_flag_t flag, uint32_t * word_w_ptr, lv_txt_cmd_state_t * cmd_state, bool force)
{
@@ -290,7 +290,7 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
* @param flags settings for the text from 'txt_flag_type' enum
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different)
*/
uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
{
if(txt == NULL) return 0;
@@ -350,7 +350,7 @@ uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
* @param flags settings for the text from 'txt_flag_t' enum
* @return length of a char_num long text
*/
lv_coord_t _lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space,
lv_txt_flag_t flag)
{
if(txt == NULL) return 0;
@@ -534,6 +534,7 @@ static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni)
*/
static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
{
#if LV_BIG_ENDIAN_SYSTEM == 0
/*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/
if((c & 0x80) != 0) {
uint32_t swapped;
@@ -547,7 +548,7 @@ static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
}
c = swapped;
}
#endif
return c;
}

View File

@@ -84,7 +84,7 @@ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8
* they are different)
*/
uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
lv_txt_flag_t flag);
/**
@@ -97,11 +97,11 @@ uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coor
* @param flags settings for the text from 'txt_flag_t' enum
* @return length of a char_num long text
*/
lv_coord_t _lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space,
lv_txt_flag_t flag);
/**
* Check next character in a string and decide if te character is part of the command or not
* Check next character in a string and decide if the character is part of the command or not
* @param state pointer to a txt_cmd_state_t variable which stores the current state of command
* processing
* @param c the current character

View File

@@ -111,12 +111,14 @@ uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt)
if(current_ap_idx != LV_UNDEF_ARABIC_PERSIAN_CHARS)
ch_enc = ap_chars_map[current_ap_idx].char_end_form;
if(ch_enc <= 0x7F)
if(ch_enc < 0x80)
chars_cnt++;
else if(ch_enc <= 0x7FFF)
else if(ch_enc < 0x0800)
chars_cnt += 2;
else
else if(ch_enc < 0x010000)
chars_cnt += 3;
else
chars_cnt += 4;
i++;
}
@@ -176,18 +178,25 @@ void _lv_txt_ap_proc(const char * txt, char * txt_out)
i = 0;
while(i < txt_length) {
if((ch_enc[i]) <= 0x7F) {
*(txt_out_temp++) = ch_enc[i];
if(ch_enc[i] < 0x80) {
*(txt_out_temp++) = ch_enc[i] & 0xFF;
}
else if(ch_enc[i] <= 0x7FFF) {
*(txt_out_temp++) = 0xC0 | ((ch_enc[i] >> 6) & 0x3F);
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
else if(ch_enc[i] < 0x0800) {
*(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x1F) | 0xC0;
*(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80;
}
else {
*(txt_out_temp++) = 0xE0 | ((ch_enc[i] >> 12) & 0x3F);
*(txt_out_temp++) = 0x80 | ((ch_enc[i] >> 6) & 0x3F);
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
else if(ch_enc[i] < 0x010000) {
*(txt_out_temp++) = ((ch_enc[i] >> 12) & 0x0F) | 0xE0;
*(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x3F) | 0x80;
*(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80;
}
else if(ch_enc[i] < 0x110000) {
*(txt_out_temp++) = ((ch_enc[i] >> 18) & 0x07) | 0xF0;
*(txt_out_temp++) = ((ch_enc[i] >> 12) & 0x3F) | 0x80;
*(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x3F) | 0x80;
*(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80;
}
i++;
}
*(txt_out_temp) = '\0';

View File

@@ -77,6 +77,8 @@ typedef uint32_t lv_uintptr_t;
* MACROS
**********************/
#define LV_UNUSED(x) ((void) x)
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -98,6 +98,15 @@ lv_color_t lv_theme_get_color_primary(void)
return act_theme->color_primary;
}
/**
* Get the secondary color of the theme
* @return the color
*/
lv_color_t lv_theme_get_color_secondary(void)
{
return act_theme->color_secondary;
}
/**
* Get the flags of the theme
* @return the flags

View File

@@ -155,6 +155,7 @@ typedef struct {
const lv_font_t * font_subtitle;
const lv_font_t * font_title;
uint32_t flags;
void * user_data;
} lv_theme_t;
/**********************
@@ -208,6 +209,12 @@ const lv_font_t * lv_theme_get_font_title(void);
*/
lv_color_t lv_theme_get_color_primary(void);
/**
* Get the secondary color of the theme
* @return the color
*/
lv_color_t lv_theme_get_color_secondary(void);
/**
* Get the flags of the theme
* @return the flags

View File

@@ -11,6 +11,12 @@
#if LV_USE_THEME_EMPTY
#include "../lv_misc/lv_gc.h"
#if defined(LV_GC_INCLUDE)
#include LV_GC_INCLUDE
#endif /* LV_ENABLE_GC */
/*********************
* DEFINES
*********************/
@@ -18,18 +24,23 @@
/**********************
* TYPEDEFS
**********************/
typedef struct {
lv_style_t opa_cover;
} theme_styles_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void theme_apply(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 lv_style_t opa_cover;
static theme_styles_t * styles;
static bool inited;
/**********************
* MACROS
@@ -58,8 +69,25 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
const lv_font_t * font_title)
{
lv_style_init(&opa_cover);
lv_style_set_bg_opa(&opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
/* 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_empty_styles) = lv_mem_alloc(sizeof(theme_styles_t));
styles = (theme_styles_t *)LV_GC_ROOT(_lv_theme_empty_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;
style_init_reset(&styles->opa_cover);
lv_style_set_bg_opa(&styles->opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
theme.apply_xcb = theme_apply;
return &theme;
@@ -70,7 +98,7 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
{
if(name == LV_THEME_SCR) {
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &opa_cover);
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover);
}
}
@@ -78,5 +106,10 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
* STATIC FUNCTIONS
**********************/
static void style_init_reset(lv_style_t * style)
{
if(inited) lv_style_reset(style);
else lv_style_init(style);
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,12 @@
#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
*********************/
@@ -18,24 +24,30 @@
* 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_obj_t * obj, lv_theme_style_t name);
/**********************
* STATIC VARIABLES
**********************/
static lv_theme_t theme;
static lv_style_t style_bg;
static lv_style_t style_btn;
static lv_style_t style_round;
static lv_style_t style_color;
static lv_style_t style_gray;
static lv_style_t style_tick_line;
static lv_style_t style_tight;
static lv_theme_t theme;
static theme_styles_t * styles;
static bool inited;
/**********************
* MACROS
@@ -44,57 +56,59 @@ static lv_style_t style_tight;
/**********************
* STATIC FUNCTIONS
**********************/
static void style_init_reset(lv_style_t * style);
static void basic_init(void)
{
lv_style_init(&style_bg);
lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_border_width(&style_bg, LV_STATE_DEFAULT, 1);
lv_style_set_border_width(&style_bg, LV_STATE_FOCUSED, 2);
lv_style_set_border_color(&style_bg, LV_STATE_FOCUSED, theme.color_secondary);
lv_style_set_border_color(&style_bg, LV_STATE_EDITED, lv_color_darken(theme.color_secondary, LV_OPA_30));
lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, 1);
lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, 1);
lv_style_set_scale_end_color(&style_bg, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_text_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_style_set_pad_left(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_right(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_top(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_bottom(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
lv_style_set_pad_inner(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
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);
lv_style_init(&style_btn);
lv_style_set_bg_color(&style_btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, theme.color_primary);
lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, LV_OPA_30));
lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
lv_style_set_image_recolor(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
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);
lv_style_init(&style_round);
lv_style_set_radius(&style_round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
style_init_reset(&styles->round);
lv_style_set_radius(&styles->round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
lv_style_init(&style_color);
lv_style_set_bg_color(&style_color, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_line_color(&style_color, LV_STATE_DEFAULT, theme.color_primary);
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);
lv_style_init(&style_gray);
lv_style_set_bg_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_SILVER);
lv_style_set_line_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_SILVER);
lv_style_set_text_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_GRAY);
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);
lv_style_init(&style_tick_line);
lv_style_set_line_width(&style_tick_line, LV_STATE_DEFAULT, 5);
lv_style_set_scale_end_line_width(&style_tick_line, LV_STATE_DEFAULT, 5);
lv_style_set_scale_end_color(&style_tick_line, LV_STATE_DEFAULT, theme.color_primary);
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);
lv_style_init(&style_tight);
lv_style_set_pad_left(&style_tight, LV_STATE_DEFAULT, 0);
lv_style_set_pad_right(&style_tight, LV_STATE_DEFAULT, 0);
lv_style_set_pad_top(&style_tight, LV_STATE_DEFAULT, 0);
lv_style_set_pad_bottom(&style_tight, LV_STATE_DEFAULT, 0);
lv_style_set_pad_inner(&style_tight, LV_STATE_DEFAULT, 0);
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)
@@ -334,6 +348,20 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
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;
@@ -391,19 +419,19 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_SCR:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
break;
case LV_THEME_OBJ:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#if LV_USE_CONT
case LV_THEME_CONT:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
@@ -411,8 +439,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -420,12 +448,12 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_BTNMATRIX:
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -433,12 +461,12 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_KEYBOARD:
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -446,13 +474,13 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_BAR:
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
break;
#endif
@@ -460,20 +488,20 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_SWITCH:
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_lv_style_list_add_style(list, &style_round);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_lv_style_list_add_style(list, &style_round);
_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
@@ -516,15 +544,15 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_ARC:
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tick_line);
_lv_style_list_add_style(list, &style_round);
_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);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &style_tick_line);
_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
@@ -532,14 +560,14 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_SPINNER:
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tick_line);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tick_line);
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &style_tick_line);
_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
@@ -547,17 +575,17 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_SLIDER:
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_round);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
break;
#endif
@@ -568,8 +596,8 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -577,18 +605,18 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_MSGBOX:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_MSGBOX_BTNS:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -596,62 +624,62 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_LED:
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &style_round);
_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:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_gray);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->gray);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
#if LV_USE_TABVIEW
case LV_THEME_TABVIEW:
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_gray);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->gray);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
@@ -660,15 +688,15 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_TILEVIEW:
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
@@ -677,12 +705,12 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_ROLLER:
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
break;
#endif
@@ -698,21 +726,21 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_LIST:
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_LIST_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -720,21 +748,21 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_DROPDOWN:
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_color);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
break;
#endif
@@ -742,39 +770,39 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_CHART:
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_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:
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
@@ -782,26 +810,26 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_WIN:
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_WIN_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -809,20 +837,20 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_TEXTAREA:
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
_lv_style_list_add_style(list, &style_gray);
_lv_style_list_add_style(list, &styles->gray);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
@@ -831,18 +859,18 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_SPINBOX:
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_SPINBOX_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
#endif
@@ -850,34 +878,34 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_CALENDAR:
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_btn);
_lv_style_list_add_style(list, &style_tight);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
_lv_style_list_add_style(list, &styles->tight);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_tight);
_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:
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_round);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
break;
#endif
@@ -885,24 +913,24 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_LINEMETER:
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_round);
_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:
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &style_round);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
_lv_style_list_add_style(list, &style_tick_line);
_lv_style_list_add_style(list, &styles->tick_line);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
_lv_style_list_add_style(list, &style_bg);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
default:
@@ -919,5 +947,10 @@ void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
* STATIC FUNCTIONS
**********************/
static void style_init_reset(lv_style_t * style)
{
if(inited) lv_style_reset(style);
else lv_style_init(style);
}
#endif

View File

@@ -9,7 +9,7 @@
#include "lv_arc.h"
#if LV_USE_ARC != 0
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw_arc.h"
#include "../lv_themes/lv_theme.h"

View File

@@ -11,7 +11,7 @@
#include "lv_bar.h"
#if LV_USE_BAR != 0
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h"
@@ -148,7 +148,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
* Set a new value on the bar
* @param bar pointer to a bar object
* @param value new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
{
@@ -163,6 +163,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
if(ext->cur_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
ext->cur_value = new_value;
lv_obj_invalidate(bar);
#else
@@ -174,7 +175,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
* Set a new start value on the bar
* @param bar pointer to a bar object
* @param value new start value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_t anim)
{
@@ -189,6 +190,7 @@ void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_
if(ext->start_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
ext->start_value = new_value;
#else
lv_bar_set_value_with_anim(bar, new_value, &ext->start_value, &ext->start_value_anim, anim);

View File

@@ -114,7 +114,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim);
* Set a new start value on the bar
* @param bar pointer to a bar object
* @param value new start value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_t anim);

View File

@@ -12,7 +12,7 @@
#include <string.h>
#include "../lv_core/lv_group.h"
#include "../lv_core/lv_debug.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"
@@ -137,24 +137,27 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
switch(state) {
case LV_BTN_STATE_RELEASED:
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
break;
case LV_BTN_STATE_PRESSED:
lv_obj_clear_state(btn, LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_obj_add_state(btn, LV_STATE_PRESSED);
break;
case LV_BTN_STATE_CHECKED_RELEASED:
lv_obj_add_state(btn, LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_PRESSED);
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED);
break;
case LV_BTN_STATE_CHECKED_PRESSED:
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_DISABLED);
break;
case LV_BTN_STATE_DISABLED:
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
lv_obj_add_state(btn, LV_STATE_DISABLED);
break;
case LV_BTN_STATE_ACTIVE:
lv_obj_clear_state(btn, LV_STATE_DISABLED);
case LV_BTN_STATE_CHECKED_DISABLED:
lv_obj_clear_state(btn, LV_STATE_PRESSED);
lv_obj_add_state(btn, LV_STATE_DISABLED | LV_STATE_CHECKED);
break;
}
}
@@ -167,8 +170,6 @@ void lv_btn_toggle(lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
if(lv_obj_get_state(btn, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
lv_obj_clear_state(btn, LV_STATE_CHECKED);
}
@@ -192,16 +193,19 @@ lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
lv_state_t obj_state = lv_obj_get_state(btn, LV_BTN_PART_MAIN);
lv_btn_state_t btn_state = 0;
if(obj_state & LV_STATE_DISABLED) btn_state = LV_BTN_STATE_DISABLED;
if(obj_state & LV_STATE_DISABLED) {
if(obj_state & LV_STATE_CHECKED) return LV_BTN_STATE_CHECKED_DISABLED;
else return LV_BTN_STATE_DISABLED;
}
if(obj_state & LV_STATE_CHECKED) {
if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_CHECKED_PRESSED;
else return btn_state | LV_BTN_STATE_CHECKED_RELEASED;
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
else return LV_BTN_STATE_CHECKED_RELEASED;
}
else {
if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_PRESSED;
else return btn_state | LV_BTN_STATE_RELEASED;
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
else return LV_BTN_STATE_RELEASED;
}
}
@@ -285,6 +289,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
}
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
if(lv_btn_get_checkable(btn)) {
@@ -305,6 +310,7 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
if(res != LV_RES_OK) return res;
}
}
#endif
}
return res;

Some files were not shown because too many files have changed in this diff Show More