Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
LVgl 6.1.1 used
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo2048 committed Dec 8, 2019
1 parent aa0a56e commit 3ae9a78
Show file tree
Hide file tree
Showing 40 changed files with 135 additions and 138 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/littlevgl/arduino"
},
"version": "2.0.4",
"version": "2.1.4",
"license": "MIT",
"frameworks": "arduino",
"build": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=lv_arduino
version=2.0.4
version=2.1.4
author=Gabor Kiss-Vamosi
maintainer=Pavel Brychta <[email protected]>
sentence=Full-featured Graphics Library for embedded systems
Expand Down
2 changes: 1 addition & 1 deletion src/library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lvgl",
"version": "6.0.2",
"version": "6.1.1",
"keywords": "graphics, gui, embedded, littlevgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository":
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_core/lv_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void lv_debug_log_error(const char * msg, uint64_t value)
{
static const char hex[] = "0123456789ABCDEF";

uint32_t msg_len = strlen(msg);
size_t msg_len = strlen(msg);
uint32_t value_len = sizeof(unsigned long int);

if(msg_len < 230) {
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_core/lv_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void lv_debug_log_error(const char * msg, uint64_t value);
{ \
if(!(expr)) { \
LV_LOG_ERROR(__func__); \
lv_debug_log_error(msg, (unsigned long int)value); \
lv_debug_log_error(msg, (uint64_t)value); \
while(1); \
} \
}
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_core/lv_disp.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static inline lv_obj_t * lv_layer_top(void)
}

/**
* Get the active screen of the deafult display
* Get the active screen of the default display
* @return pointer to the sys layer
*/
static inline lv_obj_t * lv_layer_sys(void)
Expand Down
20 changes: 10 additions & 10 deletions src/src/lv_core/lv_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
* @param obj pointer to an object
* @return the width which still fits into the container
*/
lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj)
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);

Expand All @@ -1853,7 +1853,7 @@ lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj)
* @param obj pointer to an object
* @return the height which still fits into the container
*/
lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj)
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);

Expand All @@ -1867,7 +1867,7 @@ lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: auto realign is enabled; false: auto realign is disabled
*/
bool lv_obj_get_auto_realign(lv_obj_t * obj)
bool lv_obj_get_auto_realign(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);

Expand Down Expand Up @@ -2250,7 +2250,7 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj)
* @param obj pointer to an object which type should be get
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
*/
void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf)
{
LV_ASSERT_NULL(buf);
LV_ASSERT_NULL(obj);
Expand All @@ -2260,7 +2260,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
memset(buf, 0, sizeof(lv_obj_type_t));
memset(&tmp, 0, sizeof(lv_obj_type_t));

obj->signal_cb(obj, LV_SIGNAL_GET_TYPE, &tmp);
obj->signal_cb((lv_obj_t *)obj, LV_SIGNAL_GET_TYPE, &tmp);

uint8_t cnt;
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
Expand All @@ -2281,7 +2281,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
* @param obj pointer to an object
* @return user data
*/
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);

Expand All @@ -2293,11 +2293,11 @@ lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj)
* @param obj pointer to an object
* @return pointer to the user data
*/
lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj)
lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);

return &obj->user_data;
return (lv_obj_user_data_t *)&obj->user_data;
}

/**
Expand Down Expand Up @@ -2351,8 +2351,8 @@ bool lv_obj_is_focused(const lv_obj_t * obj)
/**
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
* @param obj pointer to an object
* @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback)
* @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved)
* @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback)
* @param name name of the object. E.g. "lv_btn". (Only the pointer is saved)
* @return LV_RES_OK
*/
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name)
Expand Down
16 changes: 8 additions & 8 deletions src/src/lv_core/lv_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -732,21 +732,21 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
* @param obj pointer to an object
* @return the width which still fits into the container
*/
lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj);
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj);

/**
* Get that height reduced by the top an bottom padding.
* @param obj pointer to an object
* @return the height which still fits into the container
*/
lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj);
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);

