diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2005-02-19 00:34:15 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2005-02-19 00:34:15 +0000 |
commit | c76fbf7162e598895b1308f1855b0f70629968fc (patch) | |
tree | 77bac888514fd8d7212974a0b2d455b52f3cc4ad | |
parent | 7b56110e5e74055d45753456034b333788823af4 (diff) | |
download | rockbox-c76fbf7162e598895b1308f1855b0f70629968fc.tar.gz rockbox-c76fbf7162e598895b1308f1855b0f70629968fc.zip |
Ondio: disk indication in the status bar, to compensate for lacking LED
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6012 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/recorder/icons.c | 14 | ||||
-rw-r--r-- | apps/recorder/icons.h | 9 | ||||
-rw-r--r-- | apps/status.c | 13 | ||||
-rw-r--r-- | firmware/drivers/ata_mmc.c | 4 | ||||
-rw-r--r-- | firmware/drivers/led.c | 21 | ||||
-rw-r--r-- | firmware/export/led.h | 3 |
6 files changed, 59 insertions, 5 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 4e8601d77a..222024cc70 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -72,6 +72,9 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
72 | {0x3e,0x41,0x51,0x41,0x45,0x41,0x3e}, /* Shuffle playmode (dice) */ | 72 | {0x3e,0x41,0x51,0x41,0x45,0x41,0x3e}, /* Shuffle playmode (dice) */ |
73 | {0x04,0x0c,0x1c,0x3c,0x1c,0x0c,0x04}, /* Down-arrow */ | 73 | {0x04,0x0c,0x1c,0x3c,0x1c,0x0c,0x04}, /* Down-arrow */ |
74 | {0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */ | 74 | {0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */ |
75 | #ifndef HAVE_LED | ||
76 | {0x1c,0x22,0x41,0x49,0x41,0x22,0x1c}, /* Disk/MMC activity */ | ||
77 | #endif | ||
75 | }; | 78 | }; |
76 | 79 | ||
77 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 | 80 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 |
@@ -399,6 +402,17 @@ void statusbar_icon_lock(void) | |||
399 | STATUSBAR_Y_POS, 5, 8, false); | 402 | STATUSBAR_Y_POS, 5, 8, false); |
400 | } | 403 | } |
401 | 404 | ||
405 | #ifndef HAVE_LED | ||
406 | /* | ||
407 | * no real LED: disk activity in status bar | ||
408 | */ | ||
409 | void statusbar_led(void) | ||
410 | { | ||
411 | lcd_bitmap(bitmap_icons_7x8[Icon_Disk], ICON_DISK_X_POS, | ||
412 | STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT, false); | ||
413 | } | ||
414 | #endif | ||
415 | |||
402 | #ifdef HAVE_RTC | 416 | #ifdef HAVE_RTC |
403 | /* | 417 | /* |
404 | * Print time to status bar | 418 | * Print time to status bar |
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 813d33f4fd..394fa14b57 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -57,6 +57,9 @@ enum icons_7x8 { | |||
57 | Icon_Shuffle, | 57 | Icon_Shuffle, |
58 | Icon_DownArrow, | 58 | Icon_DownArrow, |
59 | Icon_UpArrow, | 59 | Icon_UpArrow, |
60 | #ifndef HAVE_LED | ||
61 | Icon_Disk, | ||
62 | #endif | ||
60 | Icon_Last | 63 | Icon_Last |
61 | }; | 64 | }; |
62 | 65 | ||
@@ -89,6 +92,8 @@ extern const unsigned char rockbox160x53[]; | |||
89 | #define ICON_SHUFFLE_WIDTH 7 | 92 | #define ICON_SHUFFLE_WIDTH 7 |
90 | #define LOCK_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+ICON_VOLUME_WIDTH+ICON_PLAY_STATE_WIDTH+ICON_PLAY_MODE_WIDTH+ICON_SHUFFLE_WIDTH+2+2+2+2+2+2 | 93 | #define LOCK_X_POS STATUSBAR_X_POS+ICON_BATTERY_WIDTH+ICON_PLUG_WIDTH+ICON_VOLUME_WIDTH+ICON_PLAY_STATE_WIDTH+ICON_PLAY_MODE_WIDTH+ICON_SHUFFLE_WIDTH+2+2+2+2+2+2 |
91 | #define LOCK_WIDTH 5 | 94 | #define LOCK_WIDTH 5 |
95 | #define ICON_DISK_WIDTH 7 | ||
96 | #define ICON_DISK_X_POS STATUSBAR_WIDTH-ICON_DISK_WIDTH | ||
92 | #define TIME_X_END STATUSBAR_WIDTH-1 | 97 | #define TIME_X_END STATUSBAR_WIDTH-1 |
93 | 98 | ||
94 | extern void statusbar_wipe(void); | 99 | extern void statusbar_wipe(void); |
@@ -101,6 +106,10 @@ extern void statusbar_icon_lock(void); | |||
101 | #ifdef HAVE_RTC | 106 | #ifdef HAVE_RTC |
102 | extern void statusbar_time(int hour, int minute); | 107 | extern void statusbar_time(int hour, int minute); |
103 | #endif | 108 | #endif |
109 | #ifndef HAVE_LED | ||
110 | extern void statusbar_led(void); | ||
111 | #endif | ||
112 | |||
104 | #endif /* End HAVE_LCD_BITMAP */ | 113 | #endif /* End HAVE_LCD_BITMAP */ |
105 | 114 | ||
106 | #endif /* _ICONS_H_ */ | 115 | #endif /* _ICONS_H_ */ |
diff --git a/apps/status.c b/apps/status.c index 03badc5b75..1da51a10a0 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "font.h" | 35 | #include "font.h" |
36 | #endif | 36 | #endif |
37 | #include "powermgmt.h" | 37 | #include "powermgmt.h" |
38 | #include "led.h" | ||
38 | 39 | ||
39 | static enum playmode ff_mode; | 40 | static enum playmode ff_mode; |
40 | 41 | ||
@@ -55,6 +56,9 @@ struct status_info { | |||
55 | bool keylock; | 56 | bool keylock; |
56 | bool battery_safe; | 57 | bool battery_safe; |
57 | bool redraw_volume; /* true if the volume gauge needs updating */ | 58 | bool redraw_volume; /* true if the volume gauge needs updating */ |
59 | #ifndef HAVE_LED | ||
60 | bool led; /* disk LED simulation in the status bar */ | ||
61 | #endif | ||
58 | }; | 62 | }; |
59 | 63 | ||
60 | void status_init(void) | 64 | void status_init(void) |
@@ -155,6 +159,9 @@ void status_draw(bool force_redraw) | |||
155 | info.keylock = keys_locked; | 159 | info.keylock = keys_locked; |
156 | info.repeat = global_settings.repeat_mode; | 160 | info.repeat = global_settings.repeat_mode; |
157 | info.playmode = current_playmode(); | 161 | info.playmode = current_playmode(); |
162 | #ifndef HAVE_LED | ||
163 | info.led = led_read(); | ||
164 | #endif | ||
158 | 165 | ||
159 | /* only redraw if forced to, or info has changed */ | 166 | /* only redraw if forced to, or info has changed */ |
160 | if (force_redraw || | 167 | if (force_redraw || |
@@ -181,7 +188,7 @@ void status_draw(bool force_redraw) | |||
181 | 188 | ||
182 | /* animate battery if charging */ | 189 | /* animate battery if charging */ |
183 | if ((charge_state == 1) || | 190 | if ((charge_state == 1) || |
184 | (charge_state == 2)) { | 191 | € (charge_state == 2)) { |
185 | #else | 192 | #else |
186 | global_settings.runtime = 0; | 193 | global_settings.runtime = 0; |
187 | lasttime = current_tick; | 194 | lasttime = current_tick; |
@@ -233,6 +240,10 @@ void status_draw(bool force_redraw) | |||
233 | #ifdef HAVE_RTC | 240 | #ifdef HAVE_RTC |
234 | statusbar_time(info.hour, info.minute); | 241 | statusbar_time(info.hour, info.minute); |
235 | #endif | 242 | #endif |
243 | #ifndef HAVE_LED | ||
244 | if (info.led) | ||
245 | statusbar_led(); | ||
246 | #endif | ||
236 | lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT); | 247 | lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT); |
237 | lastinfo = info; | 248 | lastinfo = info; |
238 | #endif | 249 | #endif |
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 7ba6dac296..7139f0394f 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -635,6 +635,7 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
635 | addr = start * SECTOR_SIZE; | 635 | addr = start * SECTOR_SIZE; |
636 | 636 | ||
637 | mutex_lock(&mmc_mutex); | 637 | mutex_lock(&mmc_mutex); |
638 | led(true); | ||
638 | #ifdef HAVE_MULTIVOLUME | 639 | #ifdef HAVE_MULTIVOLUME |
639 | card = &card_info[drive]; | 640 | card = &card_info[drive]; |
640 | ret = select_card(drive); | 641 | ret = select_card(drive); |
@@ -681,6 +682,7 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
681 | } | 682 | } |
682 | 683 | ||
683 | deselect_card(); | 684 | deselect_card(); |
685 | led(false); | ||
684 | mutex_unlock(&mmc_mutex); | 686 | mutex_unlock(&mmc_mutex); |
685 | 687 | ||
686 | /* only flush if reading went ok */ | 688 | /* only flush if reading went ok */ |
@@ -706,6 +708,7 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
706 | addr = start * SECTOR_SIZE; | 708 | addr = start * SECTOR_SIZE; |
707 | 709 | ||
708 | mutex_lock(&mmc_mutex); | 710 | mutex_lock(&mmc_mutex); |
711 | led(true); | ||
709 | #ifdef HAVE_MULTIVOLUME | 712 | #ifdef HAVE_MULTIVOLUME |
710 | card = &card_info[drive]; | 713 | card = &card_info[drive]; |
711 | ret = select_card(drive); | 714 | ret = select_card(drive); |
@@ -750,6 +753,7 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
750 | } | 753 | } |
751 | 754 | ||
752 | deselect_card(); | 755 | deselect_card(); |
756 | led(false); | ||
753 | mutex_unlock(&mmc_mutex); | 757 | mutex_unlock(&mmc_mutex); |
754 | 758 | ||
755 | /* only flush if writing went ok */ | 759 | /* only flush if writing went ok */ |
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 90a1b2cb39..4b63d07582 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c | |||
@@ -21,11 +21,13 @@ | |||
21 | #include "cpu.h" | 21 | #include "cpu.h" |
22 | #include "led.h" | 22 | #include "led.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | ||
25 | |||
26 | static bool current; | ||
24 | 27 | ||
25 | #ifdef HAVE_LED | 28 | #ifdef HAVE_LED |
26 | 29 | ||
27 | static bool xor; | 30 | static bool xor; |
28 | static bool current; | ||
29 | 31 | ||
30 | void led(bool on) | 32 | void led(bool on) |
31 | { | 33 | { |
@@ -59,16 +61,27 @@ void invert_led(bool on) | |||
59 | led(current); | 61 | led(current); |
60 | } | 62 | } |
61 | 63 | ||
62 | #else /* no LED, just dummies */ | 64 | #else /* no LED, just status update */ |
65 | |||
66 | static long delay; | ||
63 | 67 | ||
64 | void led(bool on) | 68 | void led(bool on) |
65 | { | 69 | { |
66 | (void)on; | 70 | if (current && !on) /* switching off */ |
71 | { | ||
72 | delay = current_tick + HZ/2; /* delay the "off" status a bit */ | ||
73 | } | ||
74 | current = on; | ||
67 | } | 75 | } |
68 | 76 | ||
69 | void invert_led(bool on) | 77 | void invert_led(bool on) |
70 | { | 78 | { |
71 | (void)on; | 79 | (void)on; /* no invert feature */ |
80 | } | ||
81 | |||
82 | bool led_read(void) /* read by status bar update */ | ||
83 | { | ||
84 | return (current || TIME_BEFORE(current_tick, delay)); | ||
72 | } | 85 | } |
73 | 86 | ||
74 | #endif // #ifdef HAVE_LED | 87 | #endif // #ifdef HAVE_LED |
diff --git a/firmware/export/led.h b/firmware/export/led.h index cc035b9345..d7322e465b 100644 --- a/firmware/export/led.h +++ b/firmware/export/led.h | |||
@@ -24,5 +24,8 @@ | |||
24 | 24 | ||
25 | extern void led( bool on ); | 25 | extern void led( bool on ); |
26 | extern void invert_led( bool on ); | 26 | extern void invert_led( bool on ); |
27 | #ifndef HAVE_LED | ||
28 | extern bool led_read(void); /* read for status bar */ | ||
29 | #endif | ||
27 | 30 | ||
28 | #endif | 31 | #endif |