From c76fbf7162e598895b1308f1855b0f70629968fc Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sat, 19 Feb 2005 00:34:15 +0000 Subject: Ondio: disk indication in the status bar, to compensate for lacking LED git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6012 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/led.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'firmware/drivers/led.c') diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 90a1b2cb39..4b63d07582 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -21,11 +21,13 @@ #include "cpu.h" #include "led.h" #include "system.h" +#include "kernel.h" + +static bool current; #ifdef HAVE_LED static bool xor; -static bool current; void led(bool on) { @@ -59,16 +61,27 @@ void invert_led(bool on) led(current); } -#else /* no LED, just dummies */ +#else /* no LED, just status update */ + +static long delay; void led(bool on) { - (void)on; + if (current && !on) /* switching off */ + { + delay = current_tick + HZ/2; /* delay the "off" status a bit */ + } + current = on; } void invert_led(bool on) { - (void)on; + (void)on; /* no invert feature */ +} + +bool led_read(void) /* read by status bar update */ +{ + return (current || TIME_BEFORE(current_tick, delay)); } #endif // #ifdef HAVE_LED -- cgit v1.2.3