/**
* Get the automatic realign property of the object.
* @param obj pointer to an object
* @return true: auto realign is enabled; false: auto realign is disabled
*/
bool lv_obj_get_auto_realign(lv_obj_t * obj);
bool lv_obj_get_auto_realign(const lv_obj_t * obj);

/**
* Get the left padding of extended clickable area
Expand Down Expand Up @@ -925,22 +925,22 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj);
* @param obj pointer to an object which type should be get
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
*/
void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf);
void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf);

#if LV_USE_USER_DATA
/**
* Get the object's user data
* @param obj pointer to an object
* @return user data
*/
lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj);
lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj);

/**
* Get a pointer to the object's user data
* @param obj pointer to an object
* @return pointer to the user data
*/
lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj);
lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj);

/**
* Set the object's user data. The data will be copied.
Expand Down Expand Up @@ -974,8 +974,8 @@ bool lv_obj_is_focused(const lv_obj_t * obj);

/**
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
* @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback)
* @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved)
* @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback)
* @param name name of the object. E.g. "lv_btn". (Only the pointer is saved)
* @return LV_RES_OK
*/
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name);
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_draw/lv_draw_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv
map_p += bit_ofs >> 3;

uint8_t letter_px;
lv_opa_t px_opa;
lv_opa_t px_opa = 0;
uint16_t col_bit;
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */

Expand Down
8 changes: 4 additions & 4 deletions src/src/lv_draw/lv_draw_img.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void *
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, const lv_style_t * style)
{
lv_color_t p_color = LV_COLOR_BLACK;
if(x >= dsc->header.w) {
if(x >= (lv_coord_t)dsc->header.w) {
x = dsc->header.w - 1;
LV_LOG_WARN("lv_canvas_get_px: x is too large (out of canvas)");
} else if(x < 0) {
x = 0;
LV_LOG_WARN("lv_canvas_get_px: x is < 0 (out of canvas)");
}

if(y >= dsc->header.h) {
if(y >= (lv_coord_t)dsc->header.h) {
y = dsc->header.h - 1;
LV_LOG_WARN("lv_canvas_get_px: y is too large (out of canvas)");
} else if(y < 0) {
Expand Down Expand Up @@ -158,15 +158,15 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
*/
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
{
if(x >= dsc->header.w) {
if(x >= (lv_coord_t)dsc->header.w) {
x = dsc->header.w - 1;
LV_LOG_WARN("lv_canvas_get_px: x is too large (out of canvas)");
} else if(x < 0) {
x = 0;
LV_LOG_WARN("lv_canvas_get_px: x is < 0 (out of canvas)");
}

if(y >= dsc->header.h) {
if(y >= (lv_coord_t)dsc->header.h) {
y = dsc->header.h - 1;
LV_LOG_WARN("lv_canvas_get_px: y is too large (out of canvas)");
} else if(y < 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_draw/lv_img_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const
dsc->user_data = NULL;

if(dsc->src_type == LV_IMG_SRC_FILE) {
uint16_t fnlen = strlen(src);
size_t fnlen = strlen(src);
dsc->src = lv_mem_alloc(fnlen + 1);
strcpy((char *)dsc->src, src);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_font/lv_font.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ typedef struct _lv_font_struct
uint8_t line_height; /**< The real line height where any text fits*/
uint8_t base_line; /**< Base line measured from the top of the line_height*/
uint8_t subpx :2; /**< An element of `lv_font_subpx_t`*/
void * dsc; /**< Store implementation specific data here*/
void * dsc; /**< Store implementation specific or run_time data or caching here*/
#if LV_USE_USER_DATA
lv_font_user_data_t user_data; /**< Custom user data for font. */
#endif
Expand Down
16 changes: 8 additions & 8 deletions src/src/lv_font/lv_font_fmt_txt.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
{
lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc;
uint32_t gid = get_glyph_dsc_id(font, unicode_letter);
if(!gid) return false;
if(!gid) return NULL;

const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid];

Expand Down Expand Up @@ -107,7 +107,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
if(buf == NULL) return NULL;
}

decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, fdsc->bpp);
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, (uint8_t)fdsc->bpp);
return buf;
}

Expand Down Expand Up @@ -150,7 +150,7 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t *
dsc_out->box_w = gdsc->box_w;
dsc_out->ofs_x = gdsc->ofs_x;
dsc_out->ofs_y = gdsc->ofs_y;
dsc_out->bpp = fdsc->bpp;
dsc_out->bpp = (uint8_t)fdsc->bpp;

return true;
}
Expand Down Expand Up @@ -186,7 +186,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);

if(p) {
uint32_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list;
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
glyph_id = fdsc->cmaps[i].glyph_id_start + ofs;
}
Expand All @@ -195,7 +195,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);

if(p) {
uint32_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list;
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t*) fdsc->cmaps[i].unicode_list);
ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/
const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list;
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs];
Expand Down Expand Up @@ -232,20 +232,20 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t

