diff options
author | Tommy Chung <tommy.chung@quanta.corp-partner.google.com> | 2021-12-07 19:49:53 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-09 02:06:35 +0000 |
commit | ea939b0a84abada69d10b13a3370b09a6634a1f4 (patch) | |
tree | 3d397d91957c4aa27b2cb63040bebfe69fae007e | |
parent | 2bbe1f7c6f70388efe87776b7a5818650f69b4ad (diff) | |
download | chrome-ec-ea939b0a84abada69d10b13a3370b09a6634a1f4.tar.gz |
kingoftown: Update LED config
Update LED config to meet the new defined LED spec as shown in the
following BUG tracker.
BUG=b:202464175
BRANCH=trogdor
TEST=make sure that all LED behaviors correct.
Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Change-Id: Ic91e8fb1ddd99628d4c2265f0bd6d49dc2b7c04b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3319995
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r-- | board/kingoftown/led.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/board/kingoftown/led.c b/board/kingoftown/led.c index 09c1f89598..a543bb5403 100644 --- a/board/kingoftown/led.c +++ b/board/kingoftown/led.c @@ -127,25 +127,31 @@ static void board_led_set_battery(void) set_active_port_color(LED_AMBER); break; case PWR_STATE_DISCHARGE: - if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) { - if (charge_get_percent() <= 10) { - led_blink_cycle = - battery_ticks % (2 * TIMES_TICK_ONE_SEC); + if (charge_get_percent() <= 10) { + led_blink_cycle = battery_ticks % (2 * TIMES_TICK_ONE_SEC); + if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) side_led_set_color(1, (led_blink_cycle < TIMES_TICK_ONE_SEC) ? - LED_WHITE : LED_OFF); - } - else + LED_AMBER : LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) + side_led_set_color(0, + (led_blink_cycle < TIMES_TICK_ONE_SEC) ? + LED_AMBER : LED_OFF); + } else { + if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) side_led_set_color(1, LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) + side_led_set_color(0, LED_OFF); } - - if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) - side_led_set_color(0, LED_OFF); break; case PWR_STATE_ERROR: led_blink_cycle = battery_ticks % TIMES_TICK_ONE_SEC; - set_active_port_color((led_blink_cycle < TIMES_TICK_HALF_SEC) ? - LED_WHITE : LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) + side_led_set_color(1, (led_blink_cycle < TIMES_TICK_HALF_SEC) ? + LED_AMBER : LED_OFF); + if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) + side_led_set_color(0, (led_blink_cycle < TIMES_TICK_HALF_SEC) ? + LED_AMBER : LED_OFF); break; case PWR_STATE_CHARGE_NEAR_FULL: set_active_port_color(LED_WHITE); |