Skip to content

Commit a1e336e

Browse files
vanwinkeljanMaureenHelm
authored andcommitted
gui: Added support for LVGL v6.1
Added support for new features in LVGL v6.1 Signed-off-by: Jan Van Winkel <[email protected]>
1 parent 2184752 commit a1e336e

File tree

4 files changed

+273
-1
lines changed

4 files changed

+273
-1
lines changed

lib/gui/lvgl/Kconfig

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,64 @@ config LVGL_TEXT_BREAK_CHARACTERS
273273
help
274274
Characters on which a text break can take place
275275

276+
config LVGL_TEXT_LINE_BREAK_LONG_LEN
277+
int "Minimal word length for line break"
278+
default 12
279+
help
280+
If a word is at least this long, a line break is allowed in the word.
281+
282+
If the length is 0, no line break is allowed in the middle of a word.
283+
284+
config LVGL_TEXT_LINE_BREAK_LONG_PRE_MIN_LEN
285+
int "Minimal number of characters on line before line break"
286+
default 3
287+
help
288+
Minimal number of characters to place on a line before a line break
289+
in the middle of a word can occur.
290+
291+
config LVGL_TEXT_LINE_BREAK_LONG_POST_MIN_LEN
292+
int "Minimal number of characters on line after line break"
293+
default 3
294+
help
295+
Minimal number of characters to place on a line after a line break
296+
occurred in the middle of a word.
297+
298+
config LVGL_TEXT_COLOR_CMD
299+
string "Text recoloring control character"
300+
default "#"
301+
help
302+
Control character to use for signalling text recoloring
303+
304+
config LVGL_TEXT_USE_BIDI
305+
bool "Enable bidirectional text support"
306+
help
307+
Enable bidirectional text support
308+
309+
The direction of the text will be processed according to the
310+
Unicode Bidirectional Algorithm:
311+
https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
312+
313+
if LVGL_TEXT_USE_BIDI
314+
315+
choice LVGL_TEXT_BIDI_MODE
316+
prompt "Bidirectional text processing direction"
317+
default LVGL_TEXT_BIDI_DIR_AUTO
318+
help
319+
Direction of bidirectional text processing
320+
321+
config LVGL_TEXT_BIDI_DIR_AUTO
322+
bool "Automatically detect direction"
323+
324+
config LVGL_TEXT_BIDI_DIR_LTR
325+
bool "Left-to-right"
326+
327+
config LVGL_TEXT_BIDI_DIR_RTL
328+
bool "Right-to-left"
329+
330+
endchoice
331+
332+
endif
333+
276334
config LVGL_ANTIALIAS
277335
bool "Enable anti-aliasing"
278336
help
@@ -311,6 +369,11 @@ config LVGL_IMG_CF_ALPHA
311369
help
312370
Enable support for alpha indexed images
313371

372+
config LVGL_IMG_INDEXED_CHROMA
373+
bool "Enable chroma keying for indexed images"
374+
help
375+
Enable chroma keying for indexed images
376+
314377
config LVGL_FILESYSTEM
315378
bool "Enable file system"
316379
depends on FILE_SYSTEM
@@ -328,6 +391,68 @@ config LVGL_IMG_CACHE_DEF_SIZE
328391
caching can save the continuous decoding of images. However the
329392
opened images might consume additional RAM.
330393

