From 2e429ff76221e2d39a35d8875c6a3add76191519 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sat, 19 Feb 2005 14:44:31 +0000 Subject: a bit nicer: delay of the disk activity indicator is supplied by app layer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6019 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/led.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'firmware/drivers/led.c') diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 4b63d07582..4598175b79 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -63,14 +63,14 @@ void invert_led(bool on) #else /* no LED, just status update */ -static long delay; +static long last_on; /* timestamp of switching off */ void led(bool on) { - if (current && !on) /* switching off */ - { - delay = current_tick + HZ/2; /* delay the "off" status a bit */ - } + if (current && !on) /* switching off */ + { + last_on = current_tick; /* remember for off delay */ + } current = on; } @@ -79,9 +79,10 @@ void invert_led(bool on) (void)on; /* no invert feature */ } -bool led_read(void) /* read by status bar update */ +bool led_read(int delayticks) /* read by status bar update */ { - return (current || TIME_BEFORE(current_tick, delay)); + /* reading "off" is delayed by user-supplied monoflop value */ + return (current || TIME_BEFORE(current_tick, last_on+delayticks)); } #endif // #ifdef HAVE_LED -- cgit v1.2.3