lv_conf.h
1 /*
2  * Copyright (C) 2019 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef LV_CONF_H
18 #define LV_CONF_H
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include <stdint.h>
25 #include "kernel_defines.h"
26 #include "lvgl_riot_conf.h"
27 
28 /*====================
29  COLOR SETTINGS
30  *====================*/
31 
32 /* Color depth:
33  * - 1: 1 bit per pixel
34  * - 8: RGB233
35  * - 16: RGB565
36  * - 32: ARGB8888
37  */
38 #ifndef LV_COLOR_DEPTH
39 # if IS_USED(MODULE_U8G2_DISP_DEV)
40 # define LV_COLOR_DEPTH 1
41 # else
42 # define LV_COLOR_DEPTH 16
43 # endif
44 #endif
45 
46 /* Swap the 2 bytes of RGB565 color.
47  * Useful if the display has a 8 bit interface (e.g. SPI)*/
48 #ifndef LV_COLOR_16_SWAP
49 #if IS_USED(MODULE_LCD)
50 #define LV_COLOR_16_SWAP 1
51 #else
52 #define LV_COLOR_16_SWAP 0
53 #endif
54 #endif
55 
56 /*Enable more complex drawing routines to manage screens transparency.
57  *Can be used if the UI is above another layer, e.g. an OSD menu or video player.
58  *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/
59 #define LV_COLOR_SCREEN_TRANSP 0
60 
62 #define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
63 
64 /*=========================
65  MEMORY SETTINGS
66  *=========================*/
67 
68 /*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
69 #define LV_MEM_CUSTOM 0
70 #if LV_MEM_CUSTOM == 0
71 /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
72 #ifndef LV_MEM_SIZE
73 # if (__SIZEOF_POINTER__ > 4)
74 /*64-bit platforms require additional space because a lot of pointers are stored on the lvgl heap.*/
75 # if IS_USED(MODULE_LVGL_EXTRA_THEME_DEFAULT_GROW)
76 # define LV_MEM_SIZE (9U * 1024U) /*[bytes]*/
77 # else
78 # define LV_MEM_SIZE (8U * 1024U) /*[bytes]*/
79 # endif
80 # else
81 # if IS_USED(MODULE_LVGL_EXTRA_THEME_DEFAULT_GROW)
82 # define LV_MEM_SIZE (6U * 1024U) /*[bytes]*/
83 # else
84 # define LV_MEM_SIZE (5U * 1024U) /*[bytes]*/
85 # endif
86 # endif
87 #endif
88 
89 /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
90 # define LV_MEM_ADR 0 /*0: unused*/
91 #else /*LV_MEM_CUSTOM*/
92 # define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
93 # define LV_MEM_CUSTOM_ALLOC malloc
94 # define LV_MEM_CUSTOM_FREE free
95 #endif /*LV_MEM_CUSTOM*/
96 
99 #define LV_MEM_BUF_MAX_NUM 16
100 
101 /*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
102 #define LV_MEMCPY_MEMSET_STD 1
103 
104 /*====================
105  HAL SETTINGS
106  *====================*/
107 
108 /*Default display refresh period. LVG will redraw changed ares with this period time*/
109 #define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
110 
111 /*Input device read period in milliseconds*/
112 #define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
113 
116 #define LV_DPI_DEF 130 /*[px/inch]*/
117 
118 /*=======================
119  * FEATURE CONFIGURATION
120  *=======================*/
121 
122 /*-------------
123  * Drawing
124  *-----------*/
125 
128 #define LV_DRAW_COMPLEX 1
129 #if LV_DRAW_COMPLEX != 0
130 
134 #define LV_SHADOW_CACHE_SIZE 0
135 #endif /*LV_DRAW_COMPLEX*/
136 
137 /*Default image cache size. Image caching keeps the images opened.
138  *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
139  *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
140  *However the opened images might consume additional RAM.
141  *0: to disable caching*/
142 #define LV_IMG_CACHE_DEF_SIZE 0
143 
146 #define LV_GRADIENT_MAX_STOPS 2
147 
153 #define LV_GRAD_CACHE_DEF_SIZE 0
154 
156 #define LV_DISP_ROT_MAX_BUF (10*1024)
157 /*-------------
158  * GPU
159  *-----------*/
160 
161 /*Use STM32's DMA2D (aka Chrom Art) GPU*/
162 #define LV_USE_GPU_STM32_DMA2D 0
163 #if LV_USE_GPU_STM32_DMA2D
164 /*Must be defined to include path of CMSIS header of target processor
165 e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
166 #define LV_GPU_DMA2D_CMSIS_INCLUDE
167 #endif
168 
170 #define LV_USE_GPU_NXP_PXP 0
171 #if LV_USE_GPU_NXP_PXP
172 /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c)
173  * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS
174  * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected.
175  *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init()
176  */
177 #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
178 #endif
179 
181 #define LV_USE_GPU_NXP_VG_LITE 0
182 
183 /*-------------
184  * Logging
185  *-----------*/
186 
187 /*Enable the log module*/
188 #define LV_USE_LOG 0
189 #if LV_USE_LOG
190 
191 /*How important log should be added:
192  *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
193  *LV_LOG_LEVEL_INFO Log important events
194  *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
195  *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
196  *LV_LOG_LEVEL_USER Only logs added by the user
197  *LV_LOG_LEVEL_NONE Do not log anything*/
198 # define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
199 
200 /*1: Print the log with 'printf';
201  *0: User need to register a callback with `lv_log_register_print_cb()`*/
202 # define LV_LOG_PRINTF 0
203 
204 /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
205 # define LV_LOG_TRACE_MEM 1
206 # define LV_LOG_TRACE_TIMER 1
207 # define LV_LOG_TRACE_INDEV 1
208 # define LV_LOG_TRACE_DISP_REFR 1
209 # define LV_LOG_TRACE_EVENT 1
210 # define LV_LOG_TRACE_OBJ_CREATE 1
211 # define LV_LOG_TRACE_LAYOUT 1
212 # define LV_LOG_TRACE_ANIM 1
213 
214 #endif /*LV_USE_LOG*/
215 
216 /*-------------
217  * Asserts
218  *-----------*/
219 
220 /*Enable asserts if an operation is failed or an invalid data is found.
221  *If LV_USE_LOG is enabled an error message will be printed on failure*/
222 #define LV_USE_ASSERT_NULL 0
223 #define LV_USE_ASSERT_MALLOC 0
224 #define LV_USE_ASSERT_STYLE 0
225 #define LV_USE_ASSERT_MEM_INTEGRITY 0
226 #define LV_USE_ASSERT_OBJ 0
229 #define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
230 #define LV_ASSERT_HANDLER while(1);
232 /*-------------
233  * Others
234  *-----------*/
235 
236 /*1: Show CPU usage and FPS count in the right bottom corner*/
237 #define LV_USE_PERF_MONITOR 0
238 
241 #define LV_USE_MEM_MONITOR 0
242 
244 #define LV_USE_REFR_DEBUG 0
245 
247 #define LV_SPRINTF_CUSTOM 0
248 #if LV_SPRINTF_CUSTOM
249 # define LV_SPRINTF_INCLUDE <stdio.h>
250 # define lv_snprintf snprintf
251 # define lv_vsnprintf vsnprintf
252 #else /*LV_SPRINTF_CUSTOM*/
253 # define LV_SPRINTF_USE_FLOAT 0
254 #endif /*LV_SPRINTF_CUSTOM*/
255 
256 #define LV_USE_USER_DATA 1
257 
258 /*Garbage Collector settings
259  *Used if lvgl is binded to higher level language and the memory is managed by that language*/
260 #define LV_ENABLE_GC 0
261 #if LV_ENABLE_GC != 0
262 # define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
263 #endif /*LV_ENABLE_GC*/
264 
265 /*=====================
266  * COMPILER SETTINGS
267  *====================*/
268 
269 /*For big endian systems set to 1*/
270 #define LV_BIG_ENDIAN_SYSTEM 0
271 
272 /*Define a custom attribute to `lv_tick_inc` function*/
273 #define LV_ATTRIBUTE_TICK_INC
274 
276 #define LV_ATTRIBUTE_TIMER_HANDLER
277 
278 /*Define a custom attribute to `lv_disp_flush_ready` function*/
279 #define LV_ATTRIBUTE_FLUSH_READY
280 
281 /*Required alignment size for buffers*/
282 #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1
283 
284 /*Attribute to mark large constant arrays for example font's bitmaps*/
285 #define LV_ATTRIBUTE_LARGE_CONST
286 
288 #define LV_ATTRIBUTE_LARGE_RAM_ARRAY
289 
290 /*Place performance critical functions into a faster memory (e.g RAM)*/
291 #define LV_ATTRIBUTE_FAST_MEM
292 
293 /*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
294 #define LV_ATTRIBUTE_DMA
295 
296 /*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
297  *should also appear on LVGL binding API such as Micropython.*/
298 #define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/
299 
301 #define LV_USE_LARGE_COORD 0
302 
303 /*==================
304  * FONT USAGE
305  *===================*/
306 
311 #define LV_FONT_MONTSERRAT_8 0
312 #define LV_FONT_MONTSERRAT_10 0
313 #define LV_FONT_MONTSERRAT_12 1
314 #define LV_FONT_MONTSERRAT_14 0
315 #define LV_FONT_MONTSERRAT_16 0
316 #define LV_FONT_MONTSERRAT_18 0
317 #define LV_FONT_MONTSERRAT_20 0
318 #define LV_FONT_MONTSERRAT_22 0
319 #define LV_FONT_MONTSERRAT_24 0
320 #define LV_FONT_MONTSERRAT_26 0
321 #define LV_FONT_MONTSERRAT_28 0
322 #define LV_FONT_MONTSERRAT_30 0
323 #define LV_FONT_MONTSERRAT_32 0
324 #define LV_FONT_MONTSERRAT_34 0
325 #define LV_FONT_MONTSERRAT_36 0
326 #define LV_FONT_MONTSERRAT_38 0
327 #define LV_FONT_MONTSERRAT_40 0
328 #define LV_FONT_MONTSERRAT_42 0
329 #define LV_FONT_MONTSERRAT_44 0
330 #define LV_FONT_MONTSERRAT_46 0
331 #define LV_FONT_MONTSERRAT_48 0
334 /*Demonstrate special features*/
335 #define LV_FONT_MONTSERRAT_12_SUBPX 0
336 #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
337 #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Perisan letters and all their forms*/
338 #define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
339 
343 #define LV_FONT_UNSCII_8 0
344 #define LV_FONT_UNSCII_16 0
347 /*Optionally declare custom fonts here.
348  *You can use these fonts as default font too and they will be available globally.
349  *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/
350 #define LV_FONT_CUSTOM_DECLARE
351 
352 /*Always set a default font*/
353 #define LV_FONT_DEFAULT &lv_font_montserrat_12
354 
355 /*Enable handling large font and/or fonts with a lot of characters.
356  *The limit depends on the font size, font face and bpp.
357  *Compiler error will be triggered if a font needs it.*/
358 #define LV_FONT_FMT_TXT_LARGE 0
359 
360 /*Enables/disables support for compressed fonts.*/
361 #define LV_USE_FONT_COMPRESSED 0
362 
363 /*Enable subpixel rendering*/
364 #define LV_USE_FONT_SUBPX 0
365 #if LV_USE_FONT_SUBPX
366 /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
367 #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
368 #endif
369 
370 /*=================
371  * TEXT SETTINGS
372  *=================*/
373 
380 #define LV_TXT_ENC LV_TXT_ENC_ASCII
381 
382  /*Can break (wrap) texts on these chars*/
383 #define LV_TXT_BREAK_CHARS " ,.;:-_"
384 
385 /*If a word is at least this long, will break wherever "prettiest"
386  *To disable, set to a value <= 0*/
387 #define LV_TXT_LINE_BREAK_LONG_LEN 0
388 
389 /*Minimum number of characters in a long word to put on a line before a break.
390  *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
391 #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
392 
393 /*Minimum number of characters in a long word to put on a line after a break.
394  *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/
395 #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
396 
397 /*The control character to use for signalling text recoloring.*/
398 #define LV_TXT_COLOR_CMD "#"
399 
400 /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts.
401  *The direction will be processed according to the Unicode Bidirectioanl Algorithm:
402  *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
403 #define LV_USE_BIDI 0
404 #if LV_USE_BIDI
405 /*Set the default direction. Supported values:
406  *`LV_BASE_DIR_LTR` Left-to-Right
407  *`LV_BASE_DIR_RTL` Right-to-Left
408  *`LV_BASE_DIR_AUTO` detect texts base direction*/
409 #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO
410 #endif
411 
412 /*Enable Arabic/Persian processing
413  *In these languages characters should be replaced with an other form based on their position in the text*/
414 #define LV_USE_ARABIC_PERSIAN_CHARS 0
415 
416 /*==================
417  * WIDGET USAGE
418  *================*/
419 
420 /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/
421 
422 #define LV_USE_ARC IS_USED(MODULE_LVGL_WIDGET_ARC)
423 
424 #define LV_USE_ANIMIMG IS_USED(MODULE_LVGL_EXTRA_WIDGET_ANIMIMG)
425 
426 #define LV_USE_BAR IS_USED(MODULE_LVGL_WIDGET_BAR)
427 
428 #define LV_USE_BTN IS_USED(MODULE_LVGL_WIDGET_BTN)
429 
430 #define LV_USE_BTNMATRIX IS_USED(MODULE_LVGL_WIDGET_BTNMATRIX)
431 
432 #define LV_USE_CANVAS IS_USED(MODULE_LVGL_WIDGET_CANVAS)
433 
434 #define LV_USE_CHECKBOX IS_USED(MODULE_LVGL_WIDGET_CHECKBOX)
435 
436 #define LV_USE_DROPDOWN IS_USED(MODULE_LVGL_WIDGET_DROPDOWN) /*Requires: lv_label*/
437 
438 #define LV_USE_IMG IS_USED(MODULE_LVGL_WIDGET_IMG) /*Requires: lv_label*/
439 
440 #define LV_USE_LABEL IS_USED(MODULE_LVGL_WIDGET_LABEL)
441 #if LV_USE_LABEL
442 #ifndef LV_LABEL_TEXT_SELECTION
443 #define LV_LABEL_TEXT_SELECTION 1
444 #endif
445 #ifndef LV_LABEL_LONG_TXT_HINT
446 #define LV_LABEL_LONG_TXT_HINT 1
447 #endif
448 #endif
449 
450 #define LV_USE_LINE IS_USED(MODULE_LVGL_WIDGET_LINE)
451 
452 #define LV_USE_ROLLER IS_USED(MODULE_LVGL_WIDGET_ROLLER) /*Requires: lv_label*/
453 #if LV_USE_ROLLER
454 # define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/
455 #endif
456 
457 #define LV_USE_SLIDER IS_USED(MODULE_LVGL_WIDGET_SLIDER) /*Requires: lv_bar*/
458 
459 #define LV_USE_SWITCH IS_USED(MODULE_LVGL_WIDGET_SWITCH)
460 
461 #define LV_USE_TEXTAREA IS_USED(MODULE_LVGL_WIDGET_TEXTAREA) /*Requires: lv_label*/
462 #if LV_USE_TEXTAREA != 0
463 # define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
464 #endif
465 
466 #define LV_USE_TABLE IS_USED(MODULE_LVGL_WIDGET_TABLE)
467 
468 /*==================
469  * EXTRA COMPONENTS
470  *==================*/
471 
472 /*-----------
473  * Widgets
474  *----------*/
475 
476 #define LV_USE_CALENDAR IS_USED(MODULE_LVGL_EXTRA_WIDGET_CALENDAR)
477 #if LV_USE_CALENDAR
478 # define LV_CALENDAR_WEEK_STARTS_MONDAY 0
479 # if LV_CALENDAR_WEEK_STARTS_MONDAY
480 # define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
481 # else
482 # define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
483 # endif
484 
485 # define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
486 # define LV_USE_CALENDAR_HEADER_ARROW 1
487 # define LV_USE_CALENDAR_HEADER_DROPDOWN 1
488 #endif /*LV_USE_CALENDAR*/
489 
490 #define LV_USE_CHART IS_USED(MODULE_LVGL_EXTRA_WIDGET_CHART)
491 
492 #define LV_USE_COLORWHEEL IS_USED(MODULE_LVGL_EXTRA_WIDGET_COLORWHEEL)
493 
494 #define LV_USE_IMGBTN IS_USED(MODULE_LVGL_EXTRA_WIDGET_IMGBTN)
495 
496 #define LV_USE_KEYBOARD IS_USED(MODULE_LVGL_EXTRA_WIDGET_KEYBOARD)
497 
498 #define LV_USE_LED IS_USED(MODULE_LVGL_EXTRA_WIDGET_LED)
499 
500 #define LV_USE_LIST IS_USED(MODULE_LVGL_EXTRA_WIDGET_LIST)
501 
502 #define LV_USE_MENU IS_USED(MODULE_LVGL_EXTRA_WIDGET_MENU)
503 
504 #define LV_USE_METER IS_USED(MODULE_LVGL_EXTRA_WIDGET_METER)
505 
506 #define LV_USE_MSGBOX IS_USED(MODULE_LVGL_EXTRA_WIDGET_MSGBOX)
507 
508 #define LV_USE_SPINBOX IS_USED(MODULE_LVGL_EXTRA_WIDGET_SPINBOX)
509 
510 #define LV_USE_SPINNER IS_USED(MODULE_LVGL_EXTRA_WIDGET_SPINNER)
511 
512 #define LV_USE_TABVIEW IS_USED(MODULE_LVGL_EXTRA_WIDGET_TABVIEW)
513 
514 #define LV_USE_TILEVIEW IS_USED(MODULE_LVGL_EXTRA_WIDGET_TILEVIEW)
515 
516 #define LV_USE_WIN IS_USED(MODULE_LVGL_EXTRA_WIDGET_WIN)
517 
518 #define LV_USE_SPAN IS_USED(MODULE_LVGL_EXTRA_WIDGET_SPAN)
519 #if LV_USE_SPAN
520 /*A line text can contain maximum num of span descriptor */
521 # define LV_SPAN_SNIPPET_STACK_SIZE 64
522 #endif
523 
524 /*-----------
525  * Themes
526  *----------*/
527 /*A simple, impressive and very complete theme*/
528 #define LV_USE_THEME_DEFAULT IS_USED(MODULE_LVGL_EXTRA_THEME_DEFAULT)
529 
530 /*0: Light mode; 1: Dark mode*/
531 #define LV_THEME_DEFAULT_DARK IS_USED(MODULE_LVGL_EXTRA_THEME_DEFAULT_DARK)
532 
533 /*1: Enable grow on press*/
534 #define LV_THEME_DEFAULT_GROW IS_USED(MODULE_LVGL_EXTRA_THEME_DEFAULT_GROW)
535 
536 /*Default transition time in [ms]*/
537 # define LV_THEME_DEFAULT_TRANSITON_TIME 80
538 
539 /*An very simple them that is a good starting point for a custom theme*/
540 #define LV_USE_THEME_BASIC IS_USED(MODULE_LVGL_EXTRA_THEME_BASIC)
541 
542 /*A theme designed for monochrome displays*/
543 #define LV_USE_THEME_MONO IS_USED(MODULE_LVGL_EXTRA_THEME_MONO)
544 
545 /*-----------
546  * Layouts
547  *----------*/
548 
549 /*A layout similar to Flexbox in CSS.*/
550 #define LV_USE_FLEX IS_USED(MODULE_LVGL_EXTRA_LAYOUT_FLEX)
551 
552 /*A layout similar to Grid in CSS.*/
553 #define LV_USE_GRID IS_USED(MODULE_LVGL_EXTRA_LAYOUT_GRID)
554 
555 #ifdef __cplusplus
556 }
557 #endif
558 
559 #endif /* LV_CONF_H */
Common macros and compiler attributes/pragmas configuration.
Definitions specific to RIOT for the LVGL engine.