diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2022-06-27 14:09:57 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-30 23:07:25 +0000 |
commit | e5e5cb167a1783748bb28c9d385fe2c1cedb867e (patch) | |
tree | c9a56271516477ca0485847ca8a234fffc6aac88 /board/vell | |
parent | a790706d9867578d5f6f75b72b01eef1920f58d9 (diff) | |
download | chrome-ec-e5e5cb167a1783748bb28c9d385fe2c1cedb867e.tar.gz |
board/vell/led.c: Format with clang-format
BUG=b:236386294
BRANCH=none
TEST=none
Change-Id: I942c758dd9368fc2c356366db8ca51bd9fa0dfaa
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729054
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'board/vell')
-rw-r--r-- | board/vell/led.c | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/board/vell/led.c b/board/vell/led.c index 4387d1a6d7..611a2ef820 100644 --- a/board/vell/led.c +++ b/board/vell/led.c @@ -22,15 +22,13 @@ #define BATT_LOW_BCT 10 #define LED_TICK_INTERVAL_MS (500 * MSEC) -#define LED_CYCLE_TIME_MS (2000 * MSEC) -#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS) -#define LED_ON_TIME_MS (1000 * MSEC) -#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS) - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_LEFT_LED, - EC_LED_ID_RIGHT_LED -}; +#define LED_CYCLE_TIME_MS (2000 * MSEC) +#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS) +#define LED_ON_TIME_MS (1000 * MSEC) +#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS) + +const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED, + EC_LED_ID_RIGHT_LED }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); @@ -38,13 +36,10 @@ enum led_color { LED_OFF = 0, LED_AMBER, LED_WHITE, - LED_COLOR_COUNT /* Number of colors, not a color itself */ + LED_COLOR_COUNT /* Number of colors, not a color itself */ }; -enum led_port { - RIGHT_PORT = 0, - LEFT_PORT -}; +enum led_port { RIGHT_PORT = 0, LEFT_PORT }; uint8_t bat_led_on; uint8_t bat_led_off; @@ -66,9 +61,9 @@ static void led_set_color_battery(int port, enum led_color color) enum gpio_signal amber_led, white_led; amber_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_AMBER_L : - GPIO_LEFT_LED_AMBER_L); + GPIO_LEFT_LED_AMBER_L); white_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_WHITE_L : - GPIO_LEFT_LED_WHITE_L); + GPIO_LEFT_LED_WHITE_L); switch (color) { case LED_WHITE: @@ -148,10 +143,10 @@ static void set_active_port_color(enum led_color color) if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) led_set_color_battery(RIGHT_PORT, - (port == RIGHT_PORT) ? color : LED_OFF); + (port == RIGHT_PORT) ? color : LED_OFF); if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) led_set_color_battery(LEFT_PORT, - (port == LEFT_PORT) ? color : LED_OFF); + (port == LEFT_PORT) ? color : LED_OFF); } static void led_set_battery(void) @@ -173,31 +168,39 @@ static void led_set_battery(void) */ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { if (charge_get_percent() < BATT_LOW_BCT) - led_set_color_battery(RIGHT_PORT, - (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + led_set_color_battery( + RIGHT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else led_set_color_battery(RIGHT_PORT, LED_OFF); } if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { if (charge_get_percent() < BATT_LOW_BCT) - led_set_color_battery(LEFT_PORT, - (battery_ticks % LED_TICKS_PER_CYCLE - < LED_ON_TICKS) ? LED_AMBER : LED_OFF); + led_set_color_battery( + LEFT_PORT, + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else led_set_color_battery(LEFT_PORT, LED_OFF); } break; case PWR_STATE_ERROR: if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { - led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1) - ? LED_AMBER : LED_OFF); + led_set_color_battery( + RIGHT_PORT, + (battery_ticks & 0x1) ? LED_AMBER : LED_OFF); } if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) { - led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) - ? LED_AMBER : LED_OFF); + led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) ? + LED_AMBER : + LED_OFF); } break; case PWR_STATE_CHARGE_NEAR_FULL: @@ -205,9 +208,11 @@ static void led_set_battery(void) break; case PWR_STATE_IDLE: /* External power connected in IDLE */ if (chflags & CHARGE_FLAG_FORCE_IDLE) - set_active_port_color((battery_ticks % - LED_TICKS_PER_CYCLE < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); + set_active_port_color( + (battery_ticks % LED_TICKS_PER_CYCLE < + LED_ON_TICKS) ? + LED_AMBER : + LED_OFF); else set_active_port_color(LED_WHITE); break; |