run clang-formatter

This commit is contained in:
Gabor Kiss-Vamosi
2019-06-27 07:16:15 +02:00
parent e1989c5706
commit 8f962a0464
62 changed files with 372 additions and 357 deletions

View File

@@ -1606,23 +1606,18 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
* (Without the size of the border or other extra graphical elements)
* @param coords_p store the result area here
*/
void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p)
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p)
{
const lv_style_t *style = lv_obj_get_style(obj);
if(style->body.border.part & LV_BORDER_LEFT)
coords_p->x1 += style->body.border.width;
const lv_style_t * style = lv_obj_get_style(obj);
if(style->body.border.part & LV_BORDER_LEFT) coords_p->x1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_RIGHT)
coords_p->x2 -= style->body.border.width;
if(style->body.border.part & LV_BORDER_RIGHT) coords_p->x2 -= style->body.border.width;
if(style->body.border.part & LV_BORDER_TOP)
coords_p->y1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_TOP) coords_p->y1 += style->body.border.width;
if(style->body.border.part & LV_BORDER_BOTTOM)
coords_p->y2 -= style->body.border.width;
if(style->body.border.part & LV_BORDER_BOTTOM) coords_p->y2 -= style->body.border.width;
}
/**
* Get the x coordinate of object
* @param obj pointer to an object

View File

@@ -242,7 +242,6 @@ typedef struct
... [x]: "lv_obj" */
} lv_obj_type_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@@ -668,7 +667,7 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
* (Without the size of the border or other extra graphical elements)
* @param coords_p store the result area here
*/
void lv_obj_get_inner_coords(const lv_obj_t *obj, lv_area_t * coords_p);
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p);
/**
* Get the x coordinate of object

View File

@@ -562,7 +562,8 @@ static void lv_refr_vdb_flush(void)
/*In double buffered mode wait until the other buffer is flushed before flushing the current
* one*/
if(lv_disp_is_double_buf(disp_refr)) {
while(vdb->flushing);
while(vdb->flushing)
;
}
vdb->flushing = 1;
@@ -572,7 +573,9 @@ static void lv_refr_vdb_flush(void)
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
if(vdb->buf1 && vdb->buf2) {
if(vdb->buf_act == vdb->buf1) vdb->buf_act = vdb->buf2;
else vdb->buf_act = vdb->buf1;
if(vdb->buf_act == vdb->buf1)
vdb->buf_act = vdb->buf2;
else
vdb->buf_act = vdb->buf1;
}
}

View File

@@ -86,14 +86,13 @@ void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t
x -= vdb->area.x1;
y -= vdb->area.y1;
if(disp->driver.set_px_cb) {
disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa);
} else {
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
#endif
lv_color_t * vdb_px_p = vdb->buf_act;
vdb_px_p += y * vdb_width + x;
@@ -429,13 +428,11 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
lv_coord_t row;
lv_coord_t map_useful_w = lv_area_get_width(&masked_a);
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
/*The simplest case just copy the pixels into the VDB*/
if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) {
@@ -532,7 +529,6 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
/*Normal native VDB write*/
else {
if(opa_result == LV_OPA_COVER)
vdb_buf_tmp[col] = px_color;
else {
@@ -540,8 +536,8 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint
vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result);
} else {
#if LV_COLOR_DEPTH == 32
vdb_buf_tmp[col] =
color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, px_color, opa_result);
vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha,
px_color, opa_result);
#endif
}
}
@@ -624,9 +620,9 @@ static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_
/*Calculate with alpha too*/
else {
bool scr_transp = false;
#if LV_COLOR_SCREEN_TRANSP
#if LV_COLOR_SCREEN_TRANSP
scr_transp = disp->driver.screen_transp;
#endif
#endif
lv_color_t bg_tmp = LV_COLOR_BLACK;
lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa);
@@ -653,7 +649,6 @@ static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_
}
}
/**
* Mix two colors. Both color can have alpha value. It requires ARGB888 colors.
* @param bg_color background color
@@ -667,7 +662,7 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
#if LV_COLOR_SCREEN_TRANSP
/* Pick the foreground if it's fully opaque or the Background is fully transparent*/
if(fg_opa > LV_OPA_MAX|| bg_opa <= LV_OPA_MIN) {
if(fg_opa > LV_OPA_MAX || bg_opa <= LV_OPA_MIN) {
fg_color.ch.alpha = fg_opa;
return fg_color;
}
@@ -717,4 +712,3 @@ static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
#endif /*LV_COLOR_SCREEN_TRANSP*/
}

