1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jörg Hohensohn 2005-02-19 00:34:15 +00:00
parent 7b56110e5e
commit c76fbf7162
6 changed files with 59 additions and 5 deletions

View file

@ -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

View file

@ -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_ */

View file

@ -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;
@ -232,6 +239,10 @@ void status_draw(bool force_redraw)
statusbar_icon_lock();
#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;

View file

@ -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 */

View file

@ -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

View file

@ -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