ups: forgot a Makefile.
[kugel-rb.git] / apps / status.c
blobfd89a85e4191fcf93a8495e927ff59a332a5536e
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 "abrepeat.h"
33 #include "statusbar.h"
34 #if CONFIG_RTC
35 #include "timefuncs.h"
36 #endif
37 #ifdef HAVE_LCD_BITMAP
38 #include "icons.h"
39 #include "font.h"
40 #endif
41 #include "powermgmt.h"
42 #include "led.h"
43 #include "sound.h"
44 #if CONFIG_KEYPAD == IRIVER_H100_PAD
45 #include "button.h"
46 #endif
47 #include "usb.h"
48 #if CONFIG_TUNER
49 #include "radio.h"
50 #endif
51 #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
52 #include "pcm_record.h"
53 #endif
55 static enum playmode ff_mode;
57 void status_init(void)
59 ff_mode = 0;
62 void status_set_ffmode(enum playmode mode)
64 ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
67 enum playmode status_get_ffmode(void)
69 /* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
70 /* use audio_status() for other modes */
71 return ff_mode;
74 int current_playmode(void)
76 int audio_stat = audio_status();
78 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
79 and that supercedes the other modes */
80 if(ff_mode)
81 return ff_mode;
83 if(audio_stat & AUDIO_STATUS_PLAY)
85 if(audio_stat & AUDIO_STATUS_PAUSE)
86 return STATUS_PAUSE;
87 else
88 return STATUS_PLAY;
91 #ifdef HAVE_RECORDING
92 if(audio_stat & AUDIO_STATUS_RECORD)
94 if(audio_stat & AUDIO_STATUS_PAUSE)
95 return STATUS_RECORD_PAUSE;
96 else
97 return STATUS_RECORD;
99 #endif
101 #if CONFIG_TUNER
102 audio_stat = get_radio_status();
103 if(audio_stat & FMRADIO_PLAYING)
104 return STATUS_RADIO;
106 if(audio_stat & FMRADIO_PAUSED)
107 return STATUS_RADIO_PAUSE;
108 #endif
110 return STATUS_STOP;
113 #if defined(HAVE_LCD_CHARCELLS)
114 bool record = false;
115 bool audio = false;
116 bool param = false;
117 bool usb = false;
119 void status_set_record(bool b)
121 record = b;
124 void status_set_audio(bool b)
126 audio = b;
129 void status_set_param(bool b)
131 param = b;
134 void status_set_usb(bool b)
136 usb = b;
139 #endif /* HAVE_LCD_CHARCELLS */