summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-06-22 10:52:39 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-06-22 10:52:39 +0000
commitfafd2093e3ddaaabeb1a65e8a27e4a749f5edd15 (patch)
tree5c4e912fbc96588b485ea7eade04f4dd45ef1b1f
parent5c8a2f5835f0980f7d1646c6c9288235b7e3499b (diff)
downloadrockbox-fafd2093e3ddaaabeb1a65e8a27e4a749f5edd15.tar.gz
rockbox-fafd2093e3ddaaabeb1a65e8a27e4a749f5edd15.zip
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
-rw-r--r--apps/recorder/recording.c31
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/drivers/led.c20
-rw-r--r--firmware/export/led.h1
4 files changed, 51 insertions, 2 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 2cef11ae13..86b4a46a52 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -25,6 +25,7 @@
#include "system.h"
#include "lcd.h"
+#include "led.h"
#include "mpeg.h"
#include "mp3_playback.h"
#include "mas.h"
@@ -179,6 +180,8 @@ bool recording_screen(void)
int hours, minutes;
char path_buffer[MAX_PATH];
bool been_in_usb_mode = false;
+ bool led_state;
+ int led_delay;
cursor = 0;
mpeg_init_recording();
@@ -210,9 +213,34 @@ bool recording_screen(void)
if(rec_create_directory() > 0)
have_recorded = true;
+
+ led_state = false;
+ led_delay = 0;
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);
switch(button)
{
@@ -565,7 +593,6 @@ bool recording_screen(void)
done = true;
}
}
-
if(mpeg_status() & MPEG_STATUS_ERROR)
{
status_set_playmode(STATUS_STOP);
@@ -582,6 +609,8 @@ bool recording_screen(void)
}
}
+ invert_led(false);
+
mpeg_init_playback();
mpeg_sound_channel_config(global_settings.channel_config);
diff --git a/docs/CREDITS b/docs/CREDITS
index 30c4ed2900..0bd693381d 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -85,3 +85,4 @@ Francois Boucher
Matthias Wientapper
Brent Coutts
Jens Arnold
+Gerald Vanbaren
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index adeb2714e0..f3b0693c6d 100644
--- a/firmware/drivers/led.c
+++ b/firmware/drivers/led.c
@@ -22,9 +22,13 @@
#include "led.h"
#include "system.h"
+static bool xor;
+static bool current;
+
void led(bool on)
{
- if ( on )
+ current = on;
+ if ( on ^ xor )
{
or_b(0x40, &PBDRL);
}
@@ -33,3 +37,17 @@ void led(bool on)
and_b(~0x40, &PBDRL);
}
}
+
+void invert_led(bool on)
+{
+ if ( on )
+ {
+ xor = 1;
+ }
+ else
+ {
+ xor = 0;
+ }
+ led(current);
+}
+
diff --git a/firmware/export/led.h b/firmware/export/led.h
index 9b2552f738..cc035b9345 100644
--- a/firmware/export/led.h
+++ b/firmware/export/led.h
@@ -23,5 +23,6 @@
#include <stdbool.h>
extern void led( bool on );
+extern void invert_led( bool on );
#endif