Formatting all source file (*.c) in accordance with project coding style, using the astyle tool and the rules file _astylerc-c.

This commit is contained in:
Alexander
2018-06-18 13:51:01 +03:00
parent 6038064e71
commit 8e9335d49f
74 changed files with 144657 additions and 144706 deletions

View File

@@ -16,11 +16,11 @@
/*********************
* DEFINES
*********************/
#define LV_CHART_YMIN_DEF 0
#define LV_CHART_YMAX_DEF 100
#define LV_CHART_HDIV_DEF 3
#define LV_CHART_VDIV_DEF 5
#define LV_CHART_PNUM_DEF 10
#define LV_CHART_YMIN_DEF 0
#define LV_CHART_YMAX_DEF 100
#define LV_CHART_HDIV_DEF 3
#define LV_CHART_VDIV_DEF 5
#define LV_CHART_PNUM_DEF 10
/**********************
* TYPEDEFS
@@ -85,10 +85,10 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new chart background object*/
if(copy == NULL) {
lv_obj_set_size(new_chart, LV_HOR_RES / 3, LV_VER_RES / 3);
lv_obj_set_size(new_chart, LV_HOR_RES / 3, LV_VER_RES / 3);
/*Set the default styles*/
lv_theme_t *th = lv_theme_get_current();
lv_theme_t * th = lv_theme_get_current();
if(th) {
lv_chart_set_style(new_chart, th->chart);
} else {
@@ -96,12 +96,12 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
}
} else {
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
ext->type = ext_copy->type;
ext->ymin = ext_copy->ymin;
ext->ymax = ext_copy->ymax;
ext->hdiv_cnt = ext_copy->hdiv_cnt;
ext->vdiv_cnt = ext_copy->vdiv_cnt;
ext->ymin = ext_copy->ymin;
ext->ymax = ext_copy->ymax;
ext->hdiv_cnt = ext_copy->hdiv_cnt;
ext->vdiv_cnt = ext_copy->vdiv_cnt;
ext->point_cnt = ext_copy->point_cnt;
ext->series.opa = ext_copy->series.opa;
@@ -124,26 +124,26 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_series_t *ser = lv_ll_ins_head(&ext->series_ll);
lv_coord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_series_t * ser = lv_ll_ins_head(&ext->series_ll);
lv_coord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
if(ser == NULL) return NULL;
if(ser == NULL) return NULL;
ser->color = color;
ser->points = lv_mem_alloc(sizeof(lv_coord_t) * ext->point_cnt);
ser->points = lv_mem_alloc(sizeof(lv_coord_t) * ext->point_cnt);
uint16_t i;
lv_coord_t * p_tmp = ser->points;
for(i = 0; i < ext->point_cnt; i++) {
*p_tmp = def;
p_tmp++;
}
uint16_t i;
lv_coord_t * p_tmp = ser->points;
for(i = 0; i < ext->point_cnt; i++) {
*p_tmp = def;
p_tmp++;
}
ext->series.num++;
ext->series.num++;
return ser;
return ser;
}
/*=====================
@@ -158,13 +158,13 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
*/
void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->hdiv_cnt == hdiv && ext->vdiv_cnt == vdiv) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->hdiv_cnt == hdiv && ext->vdiv_cnt == vdiv) return;
ext->hdiv_cnt = hdiv;
ext->vdiv_cnt = vdiv;
ext->hdiv_cnt = hdiv;
ext->vdiv_cnt = vdiv;
lv_obj_invalidate(chart);
lv_obj_invalidate(chart);
}
/**
@@ -175,13 +175,13 @@ void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
*/
void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->ymin == ymin && ext->ymax == ymax) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->ymin == ymin && ext->ymax == ymax) return;
ext->ymin = ymin;
ext->ymax = ymax;
ext->ymin = ymin;
ext->ymax = ymax;
lv_chart_refresh(chart);
lv_chart_refresh(chart);
}
/**
@@ -191,12 +191,12 @@ void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
*/
void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->type == type) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->type == type) return;
ext->type = type;
ext->type = type;
lv_chart_refresh(chart);
lv_chart_refresh(chart);
}
/**
@@ -206,29 +206,29 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
*/
void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->point_cnt == point_cnt) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->point_cnt == point_cnt) return;
lv_chart_series_t *ser;
uint16_t point_cnt_old = ext->point_cnt;
uint16_t i;
lv_chart_series_t * ser;
uint16_t point_cnt_old = ext->point_cnt;
uint16_t i;
lv_coord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
if(point_cnt < 1) point_cnt = 1;
if(point_cnt < 1) point_cnt = 1;
LL_READ_BACK(ext->series_ll, ser) {
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
LL_READ_BACK(ext->series_ll, ser) {
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
/*Initialize the new points*/
if(point_cnt > point_cnt_old) {
for(i = point_cnt_old - 1; i < point_cnt; i++) {
ser->points[i] = def;
}
}
}
/*Initialize the new points*/
if(point_cnt > point_cnt_old) {
for(i = point_cnt_old - 1; i < point_cnt; i++) {
ser->points[i] = def;
}
}
}
ext->point_cnt = point_cnt;
lv_chart_refresh(chart);
ext->point_cnt = point_cnt;
lv_chart_refresh(chart);
}
/**
@@ -309,15 +309,15 @@ void lv_chart_set_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t *
*/
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
for(i = 0; i < ext->point_cnt - 1; i++) {
ser->points[i] = ser->points[i + 1];
}
uint16_t i;
for(i = 0; i < ext->point_cnt - 1; i++) {
ser->points[i] = ser->points[i + 1];
}
ser->points[ext->point_cnt - 1] = y;
lv_chart_refresh(chart);
ser->points[ext->point_cnt - 1] = y;
lv_chart_refresh(chart);
}
@@ -410,19 +410,19 @@ void lv_chart_refresh(lv_obj_t * chart)
static bool lv_chart_design(lv_obj_t * chart, const lv_area_t * mask, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
return ancestor_design_f(chart, mask, mode);
/*Return false if the object is not covers the mask_p area*/
return ancestor_design_f(chart, mask, mode);
} else if(mode == LV_DESIGN_DRAW_MAIN) {
/*Draw the background*/
/*Draw the background*/
lv_draw_rect(&chart->coords, mask, lv_obj_get_style(chart));
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_draw_div(chart, mask);
lv_chart_draw_div(chart, mask);
if(ext->type & LV_CHART_TYPE_LINE) lv_chart_draw_lines(chart, mask);
if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, mask);
if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, mask);
if(ext->type & LV_CHART_TYPE_LINE) lv_chart_draw_lines(chart, mask);
if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, mask);
if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, mask);
}
return true;
}
@@ -448,8 +448,7 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
lv_mem_free(*datal);
}
lv_ll_clear(&ext->series_ll);
}
else if(sign == LV_SIGNAL_GET_TYPE) {
} else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param;
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
@@ -468,20 +467,20 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
*/
static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_style_t * style = lv_obj_get_style(chart);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_style_t * style = lv_obj_get_style(chart);
uint8_t div_i;
uint8_t div_i;
uint8_t div_i_end;
uint8_t div_i_start;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
if(ext->hdiv_cnt != 0) {
if(ext->hdiv_cnt != 0) {
/*Draw slide lines if no border*/
if(style->body.border.width != 0) {
div_i_start = 1;
@@ -502,9 +501,9 @@ static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask)
p2.y = p1.y;
lv_draw_line(&p1, &p2, mask, style);
}
}
}
if(ext->vdiv_cnt != 0) {
if(ext->vdiv_cnt != 0) {
/*Draw slide lines if no border*/
if(style->body.border.width != 0) {
div_i_start = 1;
@@ -524,7 +523,7 @@ static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask)
p2.x = p1.x;
lv_draw_line(&p1, &p2, mask, style);
}
}
}
}
/**
@@ -533,45 +532,45 @@ static void lv_chart_draw_div(lv_obj_t * chart, const lv_area_t * mask)
*/
static void lv_chart_draw_lines(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
uint16_t i;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
int32_t y_tmp;
lv_chart_series_t *ser;
lv_style_t lines;
lv_style_copy(&lines, &lv_style_plain);
lines.line.opa = ext->series.opa;
int32_t y_tmp;
lv_chart_series_t * ser;
lv_style_t lines;
lv_style_copy(&lines, &lv_style_plain);
lines.line.opa = ext->series.opa;
lines.line.width = ext->series.width;
/*Go through all data lines*/
LL_READ_BACK(ext->series_ll, ser) {
lines.line.color = ser->color;
/*Go through all data lines*/
LL_READ_BACK(ext->series_ll, ser) {
lines.line.color = ser->color;
p1.x = 0 + x_ofs;
p2.x = 0 + x_ofs;
y_tmp = (int32_t)((int32_t) ser->points[0] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
p2.y = h - y_tmp + y_ofs;
p1.x = 0 + x_ofs;
p2.x = 0 + x_ofs;
y_tmp = (int32_t)((int32_t) ser->points[0] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
p2.y = h - y_tmp + y_ofs;
for(i = 1; i < ext->point_cnt; i ++) {
p1.x = p2.x;
p1.y = p2.y;
for(i = 1; i < ext->point_cnt; i ++) {
p1.x = p2.x;
p1.y = p2.y;
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
p2.y = h - y_tmp + y_ofs;
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
p2.y = h - y_tmp + y_ofs;
lv_draw_line(&p1, &p2, mask, &lines);
}
}
lv_draw_line(&p1, &p2, mask, &lines);
}
}
}
/**
@@ -581,46 +580,46 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const lv_area_t * mask)
*/
static void lv_chart_draw_points(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
lv_area_t cir_a;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
uint16_t i;
lv_area_t cir_a;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
lv_coord_t x_ofs = chart->coords.x1;
lv_coord_t y_ofs = chart->coords.y1;
int32_t y_tmp;
int32_t y_tmp;
lv_chart_series_t * ser;
uint8_t series_cnt = 0;
lv_style_t style_point;
lv_style_copy(&style_point, &lv_style_plain);
style_point.body.border.width = 0;
style_point.body.empty = 0;
style_point.body.radius = LV_RADIUS_CIRCLE;
style_point.body.border.width = 0;
style_point.body.empty = 0;
style_point.body.radius = LV_RADIUS_CIRCLE;
style_point.body.opa = ext->series.opa;
style_point.body.radius = ext->series.width;
/*Go through all data lines*/
LL_READ_BACK(ext->series_ll, ser) {
style_point.body.main_color = ser->color;
style_point.body.grad_color = lv_color_mix(LV_COLOR_BLACK, ser->color, ext->series.dark);
/*Go through all data lines*/
LL_READ_BACK(ext->series_ll, ser) {
style_point.body.main_color = ser->color;
style_point.body.grad_color = lv_color_mix(LV_COLOR_BLACK, ser->color, ext->series.dark);
for(i = 0; i < ext->point_cnt; i ++) {
cir_a.x1 = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
cir_a.x2 = cir_a.x1 + style_point.body.radius;
cir_a.x1 -= style_point.body.radius;
for(i = 0; i < ext->point_cnt; i ++) {
cir_a.x1 = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
cir_a.x2 = cir_a.x1 + style_point.body.radius;
cir_a.x1 -= style_point.body.radius;
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
cir_a.y1 = h - y_tmp + y_ofs;
cir_a.y2 = cir_a.y1 + style_point.body.radius;
cir_a.y1 -= style_point.body.radius;
y_tmp = (int32_t)((int32_t) ser->points[i] - ext->ymin) * h;
y_tmp = y_tmp / (ext->ymax - ext->ymin);
cir_a.y1 = h - y_tmp + y_ofs;
cir_a.y2 = cir_a.y1 + style_point.body.radius;
cir_a.y1 -= style_point.body.radius;
lv_draw_rect(&cir_a, mask, &style_point);
}
series_cnt++;
}
lv_draw_rect(&cir_a, mask, &style_point);
}
series_cnt++;
}
}
/**
@@ -630,31 +629,31 @@ static void lv_chart_draw_points(lv_obj_t * chart, const lv_area_t * mask)
*/
static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
lv_area_t col_a;
lv_area_t col_mask;
bool mask_ret;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
int32_t y_tmp;
lv_chart_series_t *ser;
uint16_t i;
lv_area_t col_a;
lv_area_t col_mask;
bool mask_ret;
lv_coord_t w = lv_obj_get_width(chart);
lv_coord_t h = lv_obj_get_height(chart);
int32_t y_tmp;
lv_chart_series_t * ser;
lv_style_t rects;
lv_coord_t col_w = w / ((ext->series.num + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_coord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_coord_t col_w = w / ((ext->series.num + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_coord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_style_copy(&rects, &lv_style_plain);
rects.body.border.width = 0;
rects.body.empty = 0;
rects.body.radius = 0;
rects.body.opa = ext->series.opa;
lv_style_copy(&rects, &lv_style_plain);
rects.body.border.width = 0;
rects.body.empty = 0;
rects.body.radius = 0;
rects.body.opa = ext->series.opa;
col_a.y2 = chart->coords.y2;
col_a.y2 = chart->coords.y2;
lv_coord_t x_act;
lv_coord_t x_act;
/*Go through all points*/
/*Go through all points*/
for(i = 0; i < ext->point_cnt; i ++) {
x_act = (int32_t)((int32_t) w * i) / ext->point_cnt;
x_act += chart->coords.x1 + x_ofs;
@@ -676,6 +675,6 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask)
lv_draw_rect(&chart->coords, &col_mask, &rects);
}
}
}
}
}
#endif