Patch #881887 by Gerald Vanbaren. The red LED is now ON when recording and blinking when waiting to record (and when paused).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4790 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-06-22 10:52:39 +00:00
parent 5c8a2f5835
commit fafd2093e3
4 changed files with 51 additions and 2 deletions

View file

@ -25,6 +25,7 @@
#include "system.h" #include "system.h"
#include "lcd.h" #include "lcd.h"
#include "led.h"
#include "mpeg.h" #include "mpeg.h"
#include "mp3_playback.h" #include "mp3_playback.h"
#include "mas.h" #include "mas.h"
@ -179,6 +180,8 @@ bool recording_screen(void)
int hours, minutes; int hours, minutes;
char path_buffer[MAX_PATH]; char path_buffer[MAX_PATH];
bool been_in_usb_mode = false; bool been_in_usb_mode = false;
bool led_state;
int led_delay;
cursor = 0; cursor = 0;
mpeg_init_recording(); mpeg_init_recording();
@ -211,8 +214,33 @@ bool recording_screen(void)
if(rec_create_directory() > 0) if(rec_create_directory() > 0)
have_recorded = true; have_recorded = true;
led_state = false;
led_delay = 0;
while(!done) while(!done)
{ {
/*
* Flash the LED while waiting to record. Turn it on while
* recording.
*/
if(mpeg_status() != MPEG_STATUS_RECORD)
{
if(led_delay++ >= 4)
{
led_state = !led_state;
invert_led(led_state);
led_delay = 0;
}
}
else
{
if(!led_state)
{
led_state = true;
invert_led(true);
}
}
button = button_get_w_tmo(HZ / peak_meter_fps); button = button_get_w_tmo(HZ / peak_meter_fps);
switch(button) switch(button)
{ {
@ -565,7 +593,6 @@ bool recording_screen(void)
done = true; done = true;
} }
} }
if(mpeg_status() & MPEG_STATUS_ERROR) if(mpeg_status() & MPEG_STATUS_ERROR)
{ {
status_set_playmode(STATUS_STOP); status_set_playmode(STATUS_STOP);
@ -582,6 +609,8 @@ bool recording_screen(void)
} }
} }
invert_led(false);
mpeg_init_playback(); mpeg_init_playback();
mpeg_sound_channel_config(global_settings.channel_config); mpeg_sound_channel_config(global_settings.channel_config);

View file

@ -85,3 +85,4 @@ Francois Boucher
Matthias Wientapper Matthias Wientapper
Brent Coutts Brent Coutts
Jens Arnold Jens Arnold
Gerald Vanbaren

View file

@ -22,9 +22,13 @@
#include "led.h" #include "led.h"
#include "system.h" #include "system.h"
static bool xor;
static bool current;
void led(bool on) void led(bool on)
{ {
if ( on ) current = on;
if ( on ^ xor )
{ {
or_b(0x40, &PBDRL); or_b(0x40, &PBDRL);
} }
@ -33,3 +37,17 @@ void led(bool on)
and_b(~0x40, &PBDRL); and_b(~0x40, &PBDRL);
} }
} }
void invert_led(bool on)
{
if ( on )
{
xor = 1;
}
else
{
xor = 0;
}
led(current);
}

View file

@ -23,5 +23,6 @@
#include <stdbool.h> #include <stdbool.h>
extern void led( bool on ); extern void led( bool on );
extern void invert_led( bool on );
#endif #endif