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