From: Cyprien Laplace Date: Sun, 7 Dec 2014 04:18:52 +0000 (-0500) Subject: status-led: put led status in an array X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=9f6eac2dfaca5f39c0e2ef7c20d214468ddc5f37;p=soft%2Flpc122x%2Fcore status-led: put led status in an array --- 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); }