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