From 9f6eac2dfaca5f39c0e2ef7c20d214468ddc5f37 Mon Sep 17 00:00:00 2001 From: Cyprien Laplace Date: Sat, 6 Dec 2014 23:18:52 -0500 Subject: [PATCH] status-led: put led status in an array --- extdrv/status_led.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/extdrv/status_led.c b/extdrv/status_led.c index 8ae531a..9b624f9 100644 --- a/extdrv/status_led.c +++ b/extdrv/status_led.c @@ -109,28 +109,23 @@ void status_led(uint32_t val) } } +static enum led_status steps[] = { + red_only, + green_only, + none, + both, + none, + red_only, + red_only, + none, + green_only, + green_only, + none +}; + void chenillard(uint32_t ms) { - status_led(red_only); - msleep(ms); - status_led(green_only); - msleep(ms); - status_led(none); - msleep(ms); - status_led(both); - msleep(ms); - status_led(none); - msleep(ms); - status_led(red_only); - msleep(ms); - status_led(red_only); - msleep(ms); - status_led(none); - msleep(ms); - status_led(green_only); - msleep(ms); - status_led(green_only); - msleep(ms); - status_led(none); - msleep(ms); + static int n; + status_led(steps[n++ % (sizeof steps / sizeof *steps)]); + msleep(ms); } -- 2.43.0