summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-02-19 14:44:31 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-02-19 14:44:31 +0000
commit2e429ff76221e2d39a35d8875c6a3add76191519 (patch)
treebd4c36cd027d12501f0bd8970a580d6eac914f62
parent9828f08d9b01af15a2d4d9e73e82e04fd0d1225b (diff)
downloadrockbox-2e429ff76221e2d39a35d8875c6a3add76191519.zip
rockbox-2e429ff76221e2d39a35d8875c6a3add76191519.tar.gz
rockbox-2e429ff76221e2d39a35d8875c6a3add76191519.tar.bz2
rockbox-2e429ff76221e2d39a35d8875c6a3add76191519.tar.xz
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
-rw-r--r--apps/status.c6
-rw-r--r--firmware/drivers/led.c15
-rw-r--r--firmware/export/led.h2
3 files changed, 12 insertions, 11 deletions
diff --git a/apps/status.c b/apps/status.c
index 2af3ea9..562cd50 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -160,7 +160,7 @@ void status_draw(bool force_redraw)
info.repeat = global_settings.repeat_mode;
info.playmode = current_playmode();
#ifndef HAVE_LED
- info.led = led_read();
+ info.led = led_read(HZ/2); /* delay should match polling interval */
#endif
/* only redraw if forced to, or info has changed */
@@ -241,8 +241,8 @@ void status_draw(bool force_redraw)
statusbar_time(info.hour, info.minute);
#endif
#ifndef HAVE_LED
- if (info.led)
- statusbar_led();
+ if (info.led)
+ statusbar_led();
#endif
lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT);
lastinfo = info;
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index 4b63d07..4598175 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
diff --git a/firmware/export/led.h b/firmware/export/led.h
index d7322e4..052da26 100644
--- a/firmware/export/led.h
+++ b/firmware/export/led.h
@@ -25,7 +25,7 @@
extern void led( bool on );
extern void invert_led( bool on );
#ifndef HAVE_LED
-extern bool led_read(void); /* read for status bar */
+extern bool led_read(int delayticks); /* read for status bar */
#endif
#endif