View File

@@ -309,10 +309,8 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
*/
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
{
if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
return;
}
@@ -446,24 +444,24 @@ static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mas
lv_opa_t opa =
opa_scale == LV_OPA_COVER ? style->image.opa : (uint16_t)((uint16_t)style->image.opa * opa_scale) >> 8;
lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, style);
if(cdsc == NULL) return LV_RES_INV;
bool chroma_keyed = lv_img_color_format_is_chroma_keyed(cdsc->dec_dsc.header.cf);
bool alpha_byte = lv_img_color_format_has_alpha(cdsc->dec_dsc.header.cf);
if(cdsc->dec_dsc.error_msg != NULL) {
LV_LOG_WARN("Image draw error");
lv_draw_rect(coords, mask, &lv_style_plain, LV_OPA_COVER);
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1, -1, NULL);
lv_draw_label(coords, mask, &lv_style_plain, LV_OPA_COVER, cdsc->dec_dsc.error_msg, LV_TXT_FLAG_NONE, NULL, -1,
-1, NULL);
}
/* The decoder open could open the image and gave the entire uncompressed image.
* Just draw it!*/
else if(cdsc->dec_dsc.img_data) {
lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color, style->image.intense);
lv_draw_map(coords, mask, cdsc->dec_dsc.img_data, opa, chroma_keyed, alpha_byte, style->image.color,
style->image.intense);
}
/* The whole uncompressed image is not available. Try to read it line-by-line*/
else {

View File

@@ -55,7 +55,8 @@ static uint8_t hex_char_to_num(char hex);
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
*/
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, lv_draw_label_hint_t * hint)
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
lv_draw_label_hint_t * hint)
{
const lv_font_t * font = style->text.font;
lv_coord_t w;

View File

@@ -28,7 +28,8 @@ extern "C" {
* all the previous characters needs to be checked to calculate the positions.
* This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line.
* Therefore the calculations can start from here.*/
typedef struct {
typedef struct
{
/*Index of the line at `y` coordinate*/
int32_t line_start;
@@ -38,7 +39,7 @@ typedef struct {
/*The 'y1' coordinate of the label when the hint was saved.
* Used to invalidate the hint if the label has moved too much. */
int32_t coord_y;
}lv_draw_label_hint_t;
} lv_draw_label_hint_t;
/**********************
* GLOBAL PROTOTYPES
@@ -57,7 +58,8 @@ typedef struct {
* @param sel_end end index of selected area (`LV_LABEL_TXT_SEL_OFF` if none)
*/
void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end, lv_draw_label_hint_t * hint);
const char * txt, lv_txt_flag_t flag, lv_point_t * offset, uint16_t sel_start, uint16_t sel_end,
lv_draw_label_hint_t * hint);
/**********************
* MACROS

View File

@@ -84,7 +84,7 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
* Image difficult to open should live longer to keep avoid frequent their recaching.
* Therefore increase `life` with `time_to_open`*/
cached_src = &cache[i];
cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN ;
cached_src->life += cached_src->dec_dsc.time_to_open * LV_IMG_CACHE_LIFE_GAIN;
if(cached_src->life > LV_IMG_CACHE_LIFE_LIMIT) cached_src->life = LV_IMG_CACHE_LIFE_LIMIT;
LV_LOG_TRACE("image draw: image found in the cache");
break;
@@ -114,7 +114,7 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, const lv_style_t * st
t_start = lv_tick_get();
cached_src->dec_dsc.time_to_open = 0;
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, style);
if(open_res ==LV_RES_INV) {
if(open_res == LV_RES_INV) {
LV_LOG_WARN("Image draw cannot open the image resource");
lv_img_decoder_close(&cached_src->dec_dsc);
memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));

View File

@@ -30,7 +30,7 @@ typedef struct
* Decrement all lifes by one every in every `lv_img_cache_open`.
* If life == 0 the entry can be reused,*/
int32_t life;
}lv_img_cache_entry_t;
} lv_img_cache_entry_t;
/**********************
* GLOBAL PROTOTYPES

View File

@@ -213,7 +213,6 @@ void lv_img_decoder_init(void);
*/
lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header);
/**
* Open an image.
* Try the created image decoder one by one. Once one is able to open the image that decoder is save in `dsc`

View File

@@ -71,7 +71,6 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
driver->screen_transp = 1;
#endif
#if LV_USE_GPU
driver->gpu_blend_cb = NULL;
driver->gpu_fill_cb = NULL;

View File

@@ -88,7 +88,6 @@ typedef struct _lv_anim_t
uint32_t has_run : 1; /*Indicates the animation has run in this round*/
} lv_anim_t;
/**********************
* GLOBAL PROTOTYPES
**********************/

View File

@@ -70,30 +70,41 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
**********************/
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE
# define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
#else
# define LV_LOG_TRACE(dsc) {;}
#define LV_LOG_TRACE(dsc) \
{ \
; \
}
#endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO
# define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
#else
# define LV_LOG_INFO(dsc) {;}
#define LV_LOG_INFO(dsc) \
{ \
; \
}
#endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN
# define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
#else
# define LV_LOG_WARN(dsc) {;}
#define LV_LOG_WARN(dsc) \
{ \
; \
}
#endif
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR
# define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
#else
# define LV_LOG_ERROR(dsc) {;}
#define LV_LOG_ERROR(dsc) \
{ \
; \
}
#endif
#else /*LV_USE_LOG*/
/*Do nothing if `LV_USE_LOG 0`*/

View File

@@ -96,7 +96,6 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void);
*/
lv_task_t * lv_task_create_basic(void);
/**
* Create a new lv_task
* @param task_xcb a callback which is the task itself. It will be called periodically.

View File

@@ -130,7 +130,6 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
size_res->y -= line_space;
}
/**
* Get the next line of text. Check line length and break chars too.
* @param txt a '\0' terminated string
@@ -140,8 +139,8 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
* @param flags settings for the text from 'txt_flag_type' enum
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different)
*/
uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
lv_txt_flag_t flag)
{
if(txt == NULL) return 0;
if(font == NULL) return 0;
@@ -174,8 +173,10 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
/*Check for new line chars*/
if(letter == '\n' || letter == '\r') {
/*Return with the first letter of the next line*/
if(letter == '\r' && letter_next == '\n') return i_next;
else return i;
if(letter == '\r' && letter_next == '\n')
return i_next;
else
return i;
} else { /*Check the actual length*/
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
cur_w += letter_w;

View File

@@ -312,7 +312,7 @@ uint16_t lv_bar_get_anim_time(lv_obj_t * bar)
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->anim_time;
#else
(void) bar; /*Unused*/
(void)bar; /*Unused*/
return 0;
#endif
}

View File

@@ -40,36 +40,69 @@ extern "C" {
/** Possible states of a button.
* It can be used not only by buttons but other button-like objects too*/
enum {
LV_BTN_STATE_REL, /**Released*/
LV_BTN_STATE_PR, /**Pressed*/
LV_BTN_STATE_TGL_REL, /**Toggled released*/
LV_BTN_STATE_TGL_PR, /**Toggled pressed*/
LV_BTN_STATE_INA, /**Inactive*/
LV_BTN_STATE_NUM,
/**Released*/
LV_BTN_STATE_REL,
/**Pressed*/
LV_BTN_STATE_PR,
/**Toggled released*/
LV_BTN_STATE_TGL_REL,
/**Toggled pressed*/
LV_BTN_STATE_TGL_PR,
/**Inactive*/
LV_BTN_STATE_INA,
/**Number of states*/
_LV_BTN_STATE_NUM,
};
typedef uint8_t lv_btn_state_t;
/*Data of button*/
/** Extended data of button*/
typedef struct
{
lv_cont_ext_t cont; /*Ext. of ancestor*/
/** Ext. of ancestor*/
lv_cont_ext_t cont;
/*New data for this type */
const lv_style_t * styles[LV_BTN_STATE_NUM]; /*Styles in each state*/
/**Styles in each state*/
const lv_style_t * styles[_LV_BTN_STATE_NUM];
#if LV_BTN_INK_EFFECT
uint16_t ink_in_time; /*[ms] Time of ink fill effect (0: disable ink effect)*/
uint16_t ink_wait_time; /*[ms] Wait before the ink disappears */
uint16_t ink_out_time; /*[ms] Time of ink disappearing*/
/** [ms] Time of ink fill effect (0: disable ink effect)*/
uint16_t ink_in_time;
/** [ms] Wait before the ink disappears */
uint16_t ink_wait_time;
/** [ms] Time of ink disappearing*/
uint16_t ink_out_time;
#endif
lv_btn_state_t state : 3; /*Current state of the button from 'lv_btn_state_t' enum*/
uint8_t toggle : 1; /*1: Toggle enabled*/
/** Current state of the button from 'lv_btn_state_t' enum*/
lv_btn_state_t state : 3;
/** 1: Toggle enabled*/
uint8_t toggle : 1;
} lv_btn_ext_t;
/*Styles*/
/**Styles*/
enum {
/** Release style */
LV_BTN_STYLE_REL,
/**Pressed style*/
LV_BTN_STYLE_PR,
/** Toggle released style*/
LV_BTN_STYLE_TGL_REL,
/** Toggle pressed style */
LV_BTN_STYLE_TGL_PR,
/** Inactive style*/
LV_BTN_STYLE_INA,
};
typedef uint8_t lv_btn_style_t;

View File

@@ -381,7 +381,6 @@ void lv_btnm_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnm_ctrl_t ctrl)
}
}
/**
* Clear the attributes of all buttons of a button matrix
* @param btnm pointer to a button matrix object

View File

@@ -54,7 +54,7 @@ typedef struct
const char ** map_p; /*Pointer to the current map*/
lv_area_t * button_areas; /*Array of areas of buttons*/
lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/
const lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/
const lv_style_t * styles_btn[_LV_BTN_STATE_NUM]; /*Styles of buttons in each state*/
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNM_BTN_NONE*/
uint16_t btn_id_act; /*Index of the active button (being pressed/released etc) or LV_BTNM_BTN_NONE */

View File

@@ -544,7 +544,8 @@ void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
default: flag = LV_TXT_FLAG_NONE; break;
}
lv_draw_label(&coords, &mask, style, LV_OPA_COVER, txt, flag, NULL, LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF, NULL);
lv_draw_label(&coords, &mask, style, LV_OPA_COVER, txt, flag, NULL, LV_LABEL_TEXT_SEL_OFF, LV_LABEL_TEXT_SEL_OFF,
NULL);
lv_refr_set_disp_refreshing(refr_ori);
}
@@ -601,7 +602,6 @@ void lv_canvas_draw_img(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, const voi
lv_refr_set_disp_refreshing(refr_ori);
}
/**
* Draw a line on the canvas
* @param canvas pointer to a canvas object

View File

@@ -146,8 +146,8 @@ const lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_
* @param w width of the buffer to copy
* @param h height of the buffer to copy
*/
void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x,
lv_coord_t y, lv_coord_t w, lv_coord_t h);
void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w,
lv_coord_t h);
/**
* Rotate and image and store the result on a canvas.
@@ -197,7 +197,6 @@ void lv_canvas_draw_rect(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord
void lv_canvas_draw_text(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_coord_t max_w, const lv_style_t * style,
const char * txt, lv_label_align_t align);
/**
* Draw an image on the canvas
* @param canvas pointer to a canvas object

View File

@@ -473,7 +473,8 @@ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options)
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->x_axis.num_tick_marks = num_tick_marks;
@@ -489,7 +490,8 @@ void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options)
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->y_axis.num_tick_marks = num_tick_marks;
@@ -498,10 +500,10 @@ void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
}
/**
* Set the margin around the chart, used for axes value and ticks
* @param chart pointer to an chart object
* @param margin value of the margin [px]
*/
* Set the margin around the chart, used for axes value and ticks
* @param chart pointer to an chart object
* @param margin value of the margin [px]
*/
void lv_chart_set_margin(lv_obj_t * chart, uint16_t margin)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);

View File

@@ -235,7 +235,7 @@ void lv_chart_set_update_mode(lv_obj_t * chart, lv_chart_update_mode_t update_mo
*/
static inline void lv_chart_set_style(lv_obj_t * chart, lv_chart_style_t type, const lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(chart, style);
}
@@ -267,7 +267,8 @@ void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options);
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/**
* Set the y-axis tick count and labels of a chart
@@ -277,7 +278,8 @@ void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, ui
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks, lv_chart_axis_options_t options);
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/**
* Set the margin around the chart, used for axes value and ticks
@@ -333,7 +335,7 @@ lv_opa_t lv_chart_get_series_darking(const lv_obj_t * chart);
*/
static inline const lv_style_t * lv_chart_get_style(const lv_obj_t * chart, lv_chart_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(chart);
}

View File

@@ -43,6 +43,7 @@ enum {
LV_LAYOUT_ROW_B, /*Row bottom align*/
LV_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/
LV_LAYOUT_GRID, /*Align same-sized object into a grid*/
_LV_LAYOUT_NUM
};
typedef uint8_t lv_layout_t;
@@ -52,6 +53,7 @@ enum {
LV_FIT_FLOOD, /*Align the size to the parent's edge*/
LV_FIT_FILL, /*Align the size to the parent's edge first but if there is an object out of it
then involve it*/
_LV_FIT_NUM
};
typedef uint8_t lv_fit_t;
@@ -137,7 +139,7 @@ static inline void lv_cont_set_fit(lv_obj_t * cont, lv_fit_t fit)
*/
static inline void lv_cont_set_style(lv_obj_t * cont, lv_cont_style_t type, const lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(cont, style);
}
@@ -188,7 +190,7 @@ lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont);
*/
static inline const lv_style_t * lv_cont_get_style(const lv_obj_t * cont, lv_cont_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(cont);
}

View File

@@ -128,7 +128,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
* */
static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_gauge_style_t type, lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(gauge, style);
}
@@ -216,7 +216,7 @@ static inline uint16_t lv_gauge_get_scale_angle(const lv_obj_t * gauge)
*/
static inline const lv_style_t * lv_gauge_get_style(const lv_obj_t * gauge, lv_gauge_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(gauge);
}

View File

@@ -43,11 +43,11 @@ typedef struct
lv_btn_ext_t btn; /*Ext. of ancestor*/
/*New data for this type */
#if LV_IMGBTN_TILED == 0
const void * img_src[LV_BTN_STATE_NUM]; /*Store images to each state*/
const void * img_src[_LV_BTN_STATE_NUM]; /*Store images to each state*/
#else
const void * img_src_left[LV_BTN_STATE_NUM]; /*Store left side images to each state*/
const void * img_src_mid[LV_BTN_STATE_NUM]; /*Store center images to each state*/
const void * img_src_right[LV_BTN_STATE_NUM]; /*Store right side images to each state*/
const void * img_src_left[_LV_BTN_STATE_NUM]; /*Store left side images to each state*/
const void * img_src_mid[_LV_BTN_STATE_NUM]; /*Store center images to each state*/
const void * img_src_right[_LV_BTN_STATE_NUM]; /*Store right side images to each state*/
#endif
lv_img_cf_t act_cf; /*Color format of the currently active image*/
} lv_imgbtn_ext_t;

View File

@@ -23,7 +23,8 @@
#endif
#define LV_LABEL_DOT_END_INV 0xFFFF
#define LV_LABEL_HINT_HEIGHT_LIMIT 1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/
#define LV_LABEL_HINT_HEIGHT_LIMIT \
1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/
/**********************
* TYPEDEFS
@@ -358,8 +359,8 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
lv_label_refr_text(label);
}
#else
(void) label; /*Unused*/
(void) anim_speed; /*Unused*/
(void)label; /*Unused*/
(void)anim_speed; /*Unused*/
#endif
}
@@ -452,7 +453,7 @@ uint16_t lv_label_get_anim_speed(const lv_obj_t * label)
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->anim_speed;
#else
(void) label; /*Unused*/
(void)label; /*Unused*/
return 0;
#endif
}
@@ -854,7 +855,8 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_
}
lv_draw_label_hint_t * hint = &ext->hint;
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT) hint = NULL;
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_obj_get_height(label) < LV_LABEL_HINT_HEIGHT_LIMIT)
hint = NULL;
lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset,
lv_label_get_text_sel_start(label), lv_label_get_text_sel_end(label), hint);

