mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Multiple choice LED configuration instead of HAVE_LED. Removes erroneous MMC icon display on iriver, and saves some code on Ondio. Removed invert_led() as it is no longer used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6568 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c9cc73ec19
commit
5690f78fb2
20 changed files with 62 additions and 56 deletions
|
@ -277,7 +277,7 @@ void init(void)
|
|||
|
||||
#ifdef AUTOROCK
|
||||
if (!usb_detect())
|
||||
{
|
||||
{
|
||||
int fd;
|
||||
static const char filename[] = PLUGIN_DIR "/autostart.rock";
|
||||
|
||||
|
@ -303,8 +303,10 @@ int main(void)
|
|||
app_main();
|
||||
|
||||
while(1) {
|
||||
#if CONFIG_LED == LED_REAL
|
||||
led(true); sleep(HZ/10);
|
||||
led(false); sleep(HZ/10);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ const unsigned char bitmap_icons_7x8[][7] =
|
|||
{0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */
|
||||
};
|
||||
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
/* Disk/MMC activity */
|
||||
const unsigned char bitmap_icon_disk[12] =
|
||||
{0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f};
|
||||
|
@ -405,7 +405,7 @@ void statusbar_icon_lock(void)
|
|||
STATUSBAR_Y_POS, 5, 8, false);
|
||||
}
|
||||
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
/*
|
||||
* no real LED: disk activity in status bar
|
||||
*/
|
||||
|
|
|
@ -63,7 +63,7 @@ enum icons_7x8 {
|
|||
extern const unsigned char bitmap_icons_5x8[1][5];
|
||||
extern const unsigned char bitmap_icons_6x8[LastIcon][6];
|
||||
extern const unsigned char bitmap_icons_7x8[Icon_Last][7];
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
extern const unsigned char bitmap_icon_disk[];
|
||||
#endif
|
||||
|
||||
|
@ -106,7 +106,7 @@ extern void statusbar_icon_lock(void);
|
|||
#ifdef HAVE_RTC
|
||||
extern void statusbar_time(int hour, int minute);
|
||||
#endif
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
extern void statusbar_led(void);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ bool recording_screen(void)
|
|||
char path_buffer[MAX_PATH];
|
||||
bool been_in_usb_mode = false;
|
||||
int last_audio_stat = -1;
|
||||
#ifdef HAVE_LED
|
||||
#if CONFIG_LED == LED_REAL
|
||||
bool led_state = false;
|
||||
int led_countdown = 2;
|
||||
#endif
|
||||
|
@ -320,7 +320,7 @@ bool recording_screen(void)
|
|||
};
|
||||
|
||||
cursor = 0;
|
||||
#if defined(HAVE_LED) && !defined(SIMULATOR)
|
||||
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
||||
ata_set_led_enabled(false);
|
||||
#endif
|
||||
mpeg_init_recording();
|
||||
|
@ -356,7 +356,7 @@ bool recording_screen(void)
|
|||
while(!done)
|
||||
{
|
||||
int audio_stat = audio_status();
|
||||
#ifdef HAVE_LED
|
||||
#if CONFIG_LED == LED_REAL
|
||||
|
||||
/*
|
||||
* Flash the LED while waiting to record. Turn it on while
|
||||
|
@ -401,7 +401,7 @@ bool recording_screen(void)
|
|||
led(false);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LED */
|
||||
#endif /* CONFIG_LED */
|
||||
|
||||
/* Wait for a button a while (HZ/10) drawing the peak meter */
|
||||
button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h);
|
||||
|
@ -574,7 +574,7 @@ bool recording_screen(void)
|
|||
case REC_SETTINGS:
|
||||
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||
{
|
||||
#ifdef HAVE_LED
|
||||
#if CONFIG_LED == LED_REAL
|
||||
/* led is restored at begin of loop / end of function */
|
||||
led(false);
|
||||
#endif
|
||||
|
@ -607,7 +607,7 @@ bool recording_screen(void)
|
|||
case REC_F2:
|
||||
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||
{
|
||||
#ifdef HAVE_LED
|
||||
#if CONFIG_LED == LED_REAL
|
||||
/* led is restored at begin of loop / end of function */
|
||||
led(false);
|
||||
#endif
|
||||
|
@ -633,7 +633,7 @@ bool recording_screen(void)
|
|||
{
|
||||
if(audio_stat != AUDIO_STATUS_RECORD)
|
||||
{
|
||||
#ifdef HAVE_LED
|
||||
#if CONFIG_LED == LED_REAL
|
||||
/* led is restored at begin of loop / end of function */
|
||||
led(false);
|
||||
#endif
|
||||
|
@ -839,7 +839,7 @@ bool recording_screen(void)
|
|||
if (have_recorded)
|
||||
reload_directory();
|
||||
|
||||
#if defined(HAVE_LED) && !defined(SIMULATOR)
|
||||
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
||||
ata_set_led_enabled(true);
|
||||
#endif
|
||||
return been_in_usb_mode;
|
||||
|
|
|
@ -60,7 +60,7 @@ struct status_info {
|
|||
bool keylock;
|
||||
bool battery_safe;
|
||||
bool redraw_volume; /* true if the volume gauge needs updating */
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
bool led; /* disk LED simulation in the status bar */
|
||||
#endif
|
||||
};
|
||||
|
@ -167,7 +167,7 @@ void status_draw(bool force_redraw)
|
|||
#endif
|
||||
info.repeat = global_settings.repeat_mode;
|
||||
info.playmode = current_playmode();
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
info.led = led_read(HZ/2); /* delay should match polling interval */
|
||||
#endif
|
||||
|
||||
|
@ -248,7 +248,7 @@ void status_draw(bool force_redraw)
|
|||
#ifdef HAVE_RTC
|
||||
statusbar_time(info.hour, info.minute);
|
||||
#endif
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
if (info.led)
|
||||
statusbar_led();
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,9 @@ drivers/lcd-recorder.c
|
|||
#endif
|
||||
#endif
|
||||
drivers/power.c
|
||||
#ifdef CONFIG_LED
|
||||
drivers/led.c
|
||||
#endif
|
||||
#ifndef SIMULATOR
|
||||
drivers/adc.c
|
||||
#ifdef HAVE_MMC
|
||||
|
|
|
@ -241,8 +241,10 @@ static volatile unsigned char* ata_control;
|
|||
|
||||
bool old_recorder = false;
|
||||
int ata_spinup_time = 0;
|
||||
#ifdef CONFIG_LED
|
||||
static bool ata_led_enabled = true;
|
||||
static bool ata_led_on = false;
|
||||
#endif
|
||||
static bool spinup = false;
|
||||
static bool sleeping = true;
|
||||
static long sleep_timeout = 5*HZ;
|
||||
|
@ -475,12 +477,16 @@ static void copy_read_sectors(unsigned char* buf, int wordcount)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_LED
|
||||
static void ata_led(bool on) {
|
||||
ata_led_on = on;
|
||||
if (ata_led_enabled) {
|
||||
led(ata_led_on);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define ata_led(on)
|
||||
#endif
|
||||
|
||||
int ata_read_sectors(IF_MV2(int drive,)
|
||||
unsigned long start,
|
||||
|
@ -1468,6 +1474,7 @@ int ata_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_LED == LED_REAL
|
||||
void ata_set_led_enabled(bool enabled) {
|
||||
ata_led_enabled = enabled;
|
||||
if (ata_led_enabled) {
|
||||
|
@ -1476,3 +1483,4 @@ void ata_set_led_enabled(bool enabled) {
|
|||
led(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,16 +23,11 @@
|
|||
#include "system.h"
|
||||
#include "kernel.h"
|
||||
|
||||
static bool current;
|
||||
|
||||
#ifdef HAVE_LED
|
||||
|
||||
static bool xor;
|
||||
#if CONFIG_LED == LED_REAL
|
||||
|
||||
void led(bool on)
|
||||
{
|
||||
current = on;
|
||||
if ( on ^ xor )
|
||||
if ( on )
|
||||
#ifdef GMINI_ARCH
|
||||
P2 |= 1;
|
||||
else
|
||||
|
@ -48,21 +43,9 @@ void led(bool on)
|
|||
#endif
|
||||
}
|
||||
|
||||
void invert_led(bool on)
|
||||
{
|
||||
if ( on )
|
||||
{
|
||||
xor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xor = 0;
|
||||
}
|
||||
led(current);
|
||||
}
|
||||
|
||||
#else /* no LED, just status update */
|
||||
#elif CONFIG_LED == LED_VIRTUAL
|
||||
|
||||
static bool current;
|
||||
static long last_on; /* timestamp of switching off */
|
||||
|
||||
void led(bool on)
|
||||
|
@ -74,15 +57,10 @@ void led(bool on)
|
|||
current = on;
|
||||
}
|
||||
|
||||
void invert_led(bool on)
|
||||
{
|
||||
(void)on; /* no invert feature */
|
||||
}
|
||||
|
||||
bool led_read(int delayticks) /* read by status bar update */
|
||||
{
|
||||
/* reading "off" is delayed by user-supplied monoflop value */
|
||||
return (current || TIME_BEFORE(current_tick, last_on+delayticks));
|
||||
}
|
||||
|
||||
#endif // #ifdef HAVE_LED
|
||||
#endif /* CONFIG_LED */
|
||||
|
|
|
@ -61,7 +61,9 @@ extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count,
|
|||
extern void ata_delayed_write(unsigned long sector, const void* buf);
|
||||
extern void ata_flush(void);
|
||||
extern void ata_spin(void);
|
||||
#if CONFIG_LED == LED_REAL
|
||||
extern void ata_set_led_enabled(bool enabled);
|
||||
#endif
|
||||
extern unsigned short* ata_get_identify(void);
|
||||
|
||||
extern long last_disk_activity;
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
/* The start address index for ROM builds */
|
||||
#define ROM_START 0x14010
|
||||
|
||||
/* Define this for programmable LED available */
|
||||
#define HAVE_LED
|
||||
/* Software controlled LED */
|
||||
#define CONFIG_LED LED_REAL
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
|
||||
#define GMINI_ARCH
|
||||
|
||||
#define HAVE_LED
|
||||
/* Software controlled LED */
|
||||
#define CONFIG_LED LED_REAL
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
|
||||
#define GMINI_ARCH
|
||||
|
||||
#define HAVE_LED
|
||||
/* Software controlled LED */
|
||||
#define CONFIG_LED LED_REAL
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
|
|
@ -85,6 +85,9 @@
|
|||
/* define this if media can be exchanged on the fly */
|
||||
#define HAVE_HOTSWAP
|
||||
|
||||
/* Virtual LED (icon) */
|
||||
#define CONFIG_LED LED_VIRTUAL
|
||||
|
||||
#define CONFIG_LCD LCD_SSD1815
|
||||
|
||||
#define BOOTFILE_EXT ".ajz"
|
||||
|
|
|
@ -73,6 +73,9 @@
|
|||
/* define this if media can be exchanged on the fly */
|
||||
#define HAVE_HOTSWAP
|
||||
|
||||
/* Virtual LED (icon) */
|
||||
#define CONFIG_LED LED_VIRTUAL
|
||||
|
||||
#define CONFIG_LCD LCD_SSD1815
|
||||
|
||||
#define BOOTFILE_EXT ".ajz"
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
/* The start address index for ROM builds */
|
||||
#define ROM_START 0xD010
|
||||
|
||||
/* Define this for programmable LED available */
|
||||
#define HAVE_LED
|
||||
/* Software controlled LED */
|
||||
#define CONFIG_LED LED_REAL
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
/* The start address index for ROM builds */
|
||||
#define ROM_START 0x11010
|
||||
|
||||
/* Define this for programmable LED available */
|
||||
#define HAVE_LED
|
||||
/* Software controlled LED */
|
||||
#define CONFIG_LED LED_REAL
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
|
||||
|
|
|
@ -67,8 +67,8 @@
|
|||
/* The start address index for ROM builds */
|
||||
#define ROM_START 0x12010
|
||||
|
||||
/* Define this for programmable LED available */
|
||||
#define HAVE_LED
|
||||
/* Software controlled LED */
|
||||
#define CONFIG_LED LED_REAL
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
|
||||
|
|
|
@ -74,6 +74,11 @@
|
|||
#define I2C_GMINI 2 /* Gmini style */
|
||||
#define I2C_H100 3 /* iRiver h100 style */
|
||||
|
||||
/* CONFIG_LED */
|
||||
#define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */
|
||||
#define LED_VIRTUAL 2 /* Virtual LED (icon) (Archos Ondio) */
|
||||
/* else HW controlled LED (iRiver H1x0) */
|
||||
|
||||
/* now go and pick yours */
|
||||
#if defined(ARCHOS_PLAYER)
|
||||
#include "config-player.h"
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
extern void led( bool on );
|
||||
extern void invert_led( bool on );
|
||||
#ifndef HAVE_LED
|
||||
#if CONFIG_LED == LED_VIRTUAL
|
||||
extern bool led_read(int delayticks); /* read for status bar */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -36,7 +36,9 @@ void panicf( const char *fmt, ...)
|
|||
va_list ap;
|
||||
|
||||
#ifndef SIMULATOR
|
||||
#if CONFIG_LED == LED_REAL
|
||||
bool state = false;
|
||||
#endif
|
||||
|
||||
/* Disable interrupts */
|
||||
#if CONFIG_CPU == SH7034
|
||||
|
@ -76,7 +78,7 @@ void panicf( const char *fmt, ...)
|
|||
DEBUGF(panic_buf);
|
||||
while (1)
|
||||
{
|
||||
#ifndef SIMULATOR
|
||||
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
|
||||
volatile long i;
|
||||
led (state);
|
||||
state = state?false:true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue