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