From 2550368d30fba4f7ce1d934468d413741625d484 Mon Sep 17 00:00:00 2001 From: jbamaral Date: Tue, 23 Jun 2020 19:16:36 -0300 Subject: [PATCH 1/4] fix image demos on big endian systems --- CHANGELOG.md | 1 + lv_conf_template.h | 4 ++++ src/lv_draw/lv_img_buf.h | 22 +++++++++++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a74983ffd..783475036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## v7.1.0 (planned on 07.07.2020) *Available in the `master` branch* - Change some lv_style_t methods to support big endian hardware. +- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems. ### New features - Add `focus_parent` attribute to `lv_obj` diff --git a/lv_conf_template.h b/lv_conf_template.h index de2287cf4..f4cd80800 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -222,6 +222,10 @@ typedef void * lv_img_decoder_user_data_t; /*===================== * Compiler settings *====================*/ + +/* For big endian systems set to 1 */ +#define LV_BIG_ENDIAN_SYSTEM 0 + /* Define a custom attribute to `lv_tick_inc` function */ #define LV_ATTRIBUTE_TICK_INC diff --git a/src/lv_draw/lv_img_buf.h b/src/lv_draw/lv_img_buf.h index a8722cf42..4b6db2b87 100644 --- a/src/lv_draw/lv_img_buf.h +++ b/src/lv_draw/lv_img_buf.h @@ -102,10 +102,26 @@ typedef uint8_t lv_img_cf_t; /** * LVGL image header */ +/* The first 8 bit is very important to distinguish the different source types. + * For more info see `lv_img_get_src_type()` in lv_img.c + * On big endian systems the order is reversed so cf and always_zero must be at + * the end of the struct. + * */ +#if LV_BIG_ENDIAN_SYSTEM +typedef struct { + + uint32_t h : 11; /*Height of the image map*/ + uint32_t w : 11; /*Width of the image map*/ + uint32_t reserved : 2; /*Reserved to be used later*/ + uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a + non-printable character*/ + uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/ + + +} lv_img_header_t; +#else typedef struct { - /* The first 8 bit is very important to distinguish the different source types. - * For more info see `lv_img_get_src_type()` in lv_img.c */ uint32_t cf : 5; /* Color format: See `lv_img_color_format_t`*/ uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a non-printable character*/ @@ -115,7 +131,7 @@ typedef struct { uint32_t w : 11; /*Width of the image map*/ uint32_t h : 11; /*Height of the image map*/ } lv_img_header_t; - +#endif /** Image header it is compatible with * the result from image converter utility*/ From 5f6c7743adc2b3204cadf66f0ccc097c4555efd1 Mon Sep 17 00:00:00 2001 From: jbamaral Date: Wed, 24 Jun 2020 08:38:44 -0300 Subject: [PATCH 2/4] update internal configuration --- src/lv_conf_internal.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index da8f7d8d1..70feabb8d 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -266,6 +266,11 @@ #ifndef LV_USE_GPU_STM32_DMA2D #define LV_USE_GPU_STM32_DMA2D 0 #endif +/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor +e.g. "stm32f769xx.h" or "stm32f429xx.h" */ +#ifndef LV_GPU_DMA2D_CMSIS_INCLUDE +#define LV_GPU_DMA2D_CMSIS_INCLUDE +#endif /* 1: Enable file system (might be required for images */ #ifndef LV_USE_FILESYSTEM @@ -319,6 +324,12 @@ /*===================== * Compiler settings *====================*/ + +/* For big endian systems set to 1 */ +#ifndef LV_BIG_ENDIAN_SYSTEM +#define LV_BIG_ENDIAN_SYSTEM 0 +#endif + /* Define a custom attribute to `lv_tick_inc` function */ #ifndef LV_ATTRIBUTE_TICK_INC #define LV_ATTRIBUTE_TICK_INC @@ -474,7 +485,7 @@ /* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. * The symbols are available via `LV_SYMBOL_...` defines - * More info about fonts: https://docs.lvgl.com/#Fonts + * More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html * To create a new font go to: https://lvgl.com/ttf-font-to-c-array */ @@ -684,14 +695,14 @@ #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 #endif -/* The control character to use for signaling text recoloring. */ +/* The control character to use for signalling text recoloring. */ #ifndef LV_TXT_COLOR_CMD #define LV_TXT_COLOR_CMD "#" #endif /* Support bidirectional texts. * Allows mixing Left-to-Right and Right-to-Left texts. - * The direction will be processed according to the Unicode Bidirectional Algorithm: + * The direction will be processed according to the Unicode Bidirectioanl Algorithm: * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ #ifndef LV_USE_BIDI #define LV_USE_BIDI 0 From 1733508e9a03b1140fa3527dd611b2687ee6f004 Mon Sep 17 00:00:00 2001 From: jbamaral Date: Wed, 24 Jun 2020 10:01:42 -0300 Subject: [PATCH 3/4] move bug logs to their right position in changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 783475036..6bc4dda0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,6 @@ ## v7.1.0 (planned on 07.07.2020) *Available in the `master` branch* -- Change some lv_style_t methods to support big endian hardware. -- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems. ### New features - Add `focus_parent` attribute to `lv_obj` @@ -16,6 +14,8 @@ ### Bugfixes - `lv_img` fix invalidation area when angle or zoom changes - Update the style handling to support Big endian MCUs +- Change some methods to support big endian hardware. +- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems. ## v7.0.2 (16.06.2020) From 3761db65e08c06a0b943d9f7521d2ae760abf2fa Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 25 Jun 2020 07:32:45 -0400 Subject: [PATCH 4/4] Fix spelling issue --- src/lv_conf_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 70feabb8d..8b389a355 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -702,7 +702,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* Support bidirectional texts. * Allows mixing Left-to-Right and Right-to-Left texts. - * The direction will be processed according to the Unicode Bidirectioanl Algorithm: + * The direction will be processed according to the Unicode Bidirectional Algorithm: * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ #ifndef LV_USE_BIDI #define LV_USE_BIDI 0