summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-02-19 00:34:15 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-02-19 00:34:15 +0000
commitc76fbf7162e598895b1308f1855b0f70629968fc (patch)
tree77bac888514fd8d7212974a0b2d455b52f3cc4ad
parent7b56110e5e74055d45753456034b333788823af4 (diff)
downloadrockbox-c76fbf7162e598895b1308f1855b0f70629968fc.zip
rockbox-c76fbf7162e598895b1308f1855b0f70629968fc.tar.gz
rockbox-c76fbf7162e598895b1308f1855b0f70629968fc.tar.bz2
rockbox-c76fbf7162e598895b1308f1855b0f70629968fc.tar.xz
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.c14
-rw-r--r--apps/recorder/icons.h9
-rw-r--r--apps/status.c13
-rw-r--r--firmware/drivers/ata_mmc.c4
-rw-r--r--firmware/drivers/led.c21
-rw-r--r--firmware/export/led.h3
6 files changed, 59 insertions, 5 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 4e8601d..222024c 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -72,6 +72,9 @@ const unsigned char bitmap_icons_7x8[][7] =
{0x3e,0x41,0x51,0x41,0x45,0x41,0x3e}, /* Shuffle playmode (dice) */
{0x04,0x0c,0x1c,0x3c,0x1c,0x0c,0x04}, /* Down-arrow */
{0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */
+#ifndef HAVE_LED
+ {0x1c,0x22,0x41,0x49,0x41,0x22,0x1c}, /* Disk/MMC activity */
+#endif
};
#if LCD_WIDTH == 112 || LCD_WIDTH == 128
@@ -399,6 +402,17 @@ void statusbar_icon_lock(void)
STATUSBAR_Y_POS, 5, 8, false);
}
+#ifndef HAVE_LED
+/*
+ * no real LED: disk activity in status bar
+ */
+void statusbar_led(void)
+{
+ lcd_bitmap(bitmap_icons_7x8[Icon_Disk], ICON_DISK_X_POS,
+ STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT, false);
+}
+#endif
+
#ifdef HAVE_RTC
/*
* Print time to status bar
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 813d33f..394fa14 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -57,6 +57,9 @@ enum icons_7x8 {
Icon_Shuffle,
Icon_DownArrow,
Icon_UpArrow,
+#ifndef HAVE_LED
+ Icon_Disk,
+#endif
Icon_Last
};
@@ -89,6 +92,8 @@ extern const unsigned char rockbox160x53[];
#define ICON_SHUFFLE_WIDTH 7
#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
#define LOCK_WIDTH 5
+#define ICON_DISK_WIDTH 7
+#define ICON_DISK_X_POS STATUSBAR_WIDTH-ICON_DISK_WIDTH
#define TIME_X_END STATUSBAR_WIDTH-1
extern void statusbar_wipe(void);
@@ -101,6 +106,10 @@ extern void statusbar_icon_lock(void);
#ifdef HAVE_RTC
extern void statusbar_time(int hour, int minute);
#endif
+#ifndef HAVE_LED
+extern void statusbar_led(void);
+#endif
+
#endif /* End HAVE_LCD_BITMAP */
#endif /* _ICONS_H_ */
diff --git a/apps/status.c b/apps/status.c
index 03badc5..1da51a1 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -35,6 +35,7 @@
#include "font.h"
#endif
#include "powermgmt.h"
+#include "led.h"
static enum playmode ff_mode;
@@ -55,6 +56,9 @@ struct status_info {
bool keylock;
bool battery_safe;
bool redraw_volume; /* true if the volume gauge needs updating */
+#ifndef HAVE_LED
+ bool led; /* disk LED simulation in the status bar */
+#endif
};
void status_init(void)
@@ -155,6 +159,9 @@ void status_draw(bool force_redraw)
info.keylock = keys_locked;
info.repeat = global_settings.repeat_mode;
info.playmode = current_playmode();
+#ifndef HAVE_LED
+ info.led = led_read();
+#endif
/* only redraw if forced to, or info has changed */
if (force_redraw ||
@@ -181,7 +188,7 @@ void status_draw(bool force_redraw)
/* animate battery if charging */
if ((charge_state == 1) ||
- (charge_state == 2)) {
+€ (charge_state == 2)) {
#else
global_settings.runtime = 0;
lasttime = current_tick;
@@ -233,6 +240,10 @@ void status_draw(bool force_redraw)
#ifdef HAVE_RTC
statusbar_time(info.hour, info.minute);
#endif
+#ifndef HAVE_LED
+ if (info.led)
+ statusbar_led();
+#endif
lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT);
lastinfo = info;
#endif
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 7ba6dac..7139f03 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,)
addr = start * SECTOR_SIZE;
mutex_lock(&mmc_mutex);
+ led(true);
#ifdef HAVE_MULTIVOLUME
card = &card_info[drive];
ret = select_card(drive);
@@ -681,6 +682,7 @@ int ata_read_sectors(IF_MV2(int drive,)
}
deselect_card();
+ led(false);
mutex_unlock(&mmc_mutex);
/* only flush if reading went ok */
@@ -706,6 +708,7 @@ int ata_write_sectors(IF_MV2(int drive,)
addr = start * SECTOR_SIZE;
mutex_lock(&mmc_mutex);
+ led(true);
#ifdef HAVE_MULTIVOLUME
card = &card_info[drive];
ret = select_card(drive);
@@ -750,6 +753,7 @@ int ata_write_sectors(IF_MV2(int drive,)
}
deselect_card();
+ led(false);
mutex_unlock(&mmc_mutex);
/* only flush if writing went ok */
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index 90a1b2c..4b63d07 100644
--- a/firmware/drivers/led.c
+++ b/firmware/drivers/led.c
@@ -21,11 +21,13 @@
#include "cpu.h"
#include "led.h"
#include "system.h"
+#include "kernel.h"
+
+static bool current;
#ifdef HAVE_LED
static bool xor;
-static bool current;
void led(bool on)
{
@@ -59,16 +61,27 @@ void invert_led(bool on)
led(current);
}
-#else /* no LED, just dummies */
+#else /* no LED, just status update */
+
+static long delay;
void led(bool on)
{
- (void)on;
+ if (current && !on) /* switching off */
+ {
+ delay = current_tick + HZ/2; /* delay the "off" status a bit */
+ }
+ current = on;
}
void invert_led(bool on)
{
- (void)on;
+ (void)on; /* no invert feature */
+}
+
+bool led_read(void) /* read by status bar update */
+{
+ return (current || TIME_BEFORE(current_tick, delay));
}
#endif // #ifdef HAVE_LED
diff --git a/firmware/export/led.h b/firmware/export/led.h
index cc035b9..d7322e4 100644
--- a/firmware/export/led.h
+++ b/firmware/export/led.h
@@ -24,5 +24,8 @@
extern void led( bool on );
extern void invert_led( bool on );
+#ifndef HAVE_LED
+extern bool led_read(void); /* read for status bar */
+#endif
#endif