summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-09-26 15:27:03 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-09-27 09:27:55 +0000
commit41b927442e770d6f2303d32f88a96b859775b27f (patch)
treea26b8e396d9ba4954ad980b3267092f7fe09801e
parentc83db9a1199cff57d0286e4e6416a99de335b9ee (diff)
downloadchrome-ec-41b927442e770d6f2303d32f88a96b859775b27f.tar.gz
Fix floating point usage in lightbar module
This patch fixes stary floating point usage in lightbar module. They should be scaled by FP_SCALE and of type 'int'. BUG=None TEST=Compile and make sure the compiler is not using floating point related instructions. BRANCH=None Change-Id: I8d598af1014160b83bc44ef3e88e2cc4bf304e5e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220121 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
-rw-r--r--common/lightbar.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index e7733bdf4b..8065996fce 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -1162,7 +1162,7 @@ static inline int get_interp_value(int led, int color, int interp)
static uint32_t lightbyte_RAMP_ONCE(void)
{
int w, i, r, g, b;
- float f;
+ int f;
/* special case for instantaneous set */
if (lb_ramp_delay == 0) {
@@ -1176,7 +1176,7 @@ static uint32_t lightbyte_RAMP_ONCE(void)
}
for (w = 0; w < 128; w++) {
- f = cycle_010(w);
+ f = cycle_010(w) * FP_SCALE;
for (i = 0; i < NUM_LEDS; i++) {
r = get_interp_value(i, LB_COL_RED, f);
g = get_interp_value(i, LB_COL_GREEN, f);
@@ -1198,7 +1198,7 @@ static uint32_t lightbyte_RAMP_ONCE(void)
static uint32_t lightbyte_CYCLE_ONCE(void)
{
int w, i, r, g, b;
- float f;
+ int f;
/* special case for instantaneous set */
if (lb_ramp_delay == 0) {
@@ -1212,7 +1212,7 @@ static uint32_t lightbyte_CYCLE_ONCE(void)
}
for (w = 0; w < 256; w++) {
- f = cycle_010(w);
+ f = cycle_010(w) * FP_SCALE;
for (i = 0; i < NUM_LEDS; i++) {
r = get_interp_value(i, LB_COL_RED, f);
g = get_interp_value(i, LB_COL_GREEN, f);