394+
config LVGL_USE_DEBUG
395+
bool "Enable debug support"
396+
default y if TEST
397+
help
398+
Enable debug support.
399+
400+
If debug support is enabled LVGL will validate the parameters of
401+
any function call made and if an invalid parameter is found __ASSERT
402+
is called.
403+
404+
if LVGL_USE_DEBUG
405+
406+
config LVGL_USE_ASSERT_NULL
407+
bool "Enable null pointer assertion"
408+
default y if TEST
409+
help
410+
Enable null pointer assertion
411+
412+
Check if a null pointer is passed as a parameter (Quite fast)
413+
414+
config LVGL_USE_ASSERT_MEM
415+
bool "Enable memory allocation assertion"
416+
default y if TEST
417+
help
418+
Enable memory allocation assertion
419+
420+
Check if memory allocation is successful (Quite fast)
421+
422+
config LVGL_USE_ASSERT_STR
423+
bool "Enable string assertion"
424+
default y if TEST
425+
help
426+
Enable string assertion
427+
428+
Check if the string is not a NULL pointer, unusually long string,
429+
contains invalid characters or contains unusual repetitions. (Slow)
430+
431+
If this option is disabled and NULL pointer checking is enabled, the
432+
NULL pointer check is executed instead.
433+
434+
config LVGL_USE_ASSERT_OBJ
435+
bool "Enable object assertion"
436+
default y if TEST
437+
help
438+
Enable object assertion
439+
440+
Check if an object is not a NULL pointer, has the correct type and
441+
does exists. (Quite Slow)
442+
443+
If this option is disabled and NULL pointer checking is enabled, the
444+
NULL pointer check is executed instead.
445+
446+
config LVGL_USE_ASSERT_STYLE
447+
bool "Enable style assertion"
448+
default y if TEST
449+
help
450+
Enable style assertion
451+
452+
Check if a used style is correctly initialized. (Fast)
453+
454+
endif
455+
331456
rsource "Kconfig.themes"
332457
rsource "Kconfig.fonts"
333458
rsource "Kconfig.objects"

lib/gui/lvgl/Kconfig.fonts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
menu "Fonts"
55

6+
config LVGL_FONT_SUBPX_BGR
7+
bool "Use BGR instead RGB for sub-pixel rendering"
8+
help
9+
User BGR pixel format instead of RGB for sub-pixel rendering
10+
611
config LVGL_BUILD_IN_FONT_ROBOTO_12
712
bool "Enable build-in 12px fonts"
813
help
@@ -29,6 +34,16 @@ config LVGL_BUILD_IN_FONT_UNSCII_8
2934
help
3035
Enable build-in monospace font support, size 8 pixels
3136

37+
config LVGL_BUILD_IN_FONT_ROBOTO_28_COMPRESSED
38+
bool "Enable build-in 28px compressed fonts"
39+
help
40+
Enable build-in compressed font support, size 28 pixels
41+
42+
config LVGL_BUILD_IN_FONT_ROBOTO_12_SUBPX
43+
bool "Enable build-in 12px fonts with sub-pixel rendering"
44+
help
45+
Enable build-in font support with sub-pixel rendering, size 12 pixels
46+
3247
choice
3348
prompt "Default LVGL font"
3449
default LVGL_DEFAULT_FONT_BUILD_IN_UNSCII_8
@@ -53,6 +68,14 @@ choice
5368
bool "Build-in monospace font"
5469
depends on LVGL_BUILD_IN_FONT_UNSCII_8
5570

71+
config LVGL_DEFAULT_FONT_BUILD_IN_ROBOTO_28_COMPRESSED
72+
bool "Build-in compressed font size 28"
73+
depends on LVGL_BUILD_IN_FONT_ROBOTO_28_COMPRESSED
74+
75+
config LVGL_DEFAULT_FONT_BUILD_IN_ROBOTO_12_SUBPX
76+
bool "Build-in font size 12 with sub-pixel rendering"
77+
depends on LVGL_BUILD_IN_FONT_ROBOTO_12_SUBPX
78+
5679
config LVGL_DEFAULT_FONT_CUSTOM
5780
bool "Custom font"
5881
help

lib/gui/lvgl/Kconfig.objects

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ config LVGL_OBJ_LIST_FOCUS_TIME
315315

316316
endif
317317

318+
config LVGL_OBJ_COLOR_PICKER
319+
bool "Color picker object"
320+
help
321+
Enable color picker object support
322+
318323
config LVGL_OBJ_DROP_DOWN_LIST
319324
bool "Drop Down List object"
320325
depends on LVGL_OBJ_LABEL && LVGL_OBJ_PAGE

lib/gui/lvgl/lv_conf.h

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
#ifndef ZEPHYR_LIB_GUI_LVGL_LV_CONF_H_
88
#define ZEPHYR_LIB_GUI_LVGL_LV_CONF_H_
99

