diff options
author | Michał Barnaś <mb@semihalf.com> | 2022-03-04 17:16:03 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-04 22:45:19 +0000 |
commit | 83995780242fcab243370e4ffa83e70b001848b6 (patch) | |
tree | 0453e41dec4217bb39551fe57ab23bbf10d76a27 /zephyr/projects/trogdor | |
parent | a35376b137efce656ade1d100c562663b9761ab2 (diff) | |
download | chrome-ec-83995780242fcab243370e4ffa83e70b001848b6.tar.gz |
zephyr: fix leds behavior on lazor
This commit fixes the handling of leds definitions in device tree
and changes the led tick to be 1s instead of default 200ms.
Only the first node of led was set properly, other ones were
causing the read outside of an array.
BUG=b:222684744
BRANCH=main
TEST=flash and check if leds are blinking as they should
Change-Id: Id890261e38b7a61dff4827e0a6f192ad10b6ab32
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500522
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Diffstat (limited to 'zephyr/projects/trogdor')
-rw-r--r-- | zephyr/projects/trogdor/lazor/src/led.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/zephyr/projects/trogdor/lazor/src/led.c b/zephyr/projects/trogdor/lazor/src/led.c index 2d49d3ce59..682490d0e2 100644 --- a/zephyr/projects/trogdor/lazor/src/led.c +++ b/zephyr/projects/trogdor/lazor/src/led.c @@ -265,7 +265,7 @@ static int find_color(int node_idx, int ticks) ticks = ticks % GET_PERIOD(node_idx, MAX_COLOR - 1); for (color_idx = 0; color_idx < MAX_COLOR; color_idx++) { - if (GET_PERIOD(node_idx, color_idx) < ticks) + if (GET_PERIOD(node_idx, color_idx) > ticks) break; } } @@ -297,7 +297,7 @@ static void led_tick(void) if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) board_led_set_color(); } -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_SECOND, led_tick, HOOK_PRIO_DEFAULT); void led_control(enum ec_led_id led_id, enum ec_led_state state) { |