diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/led.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index adeb2714e0..f3b0693c6d 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c | |||
@@ -22,9 +22,13 @@ | |||
22 | #include "led.h" | 22 | #include "led.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | 24 | ||
25 | static bool xor; | ||
26 | static bool current; | ||
27 | |||
25 | void led(bool on) | 28 | void led(bool on) |
26 | { | 29 | { |
27 | if ( on ) | 30 | current = on; |
31 | if ( on ^ xor ) | ||
28 | { | 32 | { |
29 | or_b(0x40, &PBDRL); | 33 | or_b(0x40, &PBDRL); |
30 | } | 34 | } |
@@ -33,3 +37,17 @@ void led(bool on) | |||
33 | and_b(~0x40, &PBDRL); | 37 | and_b(~0x40, &PBDRL); |
34 | } | 38 | } |
35 | } | 39 | } |
40 | |||
41 | void invert_led(bool on) | ||
42 | { | ||
43 | if ( on ) | ||
44 | { | ||
45 | xor = 1; | ||
46 | } | ||
47 | else | ||
48 | { | ||
49 | xor = 0; | ||
50 | } | ||
51 | led(current); | ||
52 | } | ||
53 | |||