diff --git a/lv_conf_template.h b/lv_conf_template.h index c46c168e3..9aa4b89c7 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -55,8 +55,8 @@ #define LV_MEM_ADR 0 /*0: unused*/ /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ #if LV_MEM_ADR == 0 - //#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/ - //#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/ + #undef LV_MEM_POOL_INCLUDE + #undef LV_MEM_POOL_ALLOC #endif #else /*LV_MEM_CUSTOM*/ @@ -135,36 +135,36 @@ * "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers * and can't be drawn in chunks. So these settings affects only widgets with opacity. */ -#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) -#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE LV_MAX(lv_area_get_width(&draw_area) * px_size, 2048) +#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) +#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE LV_MAX(lv_area_get_width(&draw_area) * px_size, 2048) /*Default image cache size. Image caching keeps the images opened. *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) *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. *However the opened images might consume additional RAM. *0: to disable caching*/ -#define LV_IMG_CACHE_DEF_SIZE 0 +#define LV_IMG_CACHE_DEF_SIZE 0 /*Number of stops allowed per gradient. Increase this to allow more stops. *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ -#define LV_GRADIENT_MAX_STOPS 2 +#define LV_GRADIENT_MAX_STOPS 2 /*Default gradient buffer size. *When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again. *LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes. *If the cache is too small the map will be allocated only while it's required for the drawing. *0 mean no caching.*/ -#define LV_GRAD_CACHE_DEF_SIZE 0 +#define LV_GRAD_CACHE_DEF_SIZE 0 /*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display) *LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface *The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */ -#define LV_DITHER_GRADIENT 0 +#define LV_DITHER_GRADIENT 0 #if LV_DITHER_GRADIENT /*Add support for error diffusion dithering. *Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing. *The increase in memory consumption is (24 bits * object's width)*/ - #define LV_DITHER_ERROR_DIFFUSION 0 + #define LV_DITHER_ERROR_DIFFUSION 0 #endif /*Maximum buffer size to allocate for rotation. @@ -601,7 +601,7 @@ #if LV_USE_FS_STDIO #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif /*API for open, read, etc*/ @@ -609,19 +609,19 @@ #if LV_USE_FS_POSIX #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif /*API for CreateFile, ReadFile, etc*/ #define LV_USE_FS_WIN32 0 #if LV_USE_FS_WIN32 - #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif /*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ -#define LV_USE_FS_FATFS 0 +#define LV_USE_FS_FATFS 0 #if LV_USE_FS_FATFS #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ @@ -665,7 +665,7 @@ /*FFmpeg library for image decoding and playing videos *Supports all major image formats so do not enable other image decoder with it*/ -#define LV_USE_FFMPEG 0 +#define LV_USE_FFMPEG 0 #if LV_USE_FFMPEG /*Dump input information to stderr*/ #define LV_FFMPEG_DUMP_FORMAT 0 @@ -679,10 +679,10 @@ #define LV_USE_SNAPSHOT 0 /*1: Enable Monkey test*/ -#define LV_USE_MONKEY 0 +#define LV_USE_MONKEY 0 /*1: Enable grid navigation*/ -#define LV_USE_GRIDNAV 0 +#define LV_USE_GRIDNAV 0 /*1: Enable lv_obj fragment*/ #define LV_USE_FRAGMENT 0 @@ -705,28 +705,28 @@ ====================*/ /*Show some widget. It might be required to increase `LV_MEM_SIZE` */ -#define LV_USE_DEMO_WIDGETS 0 +#define LV_USE_DEMO_WIDGETS 0 #if LV_USE_DEMO_WIDGETS -#define LV_DEMO_WIDGETS_SLIDESHOW 0 +#define LV_DEMO_WIDGETS_SLIDESHOW 0 #endif /*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 /*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 0 +#define LV_USE_DEMO_BENCHMARK 0 /*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 0 +#define LV_USE_DEMO_STRESS 0 /*Music player demo*/ -#define LV_USE_DEMO_MUSIC 0 +#define LV_USE_DEMO_MUSIC 0 #if LV_USE_DEMO_MUSIC -# define LV_DEMO_MUSIC_SQUARE 0 -# define LV_DEMO_MUSIC_LANDSCAPE 0 -# define LV_DEMO_MUSIC_ROUND 0 -# define LV_DEMO_MUSIC_LARGE 0 -# define LV_DEMO_MUSIC_AUTO_PLAY 0 + #define LV_DEMO_MUSIC_SQUARE 0 + #define LV_DEMO_MUSIC_LANDSCAPE 0 + #define LV_DEMO_MUSIC_ROUND 0 + #define LV_DEMO_MUSIC_LARGE 0 + #define LV_DEMO_MUSIC_AUTO_PLAY 0 #endif /*--END OF LV_CONF_H--*/ diff --git a/scripts/lv_conf_internal_gen.py b/scripts/lv_conf_internal_gen.py index 34e937e92..0347827af 100755 --- a/scripts/lv_conf_internal_gen.py +++ b/scripts/lv_conf_internal_gen.py @@ -92,19 +92,19 @@ for line in fin.read().splitlines(): if '/*--END OF LV_CONF_H--*/' in line: break #Is there a #define in this line? - r = re.search(r'^([\s]*)#[\s]*define[\s]+([^\s]+).*$', line) # \s means any white space character + r = re.search(r'^([\s]*)#[\s]*(undef|define)[\s]+([^\s]+).*$', line) # \s means any white space character if r: indent = r[1] - name = r[2] + name = r[3] name = re.sub('\(.*?\)', '', name, 1) #remove parentheses from macros. E.g. MY_FUNC(5) -> MY_FUNC - name_and_value = re.sub('[\s]*#[\s]*define', '', line, 1) + line = re.sub('[\s]*', '', line, 1) #If the value should be 1 (enabled) by default use a more complex structure for Kconfig checks because #if a not defined CONFIG_... value should be interpreted as 0 and not the LVGL default - is_one = re.search(r'[\s]*#[\s]*define[\s]*[A-Z0-9_]+[\s]+1([\s]*$|[\s]+)', line) + is_one = re.search(r'#[\s]*define[\s]*[A-Z0-9_]+[\s]+1([\s]*$|[\s]+)', line) if is_one: #1. Use the value if already set from lv_conf.h or anything else (i.e. do nothing) #2. In Kconfig environment use the CONFIG_... value if set, else use 0 @@ -119,7 +119,7 @@ for line in fin.read().splitlines(): f'{indent} #define {name} 0\n' f'{indent} #endif\n' f'{indent} #else\n' - f'{indent} #define{name_and_value}\n' + f'{indent} {line}\n' f'{indent} #endif\n' f'{indent}#endif\n' ) @@ -133,7 +133,7 @@ for line in fin.read().splitlines(): f'{indent} #ifdef CONFIG_{name.upper()}\n' f'{indent} #define {name} CONFIG_{name.upper()}\n' f'{indent} #else\n' - f'{indent} #define{name_and_value}\n' + f'{indent} {line}\n' f'{indent} #endif\n' f'{indent}#endif\n' ) diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 0e766b184..9e7d97bc8 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -141,8 +141,20 @@ #endif /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ #if LV_MEM_ADR == 0 - //#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/ - //#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/ + #ifndef LV_MEM_POOL_INCLUDE + #ifdef CONFIG_LV_MEM_POOL_INCLUDE + #define LV_MEM_POOL_INCLUDE CONFIG_LV_MEM_POOL_INCLUDE + #else + #undef LV_MEM_POOL_INCLUDE + #endif + #endif + #ifndef LV_MEM_POOL_ALLOC + #ifdef CONFIG_LV_MEM_POOL_ALLOC + #define LV_MEM_POOL_ALLOC CONFIG_LV_MEM_POOL_ALLOC + #else + #undef LV_MEM_POOL_ALLOC + #endif + #endif #endif #else /*LV_MEM_CUSTOM*/ @@ -319,14 +331,14 @@ #ifdef CONFIG_LV_LAYER_SIMPLE_BUF_SIZE #define LV_LAYER_SIMPLE_BUF_SIZE CONFIG_LV_LAYER_SIMPLE_BUF_SIZE #else - #define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) + #define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024) #endif #endif #ifndef LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE #ifdef CONFIG_LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE #define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE CONFIG_LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE #else - #define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE LV_MAX(lv_area_get_width(&draw_area) * px_size, 2048) + #define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE LV_MAX(lv_area_get_width(&draw_area) * px_size, 2048) #endif #endif @@ -339,7 +351,7 @@ #ifdef CONFIG_LV_IMG_CACHE_DEF_SIZE #define LV_IMG_CACHE_DEF_SIZE CONFIG_LV_IMG_CACHE_DEF_SIZE #else - #define LV_IMG_CACHE_DEF_SIZE 0 + #define LV_IMG_CACHE_DEF_SIZE 0 #endif #endif @@ -349,7 +361,7 @@ #ifdef CONFIG_LV_GRADIENT_MAX_STOPS #define LV_GRADIENT_MAX_STOPS CONFIG_LV_GRADIENT_MAX_STOPS #else - #define LV_GRADIENT_MAX_STOPS 2 + #define LV_GRADIENT_MAX_STOPS 2 #endif #endif @@ -362,7 +374,7 @@ #ifdef CONFIG_LV_GRAD_CACHE_DEF_SIZE #define LV_GRAD_CACHE_DEF_SIZE CONFIG_LV_GRAD_CACHE_DEF_SIZE #else - #define LV_GRAD_CACHE_DEF_SIZE 0 + #define LV_GRAD_CACHE_DEF_SIZE 0 #endif #endif @@ -373,7 +385,7 @@ #ifdef CONFIG_LV_DITHER_GRADIENT #define LV_DITHER_GRADIENT CONFIG_LV_DITHER_GRADIENT #else - #define LV_DITHER_GRADIENT 0 + #define LV_DITHER_GRADIENT 0 #endif #endif #if LV_DITHER_GRADIENT @@ -384,7 +396,7 @@ #ifdef CONFIG_LV_DITHER_ERROR_DIFFUSION #define LV_DITHER_ERROR_DIFFUSION CONFIG_LV_DITHER_ERROR_DIFFUSION #else - #define LV_DITHER_ERROR_DIFFUSION 0 + #define LV_DITHER_ERROR_DIFFUSION 0 #endif #endif #endif @@ -1959,7 +1971,7 @@ #ifdef CONFIG_LV_FS_STDIO_CACHE_SIZE #define LV_FS_STDIO_CACHE_SIZE CONFIG_LV_FS_STDIO_CACHE_SIZE #else - #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif #endif #endif @@ -1991,7 +2003,7 @@ #ifdef CONFIG_LV_FS_POSIX_CACHE_SIZE #define LV_FS_POSIX_CACHE_SIZE CONFIG_LV_FS_POSIX_CACHE_SIZE #else - #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ #endif #endif #endif @@ -2009,7 +2021,7 @@ #ifdef CONFIG_LV_FS_WIN32_LETTER #define LV_FS_WIN32_LETTER CONFIG_LV_FS_WIN32_LETTER #else - #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #endif #endif #ifndef LV_FS_WIN32_PATH @@ -2033,7 +2045,7 @@ #ifdef CONFIG_LV_USE_FS_FATFS #define LV_USE_FS_FATFS CONFIG_LV_USE_FS_FATFS #else - #define LV_USE_FS_FATFS 0 + #define LV_USE_FS_FATFS 0 #endif #endif #if LV_USE_FS_FATFS @@ -2161,7 +2173,7 @@ #ifdef CONFIG_LV_USE_FFMPEG #define LV_USE_FFMPEG CONFIG_LV_USE_FFMPEG #else - #define LV_USE_FFMPEG 0 + #define LV_USE_FFMPEG 0 #endif #endif #if LV_USE_FFMPEG @@ -2193,7 +2205,7 @@ #ifdef CONFIG_LV_USE_MONKEY #define LV_USE_MONKEY CONFIG_LV_USE_MONKEY #else - #define LV_USE_MONKEY 0 + #define LV_USE_MONKEY 0 #endif #endif @@ -2202,7 +2214,7 @@ #ifdef CONFIG_LV_USE_GRIDNAV #define LV_USE_GRIDNAV CONFIG_LV_USE_GRIDNAV #else - #define LV_USE_GRIDNAV 0 + #define LV_USE_GRIDNAV 0 #endif #endif @@ -2259,7 +2271,7 @@ #ifdef CONFIG_LV_USE_DEMO_WIDGETS #define LV_USE_DEMO_WIDGETS CONFIG_LV_USE_DEMO_WIDGETS #else - #define LV_USE_DEMO_WIDGETS 0 + #define LV_USE_DEMO_WIDGETS 0 #endif #endif #if LV_USE_DEMO_WIDGETS @@ -2267,7 +2279,7 @@ #ifdef CONFIG_LV_DEMO_WIDGETS_SLIDESHOW #define LV_DEMO_WIDGETS_SLIDESHOW CONFIG_LV_DEMO_WIDGETS_SLIDESHOW #else - #define LV_DEMO_WIDGETS_SLIDESHOW 0 + #define LV_DEMO_WIDGETS_SLIDESHOW 0 #endif #endif #endif @@ -2277,7 +2289,7 @@ #ifdef CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER #define LV_USE_DEMO_KEYPAD_AND_ENCODER CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER #else - #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 #endif #endif @@ -2286,7 +2298,7 @@ #ifdef CONFIG_LV_USE_DEMO_BENCHMARK #define LV_USE_DEMO_BENCHMARK CONFIG_LV_USE_DEMO_BENCHMARK #else - #define LV_USE_DEMO_BENCHMARK 0 + #define LV_USE_DEMO_BENCHMARK 0 #endif #endif @@ -2295,7 +2307,7 @@ #ifdef CONFIG_LV_USE_DEMO_STRESS #define LV_USE_DEMO_STRESS CONFIG_LV_USE_DEMO_STRESS #else - #define LV_USE_DEMO_STRESS 0 + #define LV_USE_DEMO_STRESS 0 #endif #endif @@ -2304,46 +2316,46 @@ #ifdef CONFIG_LV_USE_DEMO_MUSIC #define LV_USE_DEMO_MUSIC CONFIG_LV_USE_DEMO_MUSIC #else - #define LV_USE_DEMO_MUSIC 0 + #define LV_USE_DEMO_MUSIC 0 #endif #endif #if LV_USE_DEMO_MUSIC -#ifndef LV_DEMO_MUSIC_SQUARE - #ifdef CONFIG_LV_DEMO_MUSIC_SQUARE - #define LV_DEMO_MUSIC_SQUARE CONFIG_LV_DEMO_MUSIC_SQUARE - #else - #define LV_DEMO_MUSIC_SQUARE 0 + #ifndef LV_DEMO_MUSIC_SQUARE + #ifdef CONFIG_LV_DEMO_MUSIC_SQUARE + #define LV_DEMO_MUSIC_SQUARE CONFIG_LV_DEMO_MUSIC_SQUARE + #else + #define LV_DEMO_MUSIC_SQUARE 0 + #endif #endif -#endif -#ifndef LV_DEMO_MUSIC_LANDSCAPE - #ifdef CONFIG_LV_DEMO_MUSIC_LANDSCAPE - #define LV_DEMO_MUSIC_LANDSCAPE CONFIG_LV_DEMO_MUSIC_LANDSCAPE - #else - #define LV_DEMO_MUSIC_LANDSCAPE 0 + #ifndef LV_DEMO_MUSIC_LANDSCAPE + #ifdef CONFIG_LV_DEMO_MUSIC_LANDSCAPE + #define LV_DEMO_MUSIC_LANDSCAPE CONFIG_LV_DEMO_MUSIC_LANDSCAPE + #else + #define LV_DEMO_MUSIC_LANDSCAPE 0 + #endif #endif -#endif -#ifndef LV_DEMO_MUSIC_ROUND - #ifdef CONFIG_LV_DEMO_MUSIC_ROUND - #define LV_DEMO_MUSIC_ROUND CONFIG_LV_DEMO_MUSIC_ROUND - #else - #define LV_DEMO_MUSIC_ROUND 0 + #ifndef LV_DEMO_MUSIC_ROUND + #ifdef CONFIG_LV_DEMO_MUSIC_ROUND + #define LV_DEMO_MUSIC_ROUND CONFIG_LV_DEMO_MUSIC_ROUND + #else + #define LV_DEMO_MUSIC_ROUND 0 + #endif #endif -#endif -#ifndef LV_DEMO_MUSIC_LARGE - #ifdef CONFIG_LV_DEMO_MUSIC_LARGE - #define LV_DEMO_MUSIC_LARGE CONFIG_LV_DEMO_MUSIC_LARGE - #else - #define LV_DEMO_MUSIC_LARGE 0 + #ifndef LV_DEMO_MUSIC_LARGE + #ifdef CONFIG_LV_DEMO_MUSIC_LARGE + #define LV_DEMO_MUSIC_LARGE CONFIG_LV_DEMO_MUSIC_LARGE + #else + #define LV_DEMO_MUSIC_LARGE 0 + #endif #endif -#endif -#ifndef LV_DEMO_MUSIC_AUTO_PLAY - #ifdef CONFIG_LV_DEMO_MUSIC_AUTO_PLAY - #define LV_DEMO_MUSIC_AUTO_PLAY CONFIG_LV_DEMO_MUSIC_AUTO_PLAY - #else - #define LV_DEMO_MUSIC_AUTO_PLAY 0 + #ifndef LV_DEMO_MUSIC_AUTO_PLAY + #ifdef CONFIG_LV_DEMO_MUSIC_AUTO_PLAY + #define LV_DEMO_MUSIC_AUTO_PLAY CONFIG_LV_DEMO_MUSIC_AUTO_PLAY + #else + #define LV_DEMO_MUSIC_AUTO_PLAY 0 + #endif #endif #endif -#endif