Added old.t
[kugel-rb.git] / apps / status.c
blob5c5fb3eaa65d1391472f951a3be3ba9b7c54082e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "string.h"
20 #include "lcd.h"
21 #include "debug.h"
22 #include "kernel.h"
23 #include "power.h"
24 #include "thread.h"
25 #include "settings.h"
26 #include "status.h"
27 #include "mp3_playback.h"
28 #include "audio.h"
29 #include "gwps.h"
30 #include "abrepeat.h"
31 #include "statusbar.h"
32 #ifdef CONFIG_RTC
33 #include "timefuncs.h"
34 #endif
35 #ifdef HAVE_LCD_BITMAP
36 #include "icons.h"
37 #include "font.h"
38 #endif
39 #include "powermgmt.h"
40 #include "led.h"
41 #include "sound.h"
42 #if CONFIG_KEYPAD == IRIVER_H100_PAD
43 #include "button.h"
44 #endif
45 #include "usb.h"
46 #ifdef CONFIG_TUNER
47 #include "radio.h"
48 #endif
50 enum playmode ff_mode;
52 long switch_tick;
53 bool battery_state = true;
54 #ifdef HAVE_CHARGING
55 int battery_charge_step = 0;
56 #endif
58 void status_init(void)
60 ff_mode = 0;
63 void status_set_ffmode(enum playmode mode)
65 ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
68 enum playmode status_get_ffmode(void)
70 /* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
71 /* use audio_status() for other modes */
72 return ff_mode;
75 int current_playmode(void)
77 int audio_stat = audio_status();
79 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
80 and that supercedes the other modes */
81 if(ff_mode)
82 return ff_mode;
84 if(audio_stat & AUDIO_STATUS_PLAY)
86 if(audio_stat & AUDIO_STATUS_PAUSE)
87 return STATUS_PAUSE;
88 else
89 return STATUS_PLAY;
91 #if CONFIG_CODEC == MAS3587F
92 else
94 if(audio_stat & AUDIO_STATUS_RECORD)
96 if(audio_stat & AUDIO_STATUS_PAUSE)
97 return STATUS_RECORD_PAUSE;
98 else
99 return STATUS_RECORD;
102 #endif
104 #ifdef CONFIG_TUNER
105 audio_stat = get_radio_status();
107 if(audio_stat == FMRADIO_PLAYING)
108 return STATUS_RADIO;
110 if(audio_stat == FMRADIO_PAUSED)
111 return STATUS_RADIO_PAUSE;
112 #endif
114 return STATUS_STOP;
117 #if defined(HAVE_LCD_CHARCELLS)
118 bool record = false;
119 bool audio = false;
120 bool param = false;
121 bool usb = false;
123 void status_set_record(bool b)
125 record = b;
128 void status_set_audio(bool b)
130 audio = b;
133 void status_set_param(bool b)
135 param = b;
138 void status_set_usb(bool b)
140 usb = b;
143 #endif /* HAVE_LCD_CHARCELLS */