/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
uint32_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids;
lv_uintptr_t ofs = (lv_uintptr_t)(kid_p - g_ids);
ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/
value = kdsc->values[ofs];
}
} else if(kdsc->glyph_ids_size == 1) {
/* Use binary search to find the kern value.
* The pairs are ordered left_id first, then right_id secondly. */
const uint16_t * g_ids = kdsc->glyph_ids;
uint32_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
lv_uintptr_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);

/*If the `g_id_both` were found get its index from the pointer*/
if(kid_p) {
uint32_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids;
lv_uintptr_t ofs = (lv_uintptr_t) (kid_p - (const uint8_t *)g_ids);
ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/
value = kdsc->values[ofs];
}
Expand Down
1 change: 0 additions & 1 deletion src/src/lv_font/lv_font_fmt_txt.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ typedef struct {
* from `lv_font_fmt_txt_bitmap_format_t`
*/
uint16_t bitmap_format :2;
uint16_t subpx :1;

/*Cache the last letter and is glyph id*/
uint32_t last_letter;
Expand Down
2 changes: 1 addition & 1 deletion src/src/lv_misc/lv_color.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ static inline uint32_t lv_color_to32(lv_color_t color)
LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
LV_COLOR_SET_G32(ret, LV_COLOR_GET_G(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/
LV_COLOR_SET_A32(color, 0xFF);
LV_COLOR_SET_A32(ret, 0xFF);
return ret.full;
#elif LV_COLOR_DEPTH == 16
/**
Expand Down
10 changes: 5 additions & 5 deletions src/src/lv_misc/lv_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ char * lv_fs_get_letters(char * buf)
*/
const char * lv_fs_get_ext(const char * fn)
{
uint16_t i;
size_t i;
for(i = strlen(fn); i > 0; i--) {
if(fn[i] == '.') {
return &fn[i + 1];
Expand All @@ -558,7 +558,7 @@ const char * lv_fs_get_ext(const char * fn)
*/
char * lv_fs_up(char * path)
{
uint16_t len = strlen(path);
size_t len = strlen(path);
if(len == 0) return path;

len--; /*Go before the trailing '\0'*/
Expand All @@ -572,7 +572,7 @@ char * lv_fs_up(char * path)
return path;
}

uint16_t i;
size_t i;
for(i = len; i > 0; i--) {
if(path[i] == '/' || path[i] == '\\') break;
}
Expand All @@ -589,7 +589,7 @@ char * lv_fs_up(char * path)
*/
const char * lv_fs_get_last(const char * path)
{
uint16_t len = strlen(path);
size_t len = strlen(path);
if(len == 0) return path;

len--; /*Go before the trailing '\0'*/
Expand All @@ -602,7 +602,7 @@ const char * lv_fs_get_last(const char * path)
return path;
}

uint16_t i;
size_t i;
for(i = len; i > 0; i--) {
if(path[i] == '/' || path[i] == '\\') break;
}
Expand Down
Loading

0 comments on commit 3ae9a78

Please sign in to comment.