10+
#ifdef CONFIG_LVGL_USE_DEBUG
11+
#include <sys/__assert.h>
12+
#define LV_DEBUG_ASSERT(expr, msg, value) __ASSERT(expr, msg)
13+
#endif
14+
1015
/* Graphical settings */
1116

1217
#define LV_HOR_RES_MAX CONFIG_LVGL_HOR_RES
@@ -46,6 +51,12 @@
4651
CONFIG_LVGL_CUSTOM_CHROMA_KEY_BLUE)
4752
#endif
4853

54+
#ifdef CONFIG_LVGL_IMG_INDEXED_CHROMA
55+
#define LV_INDEXED_CHROMA 1
56+
#else
57+
#define LV_INDEXED_CHROMA 0
58+
#endif
59+
4960
#ifdef CONFIG_LVGL_ANTIALIAS
5061
#define LV_ANTIALIAS 1
5162
#else
@@ -171,6 +182,8 @@ typedef void *lv_img_decoder_user_data_t;
171182

172183
#define LV_ATTRIBUTE_LARGE_CONST
173184

185+
#define LV_EXPORT_CONST_INT(int_value)
186+
174187
/* HAL settings */
175188

176189
#define LV_TICK_CUSTOM 1
@@ -200,6 +213,48 @@ typedef void *lv_indev_drv_user_data_t;
200213
#define LV_LOG_PRINTF 0
201214
#endif
202215

216+
/* Debug settings */
217+
218+
#ifdef CONFIG_LVGL_USE_DEBUG
219+
#define LV_USE_DEBUG 1
220+
#else
221+
#define LV_USE_DEBUG 0
222+
#endif
223+
224+
#if LV_USE_DEBUG
225+
226+
#ifdef CONFIG_LVGL_USE_ASSERT_NULL
227+
#define LV_USE_ASSERT_NULL 1
228+
#else
229+
#define LV_USE_ASSERT_NULL 0
230+
#endif
231+
232+
#ifdef CONFIG_LVGL_USE_ASSERT_MEM
233+
#define LV_USE_ASSERT_MEM 1
234+
#else
235+
#define LV_USE_ASSERT_MEM 0
236+
#endif
237+
238+
#ifdef CONFIG_LVGL_USE_ASSERT_STR
239+
#define LV_USE_ASSERT_STR 1
240+
#else
241+
#define LV_USE_ASSERT_STR 0
242+
#endif
243+
244+
#ifdef CONFIG_LVGL_USE_ASSERT_OBJ
245+
#define LV_USE_ASSERT_OBJ 1
246+
#else
247+
#define LV_USE_ASSERT_OBJ 0
248+
#endif
249+
250+
#ifdef CONFIG_LVGL_USE_ASSERT_STYLE
251+
#define LV_USE_ASSERT_STYLE 1
252+
#else
253+
#define LV_USE_ASSERT_STYLE 0
254+
#endif
255+
256+
#endif /* LV_USE_DEBUG */
257+
203258
/* THEME USAGE */
204259

205260
#ifdef CONFIG_LVGL_THEMES
@@ -267,6 +322,12 @@ typedef void *lv_indev_drv_user_data_t;
267322

268323
/* FONT USAGE */
269324

325+
#ifdef CONFIG_LVGL_FONT_SUBPX_BGR
326+
#define LV_FONT_SUBPX_BGR 1
327+
#else
328+
#define LV_FONT_SUBPX_BGR 0
329+
#endif
330+
270331
#ifdef CONFIG_LVGL_BUILD_IN_FONT_ROBOTO_12
271332
#define LV_FONT_ROBOTO_12 1
272333
#else
@@ -297,6 +358,18 @@ typedef void *lv_indev_drv_user_data_t;
297358
#define LV_FONT_UNSCII_8 0
298359
#endif
299360

