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
This commit is contained in:
parent
33289d090f
commit
548755adf1
7 changed files with 56 additions and 40 deletions
|
@ -143,8 +143,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
|||
#endif
|
||||
bar->info.repeat = global_settings.repeat_mode;
|
||||
bar->info.playmode = current_playmode();
|
||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||
if(!display->has_disk_led)
|
||||
bar->info.led = led_read(HZ/2); /* delay should match polling interval */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_USB_POWER
|
||||
bar->info.usb_power = usb_powered();
|
||||
|
@ -258,8 +260,10 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
|
|||
#ifdef HAVE_RTC
|
||||
gui_statusbar_time(display, bar->info.hour, bar->info.minute);
|
||||
#endif /* HAVE_RTC */
|
||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||
if(!display->has_disk_led && bar->info.led)
|
||||
gui_statusbar_led(display);
|
||||
#endif
|
||||
display->update_rect(0, 0, display->width, STATUSBAR_HEIGHT);
|
||||
bar->lastinfo = bar->info;
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
@ -465,6 +469,7 @@ void gui_statusbar_icon_lock_remote(struct screen * display)
|
|||
STATUSBAR_LOCKR_WIDTH, STATUSBAR_HEIGHT);
|
||||
}
|
||||
|
||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||
/*
|
||||
* no real LED: disk activity in status bar
|
||||
*/
|
||||
|
@ -475,6 +480,7 @@ void gui_statusbar_led(struct screen * display)
|
|||
STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH,
|
||||
STATUSBAR_HEIGHT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RTC
|
||||
/*
|
||||
|
|
|
@ -46,7 +46,9 @@ struct status_info {
|
|||
#endif
|
||||
bool battery_safe;
|
||||
bool redraw_volume; /* true if the volume gauge needs updating */
|
||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||
bool led; /* disk LED simulation in the status bar */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_USB_POWER
|
||||
bool usb_power;
|
||||
|
|
|
@ -74,8 +74,12 @@ const unsigned char bitmap_icons_7x8[][7] =
|
|||
};
|
||||
|
||||
/* Disk/MMC activity */
|
||||
const unsigned char bitmap_icon_disk[12] =
|
||||
const unsigned char bitmap_icon_disk[12] =
|
||||
#ifdef HAVE_MMC
|
||||
{0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f};
|
||||
#else
|
||||
{0x00,0x00,0x00,0x1c,0x22,0x41,0x49,0x41,0x22,0x1c,0x00,0x00};
|
||||
#endif
|
||||
|
||||
#if LCD_WIDTH == 112 || LCD_WIDTH == 128 \
|
||||
|| (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128)
|
||||
|
|
|
@ -100,7 +100,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
|
|||
screen->depth=LCD_DEPTH;
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
screen->has_disk_led=false;
|
||||
#else
|
||||
#elif defined(HAVE_REMOTE_LCD)
|
||||
screen->has_disk_led=true;
|
||||
#endif
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
|
|
|
@ -54,7 +54,9 @@ struct screen
|
|||
int depth;
|
||||
int char_width;
|
||||
int char_height;
|
||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||
bool has_disk_led;
|
||||
#endif
|
||||
#ifdef HAS_BUTTONBAR
|
||||
bool has_buttonbar;
|
||||
#endif
|
||||
|
|
|
@ -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,)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
if(disk_led_status)
|
||||
{
|
||||
last_on = current_tick;/* remember for off delay */
|
||||
disk_led_status=false;
|
||||
#if CONFIG_LED == LED_REAL
|
||||
#ifdef GMINI_ARCH
|
||||
P2 &= ~1;
|
||||
#else
|
||||
and_b(~0x40, &PBDRL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void led(bool on)
|
||||
{
|
||||
if ( on )
|
||||
disk_led_on();
|
||||
#ifdef GMINI_ARCH
|
||||
P2 |= 1;
|
||||
else
|
||||
disk_led_off();
|
||||
P2 &= ~1;
|
||||
#else
|
||||
{
|
||||
or_b(0x40, &PBDRL);
|
||||
}
|
||||
else
|
||||
{
|
||||
and_b(~0x40, &PBDRL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool led_read(int delayticks)
|
||||
#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 (current && !on) /* switching off */
|
||||
{
|
||||
last_on = current_tick; /* remember for off delay */
|
||||
}
|
||||
current = on;
|
||||
}
|
||||
|
||||
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 */
|
||||
|
|
Loading…
Reference in a new issue