diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-11-24 00:10:14 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-11-24 00:10:14 +0000 |
commit | 548755adf12390c533a6b393d6324eb5b9473672 (patch) | |
tree | bfa629d7f678193cf9356490d512764c504c044a /firmware | |
parent | 33289d090ff46627032291e89672f1846a6d4eb9 (diff) |
Fixed disk icon display in remote status bar on iriver. * Rolled back led.c changes, introducing a changed #if condition only. Reduces code size on targets with real controllable LED.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8059 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 6 | ||||
-rw-r--r-- | firmware/drivers/led.c | 60 |
2 files changed, 34 insertions, 32 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index a3dd8be241..ec4b342beb 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -512,7 +512,9 @@ static void copy_read_sectors(unsigned char* buf, int wordcount) #endif } -#ifdef CONFIG_LED +#if CONFIG_LED == LED_REAL +/* Conditionally block LED access for the ATA driver, so the LED can be + * (mis)used for other purposes */ static void ata_led(bool on) { ata_led_on = on; if (ata_led_enabled) { @@ -520,7 +522,7 @@ static void ata_led(bool on) { } } #else -#define ata_led(on) +#define ata_led(on) led(on) #endif int ata_read_sectors(IF_MV2(int drive,) diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 1e38fa63d3..118911a746 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -23,50 +23,50 @@ #include "system.h" #include "kernel.h" -static bool disk_led_status; -static long last_on; /* timestamp of switching off */ - - - -void disk_led_on(void) -{ - disk_led_status=true; #if CONFIG_LED == LED_REAL -#ifdef GMINI_ARCH - P2 |= 1; -#else - or_b(0x40, &PBDRL); -#endif -#endif -} -void disk_led_off(void) +void led(bool on) { - if(disk_led_status) - { - last_on = current_tick;/* remember for off delay */ - disk_led_status=false; -#if CONFIG_LED == LED_REAL + if ( on ) #ifdef GMINI_ARCH + P2 |= 1; + else P2 &= ~1; #else + { + or_b(0x40, &PBDRL); + } + else + { and_b(~0x40, &PBDRL); -#endif -#endif } +#endif } +#elif (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) + +static bool current; +static long last_on; /* timestamp of switching off */ + void led(bool on) { - if ( on ) - disk_led_on(); - else - disk_led_off(); + if (current && !on) /* switching off */ + { + last_on = current_tick; /* remember for off delay */ + } + current = on; } -bool led_read(int delayticks) +bool led_read(int delayticks) /* read by status bar update */ { /* reading "off" is delayed by user-supplied monoflop value */ - return (disk_led_status || - TIME_BEFORE(current_tick, last_on+delayticks)); + return (current || TIME_BEFORE(current_tick, last_on+delayticks)); +} + +#else + +void led(bool on) +{ + (void)on; } +#endif /* CONFIG_LED, HAVE_REMOTE_LCD */ |