diff --git a/lv_conf_checker.h b/lv_conf_checker.h index e4caa94801..8751c74e9c 100644 --- a/lv_conf_checker.h +++ b/lv_conf_checker.h @@ -40,7 +40,8 @@ #endif #endif /*LV_MEM_CUSTOM*/ -/* Garbage Collector settings. */ +/* Garbage Collector settings + * Used if lvgl is binded to higher language and the memory is managed by that language */ #ifndef LV_ENABLE_GC #define LV_ENABLE_GC 0 #endif @@ -89,7 +90,7 @@ *----------------*/ /* VDB (Virtual Display Buffer) is an internal graphics buffer. - * To images will be drawn into this buffer first and then + * The GUI will be drawn into this buffer first and then * the buffer will be passed to your `disp_drv.disp_flush` function to * copy it to your frame buffer. * VDB is required for: buffered drawing, opacity, anti-aliasing and shadows @@ -115,7 +116,7 @@ #define LV_VDB_ADR 0 #endif -/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional) +/* Use two Virtual Display buffers (VDB) to parallelize rendering and flushing * The flushing should use DMA to write the frame buffer in the background */ #ifndef LV_VDB_DOUBLE #define LV_VDB_DOUBLE 0 @@ -165,7 +166,7 @@ /*Color settings*/ #ifndef LV_COLOR_DEPTH -#define LV_COLOR_DEPTH 32 /*Color depth: 1/8/16/32*/ +#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/ #endif #ifndef LV_COLOR_16_SWAP #define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/ @@ -224,6 +225,9 @@ #ifndef LV_ATTRIBUTE_TASK_HANDLER #define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ #endif +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/ +#endif #ifndef LV_COMPILER_VLA_SUPPORTED #define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ #endif @@ -237,7 +241,7 @@ #endif #if LV_TICK_CUSTOM == 1 #ifndef LV_TICK_CUSTOM_INCLUDE -#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/ +#define LV_TICK_CUSTOM_INCLUDE "sonething.h" /*Header for the sys time function*/ #endif #ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ @@ -262,7 +266,7 @@ /* 1: Print the log with 'printf'; 0: user need to register a callback*/ #ifndef LV_LOG_PRINTF -# define LV_LOG_PRINTF 1 +# define LV_LOG_PRINTF 0 #endif #endif /*USE_LV_LOG*/ @@ -386,7 +390,7 @@ #define LV_OBJ_FREE_PTR 1 /*Enable the free pointer attribute*/ #endif #ifndef LV_OBJ_REALIGN -#define LV_OBJ_REALIGN 0 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ +#define LV_OBJ_REALIGN 1 /*Enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ #endif /*================== diff --git a/lv_conf_templ.h b/lv_conf_templ.h index b6c7c0e292..f946864b2e 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -136,6 +136,7 @@ /*Compiler settings*/ #define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */ #define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ +#define LV_ATTRIBUTE_MEM_ALIGN /* With size optimization (-Os) the compiler might not align data to 4 or 8 byte boundary. This alignment will be explicitly applied where needed.*/ #define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ #define LV_COMPILER_NON_CONST_INIT_SUPPORTED 1 /* 1: Initialization with non constant values are supported */ diff --git a/lv_core/lv_vdb.c b/lv_core/lv_vdb.c index c50eb99abf..38aae34f41 100644 --- a/lv_core/lv_vdb.c +++ b/lv_core/lv_vdb.c @@ -20,6 +20,10 @@ #define LV_ATTRIBUTE_FLUSH_READY #endif +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + /********************** * TYPEDEFS **********************/ @@ -36,7 +40,7 @@ #if LV_VDB_DOUBLE == 0 # if LV_VDB_ADR == 0 /*If the buffer address is not specified simply allocate it*/ -static uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES]; +static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf[LV_VDB_SIZE_IN_BYTES]; static lv_vdb_t vdb = {.buf = (lv_color_t *)vdb_buf}; # else /*LV_VDB_ADR != 0*/ /*If the buffer address is specified use that address*/ @@ -49,8 +53,8 @@ static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR}; static uint8_t vdb_active = 0; # if LV_VDB_ADR == 0 /*If the buffer address is not specified simply allocate it*/ -static uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES]; -static uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES]; +static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf1[LV_VDB_SIZE_IN_BYTES]; +static LV_ATTRIBUTE_MEM_ALIGN uint8_t vdb_buf2[LV_VDB_SIZE_IN_BYTES]; static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *) vdb_buf1}, {.buf = (lv_color_t *) vdb_buf2}}; # else /*LV_VDB_ADR != 0*/ /*If the buffer address is specified use that address*/ diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index c8b2fab558..4d1506d9aa 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -30,6 +30,10 @@ *********************/ #define VFILL_HW_ACC_SIZE_LIMIT 50 /*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/ +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + /********************** * TYPEDEFS **********************/ @@ -147,7 +151,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, #if USE_LV_GPU - static lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/ + static LV_ATTRIBUTE_MEM_ALIGN lv_color_t color_array_tmp[LV_HOR_RES]; /*Used by 'lv_disp_mem_blend'*/ static lv_coord_t last_width = -1; lv_coord_t w = lv_area_get_width(&vdb_rel_a); @@ -529,21 +533,6 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); #else vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].alpha, px_color, opa_result); -// if(vdb_buf_tmp[col].alpha == LV_OPA_TRANSP) { -// /* When it is the first visible pixel on the transparent screen -// * simlply use this color and set the pixel opa as backrounds alpha*/ -// vdb_buf_tmp[col] = px_color; -// vdb_buf_tmp[col].alpha = opa_result; -// } else { -// /* If already this pixel is already written then for performance reasons -// * don't care with alpha channel -// */ -// lv_opa_t bg_opa = vdb_buf_tmp[col].alpha; -// vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); -// -// uint16_t opa_tmp = (uint16_t)opa_result + ((bg_opa * (255 - opa_result)) >> 8); -// vdb_buf_tmp[col].alpha = opa_tmp > 0xFF ? 0xFF : opa_tmp ; -// } #endif } }