diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-06-04 23:15:52 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-06-04 23:15:52 +0000 |
commit | 5690f78fb23ec66aeadf5ecf8200b5610b3e59d2 (patch) | |
tree | 62bab156602ab905851fbb000c22d48bf2f8f85e /firmware/drivers | |
parent | c9cc73ec1988dae9e3d1a09347ceac2a4ecc1f67 (diff) | |
download | rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.tar.gz rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.zip |
Multiple choice LED configuration instead of HAVE_LED. Removes erroneous MMC icon display on iriver, and saves some code on Ondio. Removed invert_led() as it is no longer used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6568 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 8 | ||||
-rw-r--r-- | firmware/drivers/led.c | 32 |
2 files changed, 13 insertions, 27 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index c8ad3b3151..9bf1815e36 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -241,8 +241,10 @@ static volatile unsigned char* ata_control; | |||
241 | 241 | ||
242 | bool old_recorder = false; | 242 | bool old_recorder = false; |
243 | int ata_spinup_time = 0; | 243 | int ata_spinup_time = 0; |
244 | #ifdef CONFIG_LED | ||
244 | static bool ata_led_enabled = true; | 245 | static bool ata_led_enabled = true; |
245 | static bool ata_led_on = false; | 246 | static bool ata_led_on = false; |
247 | #endif | ||
246 | static bool spinup = false; | 248 | static bool spinup = false; |
247 | static bool sleeping = true; | 249 | static bool sleeping = true; |
248 | static long sleep_timeout = 5*HZ; | 250 | static long sleep_timeout = 5*HZ; |
@@ -475,12 +477,16 @@ static void copy_read_sectors(unsigned char* buf, int wordcount) | |||
475 | #endif | 477 | #endif |
476 | } | 478 | } |
477 | 479 | ||
480 | #ifdef CONFIG_LED | ||
478 | static void ata_led(bool on) { | 481 | static void ata_led(bool on) { |
479 | ata_led_on = on; | 482 | ata_led_on = on; |
480 | if (ata_led_enabled) { | 483 | if (ata_led_enabled) { |
481 | led(ata_led_on); | 484 | led(ata_led_on); |
482 | } | 485 | } |
483 | } | 486 | } |
487 | #else | ||
488 | #define ata_led(on) | ||
489 | #endif | ||
484 | 490 | ||
485 | int ata_read_sectors(IF_MV2(int drive,) | 491 | int ata_read_sectors(IF_MV2(int drive,) |
486 | unsigned long start, | 492 | unsigned long start, |
@@ -1468,6 +1474,7 @@ int ata_init(void) | |||
1468 | return 0; | 1474 | return 0; |
1469 | } | 1475 | } |
1470 | 1476 | ||
1477 | #if CONFIG_LED == LED_REAL | ||
1471 | void ata_set_led_enabled(bool enabled) { | 1478 | void ata_set_led_enabled(bool enabled) { |
1472 | ata_led_enabled = enabled; | 1479 | ata_led_enabled = enabled; |
1473 | if (ata_led_enabled) { | 1480 | if (ata_led_enabled) { |
@@ -1476,3 +1483,4 @@ void ata_set_led_enabled(bool enabled) { | |||
1476 | led(false); | 1483 | led(false); |
1477 | } | 1484 | } |
1478 | } | 1485 | } |
1486 | #endif | ||
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 */ |