diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-09-25 15:13:17 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-26 09:21:06 +0000 |
commit | b88866828ffafb8fffb732d11f50f8b473bd4323 (patch) | |
tree | b4be4e71fd1a2d49406d28c6d44662ad57d273ed | |
parent | 748848e8a264530a0ed31fc62d11b19a42d11eec (diff) | |
download | chrome-ec-b88866828ffafb8fffb732d11f50f8b473bd4323.tar.gz |
Add demo_tap() function for lightbar demo mode
BUG=chrome-os-partner:29041
BRANCH=ToT
TEST=manual
From the host run
ectool lightbar demo on
Then press the 'T' key. The lightbar should change to indicate
the charge state. Fiddle with the arrows to change the pretend
battery level and AC presence.
Change-Id: I398a829e2e5de5e1a186500aa2ed72c61e71deaa
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220024
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | common/keyboard_8042.c | 3 | ||||
-rw-r--r-- | common/lightbar.c | 12 | ||||
-rw-r--r-- | include/lightbar.h | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c index 217bf52339..cf2b5bec94 100644 --- a/common/keyboard_8042.c +++ b/common/keyboard_8042.c @@ -876,6 +876,9 @@ static void keyboard_special(uint16_t k) case 0x0041: /* bright */ demo_brightness(1); break; + case 0x0014: /* T */ + demo_tap(); + break; } #endif diff --git a/common/lightbar.c b/common/lightbar.c index 6684949c8a..e7733bdf4b 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -76,13 +76,13 @@ static const struct lightbar_params_v1 default_params = { .s3_ramp_up = 2500, .s3_ramp_down = 10000, .tap_tick_delay = 5000, /* oscillation step time */ - .tap_display_time = 3000000, /* total sequence time */ + .tap_display_time = 5 * SECOND, /* total sequence time */ .tap_pct_red = 10, /* below this is red */ .tap_pct_green = 97, /* above this is green */ .tap_seg_min_on = 35, /* min intensity (%) for "on" */ .tap_seg_max_on = 100, /* max intensity (%) for "on" */ - .tap_seg_osc = 25, /* amplitude for charging osc */ + .tap_seg_osc = 50, /* amplitude for charging osc */ .tap_idx = {5, 6, 7}, /* color [red, yellow, green] */ .osc_min = { 0x60, 0x60 }, /* battery, AC */ @@ -269,6 +269,14 @@ void demo_brightness(int inc) lb_set_brightness(b); } +/* T key */ +void demo_tap(void) +{ + if (!demo_mode) + return; + lightbar_sequence(LIGHTBAR_TAP); +} + /******************************************************************************/ /* Helper functions and data. */ /******************************************************************************/ diff --git a/include/lightbar.h b/include/lightbar.h index 0d143a2e8a..c15604bd87 100644 --- a/include/lightbar.h +++ b/include/lightbar.h @@ -30,5 +30,5 @@ void lightbar_sequence(enum lightbar_sequence s); extern void demo_battery_level(int inc); extern void demo_is_charging(int ischarge); extern void demo_brightness(int inc); - +extern void demo_tap(void); #endif /* __CROS_EC_LIGHTBAR_H */ |