fix image demos on big endian systems
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## v7.1.0 (planned on 07.07.2020)
|
## v7.1.0 (planned on 07.07.2020)
|
||||||
*Available in the `master` branch*
|
*Available in the `master` branch*
|
||||||
- Change some lv_style_t methods to support big endian hardware.
|
- 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
|
### New features
|
||||||
- Add `focus_parent` attribute to `lv_obj`
|
- Add `focus_parent` attribute to `lv_obj`
|
||||||
|
|||||||
@@ -222,6 +222,10 @@ typedef void * lv_img_decoder_user_data_t;
|
|||||||
/*=====================
|
/*=====================
|
||||||
* Compiler settings
|
* 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 a custom attribute to `lv_tick_inc` function */
|
||||||
#define LV_ATTRIBUTE_TICK_INC
|
#define LV_ATTRIBUTE_TICK_INC
|
||||||
|
|
||||||
|
|||||||
@@ -102,10 +102,26 @@ typedef uint8_t lv_img_cf_t;
|
|||||||
/**
|
/**
|
||||||
* LVGL image header
|
* 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 {
|
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 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
|
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||||
non-printable character*/
|
non-printable character*/
|
||||||
@@ -115,7 +131,7 @@ typedef struct {
|
|||||||
uint32_t w : 11; /*Width of the image map*/
|
uint32_t w : 11; /*Width of the image map*/
|
||||||
uint32_t h : 11; /*Height of the image map*/
|
uint32_t h : 11; /*Height of the image map*/
|
||||||
} lv_img_header_t;
|
} lv_img_header_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Image header it is compatible with
|
/** Image header it is compatible with
|
||||||
* the result from image converter utility*/
|
* the result from image converter utility*/
|
||||||
|
|||||||
Reference in New Issue
Block a user