View File

@@ -184,7 +184,7 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed);
*/
static inline void lv_label_set_style(lv_obj_t * label, lv_label_style_t type, const lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(label, style);
}
@@ -282,7 +282,7 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
*/
static inline const lv_style_t * lv_label_get_style(const lv_obj_t * label, lv_label_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(label);
}

View File

@@ -90,7 +90,7 @@ void lv_led_toggle(lv_obj_t * led);
*/
static inline void lv_led_set_style(lv_obj_t * led, lv_led_style_t type, const lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(led, style);
}
@@ -109,7 +109,7 @@ uint8_t lv_led_get_bright(const lv_obj_t * led);
*/
static inline const lv_style_t * lv_led_get_style(const lv_obj_t * led, lv_led_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(led);
}

View File

@@ -100,7 +100,7 @@ void lv_line_set_y_invert(lv_obj_t * line, bool en);
*/
static inline void lv_line_set_style(lv_obj_t * line, lv_line_style_t type, const lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(line, style);
}
@@ -130,7 +130,7 @@ bool lv_line_get_y_invert(const lv_obj_t * line);
*/
static inline const lv_style_t * lv_line_get_style(const lv_obj_t * line, lv_line_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(line);
}

View File

@@ -52,7 +52,7 @@ typedef struct
{
lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */
const lv_style_t * styles_btn[LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/
const lv_style_t * styles_btn[_LV_BTN_STATE_NUM]; /*Styles of the list element buttons*/
const lv_style_t * style_img; /*Style of the list element images on buttons*/
uint16_t size; /*the number of items(buttons) in the list*/

View File

@@ -96,7 +96,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
*/
static inline void lv_lmeter_set_style(lv_obj_t * lmeter, lv_lmeter_style_t type, lv_style_t * style)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
lv_obj_set_style(lmeter, style);
}
@@ -147,7 +147,7 @@ uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter);
*/
static inline const lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter, lv_lmeter_style_t type)
{
(void) type; /*Unused*/
(void)type; /*Unused*/
return lv_obj_get_style(lmeter);
}

View File

@@ -223,7 +223,6 @@ void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time)
(void)page; /*Unused*/
(void)anim_time; /*Unused*/
#endif
}
/**
@@ -308,7 +307,7 @@ uint16_t lv_page_get_anim_time(const lv_obj_t * page)
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->anim_time;
#else
(void) page; /*Unused*/
(void)page; /*Unused*/
return 0;
#endif
}
@@ -423,14 +422,10 @@ bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge)
lv_obj_get_coords(scrl, &scrl_coords);
lv_obj_get_coords(page, &page_coords);
if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top)
return true;
if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom)
return true;
if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left)
return true;
if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - page_style->body.padding.right)
return true;
if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + page_style->body.padding.top) return true;
if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - page_style->body.padding.bottom) return true;
if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + page_style->body.padding.left) return true;
if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - page_style->body.padding.right) return true;
return false;
}
@@ -446,7 +441,6 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue)
lv_obj_set_drag(obj, glue);
}
/**
* Focus on an object. It ensures that the object will be visible on the page.
* @param page pointer to a page object
@@ -625,7 +619,7 @@ void lv_page_start_edge_flash(lv_obj_t * page)
lv_anim_create(&a);
}
#else
(void) page; /*Unused*/
(void)page; /*Unused*/
#endif
}
@@ -940,7 +934,6 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
if(lv_obj_get_parent(page_parent) != NULL) { /*Do not propagate the scroll to a screen*/
page_ext->scroll_prop_ip = 1;
}
}
}

View File

@@ -50,12 +50,7 @@ enum {
typedef uint8_t lv_sb_mode_t;
/*Edges: describes the four edges of the page*/
enum {
LV_PAGE_EDGE_LEFT = 0x1,
LV_PAGE_EDGE_TOP = 0x2,
LV_PAGE_EDGE_RIGHT = 0x4,
LV_PAGE_EDGE_BOTTOM = 0x8
};
enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 };
typedef uint8_t lv_page_edge_t;
/*Data of page*/

