Fix red introduced with r20610.
[kugel-rb/myfork.git] / apps / status.c
blob3fc2995c5806944b1ac24e1b93d1a4e477aaf70d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include "string.h"
22 #include "lcd.h"
23 #include "debug.h"
24 #include "kernel.h"
25 #include "power.h"
26 #include "thread.h"
27 #include "settings.h"
28 #include "status.h"
29 #include "mp3_playback.h"
30 #include "audio.h"
31 #include "gwps.h"
32 #include "statusbar.h"
33 #if CONFIG_RTC
34 #include "timefuncs.h"
35 #endif
36 #ifdef HAVE_LCD_BITMAP
37 #include "icons.h"
38 #include "font.h"
39 #endif
40 #include "powermgmt.h"
41 #include "led.h"
42 #include "sound.h"
43 #if CONFIG_KEYPAD == IRIVER_H100_PAD
44 #include "button.h"
45 #endif
46 #include "usb.h"
47 #if CONFIG_TUNER
48 #include "radio.h"
49 #endif
50 #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
51 #include "pcm_record.h"
52 #endif
54 static enum playmode ff_mode;
56 void status_init(void)
58 ff_mode = 0;
61 void status_set_ffmode(enum playmode mode)
63 ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
66 enum playmode status_get_ffmode(void)
68 /* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
69 /* use audio_status() for other modes */
70 return ff_mode;
73 int current_playmode(void)
75 int audio_stat = audio_status();
77 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
78 and that supercedes the other modes */
79 if(ff_mode)
80 return ff_mode;
82 if(audio_stat & AUDIO_STATUS_PLAY)
84 if(audio_stat & AUDIO_STATUS_PAUSE)
85 return STATUS_PAUSE;
86 else
87 return STATUS_PLAY;
90 #ifdef HAVE_RECORDING
91 if(audio_stat & AUDIO_STATUS_RECORD)
93 if(audio_stat & AUDIO_STATUS_PAUSE)
94 return STATUS_RECORD_PAUSE;
95 else
96 return STATUS_RECORD;
98 #endif
100 #if CONFIG_TUNER
101 audio_stat = get_radio_status();
102 if(audio_stat & FMRADIO_PLAYING)
103 return STATUS_RADIO;
105 if(audio_stat & FMRADIO_PAUSED)
106 return STATUS_RADIO_PAUSE;
107 #endif
109 return STATUS_STOP;
112 #if defined(HAVE_LCD_CHARCELLS)
113 bool record = false;
114 bool audio = false;
115 bool param = false;
116 bool usb = false;
118 void status_set_record(bool b)
120 record = b;
123 void status_set_audio(bool b)
125 audio = b;
128 void status_set_param(bool b)
130 param = b;
133 void status_set_usb(bool b)
135 usb = b;
138 #endif /* HAVE_LCD_CHARCELLS */