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