View File

@@ -38,7 +38,6 @@ extern "C" {
* TYPEDEFS
**********************/
enum {
LV_ROLLER_MODE_NORMAL,
LV_ROLLER_MODE_INIFINITE,
@@ -46,8 +45,6 @@ enum {
typedef uint8_t lv_roller_mode_t;
/*Data of roller*/
typedef struct
{

View File

@@ -241,7 +241,7 @@ uint16_t lv_sw_get_anim_time(const lv_obj_t * sw)
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
return ext->anim_time;
#else
(void) sw; /*Unused*/
(void)sw; /*Unused*/
return 0;
#endif
}
@@ -335,8 +335,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(lv_sw_get_state(sw)) {
lv_sw_off(sw, LV_ANIM_ON);
state = 0;
}
else {
} else {
lv_sw_on(sw, LV_ANIM_ON);
state = 1;
}
@@ -351,7 +350,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(v > LV_SW_MAX_VALUE / 2) {
lv_sw_on(sw, LV_ANIM_ON);
state = 1;
} else{
} else {
lv_sw_off(sw, LV_ANIM_ON);
state = 0;
}

View File

@@ -1455,7 +1455,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
} else if(sign == LV_SIGNAL_CORD_CHG) {
/*Set the label width according to the text area width*/
if(ext->label) {
if(lv_obj_get_width(scrl) != lv_area_get_width(param) || lv_obj_get_height(scrl) != lv_area_get_height(param)) {
if(lv_obj_get_width(scrl) != lv_area_get_width(param) ||
lv_obj_get_height(scrl) != lv_area_get_height(param)) {
const lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_page_get_fit_width(ta));
@@ -1612,7 +1613,6 @@ static void refr_cursor_area(lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
const lv_style_t * label_style = lv_obj_get_style(ext->label);
lv_style_t cur_style;
@@ -1746,7 +1746,6 @@ static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_
return;
}
lv_area_t label_coords;
lv_obj_get_coords(ext->label, &label_coords);

View File

@@ -76,7 +76,7 @@ typedef struct
uint16_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/
lv_cursor_type_t type : 4; /* Shape of the cursor*/
uint8_t state : 1; /*Cursor is visible now or not (Handled by the library)*/
uint8_t click_pos :1; /*1: Enable positioning the cursor by clicking the text area*/
uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/
} cursor;
#if LV_LABEL_TEXT_SEL
uint16_t tmp_sel_start; /*Temporary value*/

View File

@@ -956,7 +956,6 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event)
if(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new);
if(res != LV_RES_OK) return;
}
/**

View File

@@ -83,7 +83,6 @@ void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element);
* Setter functions
*====================*/
/**
* Set the valid position's indices. The scrolling will be possible only to these positions.
* @param tileview pointer to a Tileview object

View File

@@ -94,7 +94,6 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
ext->title = lv_label_create(ext->header, NULL);
lv_label_set_text(ext->title, "My title");
/*Set the default styles*/
lv_theme_t * th = lv_theme_get_current();
if(th) {

View File

@@ -228,7 +228,6 @@ uint16_t lv_win_get_anim_time(const lv_obj_t * win);
*/
lv_coord_t lv_win_get_width(lv_obj_t * win);
/**
* Get a style of a window
* @param win pointer to a button object

View File

@@ -55,7 +55,6 @@ static void basic_init(void)
{
lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/
lv_style_copy(&scr, &def);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;

View File

@@ -76,7 +76,6 @@ static void basic_init(void)
def.image.intense = LV_OPA_TRANSP;
def.image.opa = LV_OPA_COVER;
lv_style_copy(&scr, &light_plain);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;

View File

@@ -108,7 +108,6 @@ static void basic_init(void)
bg.body.border.color = lv_color_hex3(0x666);
bg.body.shadow.color = LV_COLOR_SILVER;
lv_style_copy(&scr, &bg);
scr.body.padding.bottom = 0;
scr.body.padding.top = 0;