diff options
Diffstat (limited to 'firmware/drivers/led.c')
-rw-r--r-- | firmware/drivers/led.c | 21 |
1 files changed, 17 insertions, 4 deletions
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 @@ | |||
21 | #include "cpu.h" | 21 | #include "cpu.h" |
22 | #include "led.h" | 22 | #include "led.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | ||
25 | |||
26 | static bool current; | ||
24 | 27 | ||
25 | #ifdef HAVE_LED | 28 | #ifdef HAVE_LED |
26 | 29 | ||
27 | static bool xor; | 30 | static bool xor; |
28 | static bool current; | ||
29 | 31 | ||
30 | void led(bool on) | 32 | void led(bool on) |
31 | { | 33 | { |
@@ -59,16 +61,27 @@ void invert_led(bool on) | |||
59 | led(current); | 61 | led(current); |
60 | } | 62 | } |
61 | 63 | ||
62 | #else /* no LED, just dummies */ | 64 | #else /* no LED, just status update */ |
65 | |||
66 | static long delay; | ||
63 | 67 | ||
64 | void led(bool on) | 68 | void led(bool on) |
65 | { | 69 | { |
66 | (void)on; | 70 | if (current && !on) /* switching off */ |
71 | { | ||
72 | delay = current_tick + HZ/2; /* delay the "off" status a bit */ | ||
73 | } | ||
74 | current = on; | ||
67 | } | 75 | } |
68 | 76 | ||
69 | void invert_led(bool on) | 77 | void invert_led(bool on) |
70 | { | 78 | { |
71 | (void)on; | 79 | (void)on; /* no invert feature */ |
80 | } | ||
81 | |||
82 | bool led_read(void) /* read by status bar update */ | ||
83 | { | ||
84 | return (current || TIME_BEFORE(current_tick, delay)); | ||
72 | } | 85 | } |
73 | 86 | ||
74 | #endif // #ifdef HAVE_LED | 87 | #endif // #ifdef HAVE_LED |