summaryrefslogtreecommitdiff
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 @@
25 25
26#include "system.h" 26#include "system.h"
27#include "lcd.h" 27#include "lcd.h"
28#include "led.h"
28#include "mpeg.h" 29#include "mpeg.h"
29#include "mp3_playback.h" 30#include "mp3_playback.h"
30#include "mas.h" 31#include "mas.h"
@@ -179,6 +180,8 @@ bool recording_screen(void)
179 int hours, minutes; 180 int hours, minutes;
180 char path_buffer[MAX_PATH]; 181 char path_buffer[MAX_PATH];
181 bool been_in_usb_mode = false; 182 bool been_in_usb_mode = false;
183 bool led_state;
184 int led_delay;
182 185
183 cursor = 0; 186 cursor = 0;
184 mpeg_init_recording(); 187 mpeg_init_recording();
@@ -210,9 +213,34 @@ bool recording_screen(void)
210 213
211 if(rec_create_directory() > 0) 214 if(rec_create_directory() > 0)
212 have_recorded = true; 215 have_recorded = true;
216
217 led_state = false;
218 led_delay = 0;
213 219
214 while(!done) 220 while(!done)
215 { 221 {
222 /*
223 * Flash the LED while waiting to record. Turn it on while
224 * recording.
225 */
226 if(mpeg_status() != MPEG_STATUS_RECORD)
227 {
228 if(led_delay++ >= 4)
229 {
230 led_state = !led_state;
231 invert_led(led_state);
232 led_delay = 0;
233 }
234 }
235 else
236 {
237 if(!led_state)
238 {
239 led_state = true;
240 invert_led(true);
241 }
242 }
243
216 button = button_get_w_tmo(HZ / peak_meter_fps); 244 button = button_get_w_tmo(HZ / peak_meter_fps);
217 switch(button) 245 switch(button)
218 { 246 {
@@ -565,7 +593,6 @@ bool recording_screen(void)
565 done = true; 593 done = true;
566 } 594 }
567 } 595 }
568
569 if(mpeg_status() & MPEG_STATUS_ERROR) 596 if(mpeg_status() & MPEG_STATUS_ERROR)
570 { 597 {
571 status_set_playmode(STATUS_STOP); 598 status_set_playmode(STATUS_STOP);
@@ -582,6 +609,8 @@ bool recording_screen(void)
582 } 609 }
583 } 610 }
584 611
612 invert_led(false);
613
585 mpeg_init_playback(); 614 mpeg_init_playback();
586 615
587 mpeg_sound_channel_config(global_settings.channel_config); 616 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
85Matthias Wientapper 85Matthias Wientapper
86Brent Coutts 86Brent Coutts
87Jens Arnold 87Jens Arnold
88Gerald 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 @@
22#include "led.h" 22#include "led.h"
23#include "system.h" 23#include "system.h"
24 24
25static bool xor;
26static bool current;
27
25void led(bool on) 28void led(bool on)
26{ 29{
27 if ( on ) 30 current = on;
31 if ( on ^ xor )
28 { 32 {
29 or_b(0x40, &PBDRL); 33 or_b(0x40, &PBDRL);
30 } 34 }
@@ -33,3 +37,17 @@ void led(bool on)
33 and_b(~0x40, &PBDRL); 37 and_b(~0x40, &PBDRL);
34 } 38 }
35} 39}
40
41void invert_led(bool on)
42{
43 if ( on )
44 {
45 xor = 1;
46 }
47 else
48 {
49 xor = 0;
50 }
51 led(current);
52}
53
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 @@
23#include <stdbool.h> 23#include <stdbool.h>
24 24
25extern void led( bool on ); 25extern void led( bool on );
26extern void invert_led( bool on );
26 27
27#endif 28#endif