361+
#ifdef CONFIG_LVGL_BUILD_IN_FONT_ROBOTO_28_COMPRESSED
362+
#define LV_FONT_ROBOTO_28_COMPRESSED 1
363+
#else
364+
#define LV_FONT_ROBOTO_28_COMPRESSED 0
365+
#endif
366+
367+
#ifdef CONFIG_LVGL_BUILD_IN_FONT_ROBOTO_12_SUBPX
368+
#define LV_FONT_ROBOTO_12_SUBPX 1
369+
#else
370+
#define LV_FONT_ROBOTO_12_SUBPX 0
371+
#endif
372+
300373
#define LV_FONT_CUSTOM_DECLARE
301374

302375
#ifdef CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_ROBOTO_12
@@ -309,6 +382,10 @@ typedef void *lv_indev_drv_user_data_t;
309382
#define LV_FONT_DEFAULT (&lv_font_roboto_28)
310383
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_UNSCII_8)
311384
#define LV_FONT_DEFAULT (&lv_font_unscii_8)
385+
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_ROBOTO_28_COMPRESSED)
386+
#define LV_FONT_DEFAULT (&lv_font_roboto_28_compressed)
387+
#elif defined(CONFIG_LVGL_DEFAULT_FONT_BUILD_IN_ROBOTO_12_SUBPX)
388+
#define LV_FONT_DEFAULT (&lv_font_roboto_12_subpx)
312389
#elif defined(CONFIG_LVGL_DEFAULT_FONT_CUSTOM)
313390
extern void *lv_default_font_custom_ptr;
314391
#define LV_FONT_DEFAULT ((lv_font_t *) lv_default_font_custom_ptr)
@@ -324,7 +401,43 @@ typedef void *lv_font_user_data_t;
324401
#define LV_TXT_ENC LV_TXT_ENC_UTF8
325402
#endif
326403

327-
#define LV_TXT_BREAK_CHARS CONFIG_LVGL_TEXT_BREAK_CHARACTERS
404+
#define LV_TXT_BREAK_CHARS CONFIG_LVGL_TEXT_BREAK_CHARACTERS
405+
406+
#define LV_TXT_LINE_BREAK_LONG_LEN CONFIG_LVGL_TEXT_LINE_BREAK_LONG_LEN
407+
408+
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN \
409+
CONFIG_LVGL_TEXT_LINE_BREAK_LONG_PRE_MIN_LEN
410+
411+
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN \
412+
CONFIG_LVGL_TEXT_LINE_BREAK_LONG_POST_MIN_LEN
413+
414+
#define LV_TXT_COLOR_CMD CONFIG_LVGL_TEXT_COLOR_CMD
415+
416+
#ifdef CONFIG_LVGL_TEXT_USE_BIDI
417+
#define LV_USE_BIDI 1
418+
#else
419+
#define LV_USE_BIDI 0
420+
#endif
421+
422+
#if LV_USE_BIDI
423+
424+
#ifdef CONFIG_LVGL_TEXT_BIDI_DIR_LTR
425+
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_LTR
426+
#elif defined(CONFIG_LVGL_TEXT_BIDI_DIR_RTL)
427+
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_RTL
428+
#else
429+
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
430+
#endif
431+
432+
#endif
433+
434+
#define LV_SPRINTF_CUSTOM 1
435+
436+
#if LV_SPRINTF_CUSTOM
437+
#define LV_SPRINTF_INCLUDE "stdio.h"
438+
#define lv_snprintf snprintf
439+
#define lv_vsnprintf vsnprintf
440+
#endif
328441

329442
/* LV_OBJ SETTINGS */
330443

@@ -414,6 +527,12 @@ typedef void *lv_obj_user_data_t;
414527
#define LV_USE_CONT 0
415528
#endif
416529

530+
#ifdef CONFIG_LVGL_OBJ_COLOR_PICKER
531+
#define LV_USE_CPICKER 1
532+
#else
533+
#define LV_USE_CPICKER 0
534+
#endif
535+
417536
#ifdef CONFIG_LVGL_OBJ_DROP_DOWN_LIST
418537
#define LV_USE_DDLIST 1
419538
#else

0 commit comments

Comments
 (0)