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

@@ -1,6 +1,6 @@
/**
* @file lv_led.c
*
*
*/
/*********************
@@ -18,8 +18,8 @@
*********************/
#define LV_LED_WIDTH_DEF (LV_DPI / 3)
#define LV_LED_HEIGHT_DEF (LV_DPI / 3)
#define LV_LED_BRIGHT_OFF 100
#define LV_LED_BRIGHT_ON 255
#define LV_LED_BRIGHT_OFF 100
#define LV_LED_BRIGHT_ON 255
/**********************
* TYPEDEFS
@@ -54,11 +54,11 @@ static lv_signal_func_t ancestor_signal;
lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
{
/*Create the ancestor basic object*/
lv_obj_t * new_led = lv_obj_create(par, copy);
lv_obj_t * new_led = lv_obj_create(par, copy);
lv_mem_assert(new_led);
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_led);
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_led);
/*Allocate the object type specific extended data*/
lv_led_ext_t * ext = lv_obj_allocate_ext_attr(new_led, sizeof(lv_led_ext_t));
lv_mem_assert(ext);
@@ -69,10 +69,10 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
/*Init the new led object*/
if(copy == NULL) {
lv_obj_set_size(new_led, LV_LED_WIDTH_DEF, LV_LED_HEIGHT_DEF);
lv_obj_set_size(new_led, LV_LED_WIDTH_DEF, LV_LED_HEIGHT_DEF);
/*Set the default styles*/
lv_theme_t *th = lv_theme_get_current();
lv_theme_t * th = lv_theme_get_current();
if(th) {
lv_led_set_style(new_led, th->led);
} else {
@@ -81,13 +81,13 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
}
/*Copy an existing object*/
else {
lv_led_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->bright = copy_ext->bright;
lv_led_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->bright = copy_ext->bright;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_led);
}
return new_led;
}
@@ -102,14 +102,14 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
*/
void lv_led_set_bright(lv_obj_t * led, uint8_t bright)
{
/*Set the brightness*/
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
if(ext->bright == bright) return;
/*Set the brightness*/
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
if(ext->bright == bright) return;
ext->bright = bright;
ext->bright = bright;
/*Invalidate the object there fore it will be redrawn*/
lv_obj_invalidate(led);
/*Invalidate the object there fore it will be redrawn*/
lv_obj_invalidate(led);
}
/**
@@ -118,7 +118,7 @@ void lv_led_set_bright(lv_obj_t * led, uint8_t bright)
*/
void lv_led_on(lv_obj_t * led)
{
lv_led_set_bright(led, LV_LED_BRIGHT_ON);
lv_led_set_bright(led, LV_LED_BRIGHT_ON);
}
/**
@@ -127,7 +127,7 @@ void lv_led_on(lv_obj_t * led)
*/
void lv_led_off(lv_obj_t * led)
{
lv_led_set_bright(led, LV_LED_BRIGHT_OFF);
lv_led_set_bright(led, LV_LED_BRIGHT_OFF);
}
@@ -137,9 +137,9 @@ void lv_led_off(lv_obj_t * led)
*/
void lv_led_toggle(lv_obj_t * led)
{
uint8_t bright = lv_led_get_bright(led);
if(bright > (LV_LED_BRIGHT_OFF + LV_LED_BRIGHT_ON) >> 1) lv_led_off(led);
else lv_led_on(led);
uint8_t bright = lv_led_get_bright(led);
if(bright > (LV_LED_BRIGHT_OFF + LV_LED_BRIGHT_ON) >> 1) lv_led_off(led);
else lv_led_on(led);
}
/*=====================
@@ -153,8 +153,8 @@ void lv_led_toggle(lv_obj_t * led)
*/
uint8_t lv_led_get_bright(lv_obj_t * led)
{
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
return ext->bright;
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
return ext->bright;
}
/**********************
@@ -174,33 +174,33 @@ uint8_t lv_led_get_bright(lv_obj_t * led)
static bool lv_led_design(lv_obj_t * led, 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 area*/
return ancestor_design_f(led, mask, mode);
/*Return false if the object is not covers the mask area*/
return ancestor_design_f(led, mask, mode);
} else if(mode == LV_DESIGN_DRAW_MAIN) {
/*Make darker colors in a temporary style according to the brightness*/
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
lv_style_t * style = lv_obj_get_style(led);
/*Make darker colors in a temporary style according to the brightness*/
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
lv_style_t * style = lv_obj_get_style(led);
/* Store the real pointer because of 'lv_group'
* If the object is in focus 'lv_obj_get_style()' will give a pointer to tmp style
* and to the real object style. It is important because of style change tricks below*/
lv_style_t *style_ori_p = led->style_p;
lv_style_t * style_ori_p = led->style_p;
/*Create a temporal style*/
/*Create a temporal style*/
lv_style_t leds_tmp;
memcpy(&leds_tmp, style, sizeof(leds_tmp));
memcpy(&leds_tmp, style, sizeof(leds_tmp));
/*Mix. the color with black proportionally with brightness*/
leds_tmp.body.main_color = lv_color_mix(leds_tmp.body.main_color, LV_COLOR_BLACK, ext->bright);
leds_tmp.body.grad_color = lv_color_mix(leds_tmp.body.grad_color, LV_COLOR_BLACK, ext->bright);
/*Mix. the color with black proportionally with brightness*/
leds_tmp.body.main_color = lv_color_mix(leds_tmp.body.main_color, LV_COLOR_BLACK, ext->bright);
leds_tmp.body.grad_color = lv_color_mix(leds_tmp.body.grad_color, LV_COLOR_BLACK, ext->bright);
leds_tmp.body.border.color = lv_color_mix(leds_tmp.body.border.color, LV_COLOR_BLACK, ext->bright);
/*Set the current swidth according to brightness proportionally between LV_LED_BRIGHT_OFF and LV_LED_BRIGHT_ON*/
uint16_t bright_tmp = ext->bright;
/*Set the current swidth according to brightness proportionally between LV_LED_BRIGHT_OFF and LV_LED_BRIGHT_ON*/
uint16_t bright_tmp = ext->bright;
leds_tmp.body.shadow.width = ((bright_tmp - LV_LED_BRIGHT_OFF) * style->body.shadow.width) / (LV_LED_BRIGHT_ON - LV_LED_BRIGHT_OFF);
led->style_p = &leds_tmp;
ancestor_design_f(led, mask, mode);
led->style_p = &leds_tmp;
ancestor_design_f(led, mask, mode);
led->style_p = style_ori_p; /*Restore the ORIGINAL style pointer*/
}
return true;