diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2005-02-19 14:44:31 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2005-02-19 14:44:31 +0000 |
commit | 2e429ff76221e2d39a35d8875c6a3add76191519 (patch) | |
tree | bd4c36cd027d12501f0bd8970a580d6eac914f62 /firmware/drivers/led.c | |
parent | 9828f08d9b01af15a2d4d9e73e82e04fd0d1225b (diff) | |
download | rockbox-2e429ff76221e2d39a35d8875c6a3add76191519.tar.gz rockbox-2e429ff76221e2d39a35d8875c6a3add76191519.zip |
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
Diffstat (limited to 'firmware/drivers/led.c')
-rw-r--r-- | firmware/drivers/led.c | 15 |
1 files changed, 8 insertions, 7 deletions
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) | |||
63 | 63 | ||
64 | #else /* no LED, just status update */ | 64 | #else /* no LED, just status update */ |
65 | 65 | ||
66 | static long delay; | 66 | static long last_on; /* timestamp of switching off */ |
67 | 67 | ||
68 | void led(bool on) | 68 | void led(bool on) |
69 | { | 69 | { |
70 | if (current && !on) /* switching off */ | 70 | if (current && !on) /* switching off */ |
71 | { | 71 | { |
72 | delay = current_tick + HZ/2; /* delay the "off" status a bit */ | 72 | last_on = current_tick; /* remember for off delay */ |
73 | } | 73 | } |
74 | current = on; | 74 | current = on; |
75 | } | 75 | } |
76 | 76 | ||
@@ -79,9 +79,10 @@ void invert_led(bool on) | |||
79 | (void)on; /* no invert feature */ | 79 | (void)on; /* no invert feature */ |
80 | } | 80 | } |
81 | 81 | ||
82 | bool led_read(void) /* read by status bar update */ | 82 | bool led_read(int delayticks) /* read by status bar update */ |
83 | { | 83 | { |
84 | return (current || TIME_BEFORE(current_tick, delay)); | 84 | /* reading "off" is delayed by user-supplied monoflop value */ |
85 | return (current || TIME_BEFORE(current_tick, last_on+delayticks)); | ||
85 | } | 86 | } |
86 | 87 | ||
87 | #endif // #ifdef HAVE_LED | 88 | #endif // #ifdef HAVE_LED |