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 | |
parent | 33289d090ff46627032291e89672f1846a6d4eb9 (diff) | |
download | rockbox-548755adf12390c533a6b393d6324eb5b9473672.tar.gz rockbox-548755adf12390c533a6b393d6324eb5b9473672.zip |
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
-rw-r--r-- | apps/gui/statusbar.c | 6 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 2 | ||||
-rw-r--r-- | apps/recorder/icons.c | 6 | ||||
-rw-r--r-- | apps/screen_access.c | 2 | ||||
-rw-r--r-- | apps/screen_access.h | 2 | ||||
-rw-r--r-- | firmware/drivers/ata.c | 6 | ||||
-rw-r--r-- | firmware/drivers/led.c | 60 |
7 files changed, 50 insertions, 34 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 945013e4b9..d336d8ad0e 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c | |||
@@ -143,8 +143,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
143 | #endif | 143 | #endif |
144 | bar->info.repeat = global_settings.repeat_mode; | 144 | bar->info.repeat = global_settings.repeat_mode; |
145 | bar->info.playmode = current_playmode(); | 145 | bar->info.playmode = current_playmode(); |
146 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
146 | if(!display->has_disk_led) | 147 | if(!display->has_disk_led) |
147 | bar->info.led = led_read(HZ/2); /* delay should match polling interval */ | 148 | bar->info.led = led_read(HZ/2); /* delay should match polling interval */ |
149 | #endif | ||
148 | 150 | ||
149 | #ifdef HAVE_USB_POWER | 151 | #ifdef HAVE_USB_POWER |
150 | bar->info.usb_power = usb_powered(); | 152 | bar->info.usb_power = usb_powered(); |
@@ -258,8 +260,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw) | |||
258 | #ifdef HAVE_RTC | 260 | #ifdef HAVE_RTC |
259 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); | 261 | gui_statusbar_time(display, bar->info.hour, bar->info.minute); |
260 | #endif /* HAVE_RTC */ | 262 | #endif /* HAVE_RTC */ |
263 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
261 | if(!display->has_disk_led && bar->info.led) | 264 | if(!display->has_disk_led && bar->info.led) |
262 | gui_statusbar_led(display); | 265 | gui_statusbar_led(display); |
266 | #endif | ||
263 | display->update_rect(0, 0, display->width, STATUSBAR_HEIGHT); | 267 | display->update_rect(0, 0, display->width, STATUSBAR_HEIGHT); |
264 | bar->lastinfo = bar->info; | 268 | bar->lastinfo = bar->info; |
265 | #endif /* HAVE_LCD_BITMAP */ | 269 | #endif /* HAVE_LCD_BITMAP */ |
@@ -465,6 +469,7 @@ void gui_statusbar_icon_lock_remote(struct screen * display) | |||
465 | STATUSBAR_LOCKR_WIDTH, STATUSBAR_HEIGHT); | 469 | STATUSBAR_LOCKR_WIDTH, STATUSBAR_HEIGHT); |
466 | } | 470 | } |
467 | 471 | ||
472 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
468 | /* | 473 | /* |
469 | * no real LED: disk activity in status bar | 474 | * no real LED: disk activity in status bar |
470 | */ | 475 | */ |
@@ -475,6 +480,7 @@ void gui_statusbar_led(struct screen * display) | |||
475 | STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH, | 480 | STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH, |
476 | STATUSBAR_HEIGHT); | 481 | STATUSBAR_HEIGHT); |
477 | } | 482 | } |
483 | #endif | ||
478 | 484 | ||
479 | #ifdef HAVE_RTC | 485 | #ifdef HAVE_RTC |
480 | /* | 486 | /* |
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index 88dfd4c4a2..62f6b90820 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h | |||
@@ -46,7 +46,9 @@ struct status_info { | |||
46 | #endif | 46 | #endif |
47 | bool battery_safe; | 47 | bool battery_safe; |
48 | bool redraw_volume; /* true if the volume gauge needs updating */ | 48 | bool redraw_volume; /* true if the volume gauge needs updating */ |
49 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
49 | bool led; /* disk LED simulation in the status bar */ | 50 | bool led; /* disk LED simulation in the status bar */ |
51 | #endif | ||
50 | 52 | ||
51 | #ifdef HAVE_USB_POWER | 53 | #ifdef HAVE_USB_POWER |
52 | bool usb_power; | 54 | bool usb_power; |
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 68985c2028..bee0f47f12 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -74,8 +74,12 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
74 | }; | 74 | }; |
75 | 75 | ||
76 | /* Disk/MMC activity */ | 76 | /* Disk/MMC activity */ |
77 | const unsigned char bitmap_icon_disk[12] = | 77 | const unsigned char bitmap_icon_disk[12] = |
78 | #ifdef HAVE_MMC | ||
78 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; | 79 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; |
80 | #else | ||
81 | {0x00,0x00,0x00,0x1c,0x22,0x41,0x49,0x41,0x22,0x1c,0x00,0x00}; | ||
82 | #endif | ||
79 | 83 | ||
80 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ | 84 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ |
81 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 85 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) |
diff --git a/apps/screen_access.c b/apps/screen_access.c index 9ea33ba25f..56fe131869 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -100,7 +100,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type) | |||
100 | screen->depth=LCD_DEPTH; | 100 | screen->depth=LCD_DEPTH; |
101 | #if CONFIG_LED == LED_VIRTUAL | 101 | #if CONFIG_LED == LED_VIRTUAL |
102 | screen->has_disk_led=false; | 102 | screen->has_disk_led=false; |
103 | #else | 103 | #elif defined(HAVE_REMOTE_LCD) |
104 | screen->has_disk_led=true; | 104 | screen->has_disk_led=true; |
105 | #endif | 105 | #endif |
106 | #ifdef HAVE_LCD_BITMAP | 106 | #ifdef HAVE_LCD_BITMAP |
diff --git a/apps/screen_access.h b/apps/screen_access.h index 430d5ab661..8eb89152aa 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -54,7 +54,9 @@ struct screen | |||
54 | int depth; | 54 | int depth; |
55 | int char_width; | 55 | int char_width; |
56 | int char_height; | 56 | int char_height; |
57 | #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
57 | bool has_disk_led; | 58 | bool has_disk_led; |
59 | #endif | ||
58 | #ifdef HAS_BUTTONBAR | 60 | #ifdef HAS_BUTTONBAR |
59 | bool has_buttonbar; | 61 | bool has_buttonbar; |
60 | #endif | 62 | #endif |
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) | |||
512 | #endif | 512 | #endif |
513 | } | 513 | } |
514 | 514 | ||
515 | #ifdef CONFIG_LED | 515 | #if CONFIG_LED == LED_REAL |
516 | /* Conditionally block LED access for the ATA driver, so the LED can be | ||
517 | * (mis)used for other purposes */ | ||
516 | static void ata_led(bool on) { | 518 | static void ata_led(bool on) { |
517 | ata_led_on = on; | 519 | ata_led_on = on; |
518 | if (ata_led_enabled) { | 520 | if (ata_led_enabled) { |
@@ -520,7 +522,7 @@ static void ata_led(bool on) { | |||
520 | } | 522 | } |
521 | } | 523 | } |
522 | #else | 524 | #else |
523 | #define ata_led(on) | 525 | #define ata_led(on) led(on) |
524 | #endif | 526 | #endif |
525 | 527 | ||
526 | int ata_read_sectors(IF_MV2(int drive,) | 528 | 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 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | 25 | ||
26 | static bool disk_led_status; | ||
27 | static long last_on; /* timestamp of switching off */ | ||
28 | |||
29 | |||
30 | |||
31 | void disk_led_on(void) | ||
32 | { | ||
33 | disk_led_status=true; | ||
34 | #if CONFIG_LED == LED_REAL | 26 | #if CONFIG_LED == LED_REAL |
35 | #ifdef GMINI_ARCH | ||
36 | P2 |= 1; | ||
37 | #else | ||
38 | or_b(0x40, &PBDRL); | ||
39 | #endif | ||
40 | #endif | ||
41 | } | ||
42 | 27 | ||
43 | void disk_led_off(void) | 28 | void led(bool on) |
44 | { | 29 | { |
45 | if(disk_led_status) | 30 | if ( on ) |
46 | { | ||
47 | last_on = current_tick;/* remember for off delay */ | ||
48 | disk_led_status=false; | ||
49 | #if CONFIG_LED == LED_REAL | ||
50 | #ifdef GMINI_ARCH | 31 | #ifdef GMINI_ARCH |
32 | P2 |= 1; | ||
33 | else | ||
51 | P2 &= ~1; | 34 | P2 &= ~1; |
52 | #else | 35 | #else |
36 | { | ||
37 | or_b(0x40, &PBDRL); | ||
38 | } | ||
39 | else | ||
40 | { | ||
53 | and_b(~0x40, &PBDRL); | 41 | and_b(~0x40, &PBDRL); |
54 | #endif | ||
55 | #endif | ||
56 | } | 42 | } |
43 | #endif | ||
57 | } | 44 | } |
58 | 45 | ||
46 | #elif (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) | ||
47 | |||
48 | static bool current; | ||
49 | static long last_on; /* timestamp of switching off */ | ||
50 | |||
59 | void led(bool on) | 51 | void led(bool on) |
60 | { | 52 | { |
61 | if ( on ) | 53 | if (current && !on) /* switching off */ |
62 | disk_led_on(); | 54 | { |
63 | else | 55 | last_on = current_tick; /* remember for off delay */ |
64 | disk_led_off(); | 56 | } |
57 | current = on; | ||
65 | } | 58 | } |
66 | 59 | ||
67 | bool led_read(int delayticks) | 60 | bool led_read(int delayticks) /* read by status bar update */ |
68 | { | 61 | { |
69 | /* reading "off" is delayed by user-supplied monoflop value */ | 62 | /* reading "off" is delayed by user-supplied monoflop value */ |
70 | return (disk_led_status || | 63 | return (current || TIME_BEFORE(current_tick, last_on+delayticks)); |
71 | TIME_BEFORE(current_tick, last_on+delayticks)); | 64 | } |
65 | |||
66 | #else | ||
67 | |||
68 | void led(bool on) | ||
69 | { | ||
70 | (void)on; | ||
72 | } | 71 | } |
72 | #endif /* CONFIG_LED, HAVE_REMOTE_LCD */ | ||