diff options
Diffstat (limited to 'firmware/drivers/led.c')
-rw-r--r-- | firmware/drivers/led.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 4598175b79..ca4aadac71 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c | |||
@@ -23,16 +23,11 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | 25 | ||
26 | static bool current; | 26 | #if CONFIG_LED == LED_REAL |
27 | |||
28 | #ifdef HAVE_LED | ||
29 | |||
30 | static bool xor; | ||
31 | 27 | ||
32 | void led(bool on) | 28 | void led(bool on) |
33 | { | 29 | { |
34 | current = on; | 30 | if ( on ) |
35 | if ( on ^ xor ) | ||
36 | #ifdef GMINI_ARCH | 31 | #ifdef GMINI_ARCH |
37 | P2 |= 1; | 32 | P2 |= 1; |
38 | else | 33 | else |
@@ -48,21 +43,9 @@ void led(bool on) | |||
48 | #endif | 43 | #endif |
49 | } | 44 | } |
50 | 45 | ||
51 | void invert_led(bool on) | 46 | #elif CONFIG_LED == LED_VIRTUAL |
52 | { | ||
53 | if ( on ) | ||
54 | { | ||
55 | xor = 1; | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | xor = 0; | ||
60 | } | ||
61 | led(current); | ||
62 | } | ||
63 | |||
64 | #else /* no LED, just status update */ | ||
65 | 47 | ||
48 | static bool current; | ||
66 | static long last_on; /* timestamp of switching off */ | 49 | static long last_on; /* timestamp of switching off */ |
67 | 50 | ||
68 | void led(bool on) | 51 | void led(bool on) |
@@ -74,15 +57,10 @@ void led(bool on) | |||
74 | current = on; | 57 | current = on; |
75 | } | 58 | } |
76 | 59 | ||
77 | void invert_led(bool on) | ||
78 | { | ||
79 | (void)on; /* no invert feature */ | ||
80 | } | ||
81 | |||
82 | bool led_read(int delayticks) /* read by status bar update */ | 60 | bool led_read(int delayticks) /* read by status bar update */ |
83 | { | 61 | { |
84 | /* reading "off" is delayed by user-supplied monoflop value */ | 62 | /* reading "off" is delayed by user-supplied monoflop value */ |
85 | return (current || TIME_BEFORE(current_tick, last_on+delayticks)); | 63 | return (current || TIME_BEFORE(current_tick, last_on+delayticks)); |
86 | } | 64 | } |
87 | 65 | ||
88 | #endif // #ifdef HAVE_LED | 66 | #endif /* CONFIG_LED */ |