summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-10-16 12:26:15 -0700
committerChromeOS bot <3su6n15k.default@developer.gserviceaccount.com>2015-10-29 06:19:59 +0000
commit056160c6fbbb18c63804c7e8120b8c783c28ac25 (patch)
tree5a0ee8115b942bf7972328f2a52be0ca4fa870ec
parent1a54995c6fe24bc14d3f5ff20222643e034d3004 (diff)
downloadchrome-ec-056160c6fbbb18c63804c7e8120b8c783c28ac25.tar.gz
lightbar: define primary colors
Use defines for color entries 4 - 7. BRANCH=smaug BUG=none TEST=compile Change-Id: I2fe9b286adbb4e2cc471320ccd3d0437b451a7cc Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/306787 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit fb6e6a4b410eff13961437d9a28fe86b222e3ef1) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309591
-rw-r--r--common/lightbar.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index 3a2acb0e78..a424fb1fa1 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -90,6 +90,11 @@ BUILD_ASSERT(sizeof(struct lightbar_params_v2_thresholds) <= MAX_PARAM_SIZE);
BUILD_ASSERT(sizeof(struct lightbar_params_v2_colors) <= MAX_PARAM_SIZE);
#undef MAX_PARAM_SIZE
+#define PRIMARY_BLUE 4
+#define PRIMARY_RED 5
+#define PRIMARY_YELLOW 6
+#define PRIMARY_GREEN 7
+
static const struct lightbar_params_v1 default_params = {
.google_ramp_up = 2500,
.google_ramp_down = 10000,
@@ -112,7 +117,7 @@ static const struct lightbar_params_v1 default_params = {
.tap_seg_min_on = 35, /* min intensity (%) for "on" */
.tap_seg_max_on = 100, /* max intensity (%) for "on" */
.tap_seg_osc = 50, /* amplitude for charging osc */
- .tap_idx = {5, 6, 7}, /* color [red, yellow, green] */
+ .tap_idx = {PRIMARY_RED, PRIMARY_YELLOW, PRIMARY_GREEN}, /* color */
.osc_min = { 0x60, 0x60 }, /* battery, AC */
.osc_max = { 0xd0, 0xd0 }, /* battery, AC */
@@ -124,14 +129,18 @@ static const struct lightbar_params_v1 default_params = {
.battery_threshold = { 14, 40, 99 }, /* percent, lowest to highest */
.s0_idx = {
- { 5, 4, 4, 4 }, /* battery: 0 = red, other = blue */
- { 4, 4, 4, 4 } /* AC: always blue */
+ /* battery: 0 = red, other = blue */
+ { PRIMARY_RED, PRIMARY_BLUE, PRIMARY_BLUE, PRIMARY_BLUE },
+ /* AC: always blue */
+ { PRIMARY_BLUE, PRIMARY_BLUE, PRIMARY_BLUE, PRIMARY_BLUE }
},
.s3_idx = {
- { 5, 0xff, 0xff, 0xff }, /* battery: 0 = red, else off */
- { 0xff, 0xff, 0xff, 0xff } /* AC: do nothing */
+ /* battery: 0 = red, else off */
+ { PRIMARY_RED, 0xff, 0xff, 0xff },
+ /* AC: do nothing */
+ { 0xff, 0xff, 0xff, 0xff }
},
- .s5_idx = 5, /* flash red */
+ .s5_idx = PRIMARY_RED, /* flash red */
.color = {
#if defined(BOARD_RYU)
{0x74, 0x58, 0xb4}, /* Segment0: Google blue */
@@ -566,9 +575,9 @@ static uint32_t sequence_S0(void)
lb_set_rgb(i, r, g, b);
}
} else {
- r = st.p.color[5].r;
- g = st.p.color[5].g;
- b = st.p.color[5].b;
+ r = st.p.color[PRIMARY_RED].r;
+ g = st.p.color[PRIMARY_RED].g;
+ b = st.p.color[PRIMARY_RED].b;
lb_set_rgb(4, r, g, b);
}