2002-07-22 22:41:32 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2003-04-23 11:26:25 +00:00
|
|
|
#include "string.h"
|
2002-07-22 22:41:32 +00:00
|
|
|
#include "lcd.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "status.h"
|
2004-01-05 20:42:51 +00:00
|
|
|
#include "mp3_playback.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2005-11-17 20:14:59 +00:00
|
|
|
#include "gwps.h"
|
2005-08-21 23:01:12 +00:00
|
|
|
#include "abrepeat.h"
|
2005-11-20 01:02:14 +00:00
|
|
|
#include "statusbar.h"
|
2005-12-04 15:23:47 +00:00
|
|
|
#ifdef CONFIG_RTC
|
2003-01-27 14:24:40 +00:00
|
|
|
#include "timefuncs.h"
|
2002-08-30 00:58:55 +00:00
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#include "icons.h"
|
2003-11-04 13:17:29 +00:00
|
|
|
#include "font.h"
|
2002-08-07 10:35:26 +00:00
|
|
|
#endif
|
2002-08-07 11:41:31 +00:00
|
|
|
#include "powermgmt.h"
|
2005-02-19 00:34:15 +00:00
|
|
|
#include "led.h"
|
2005-04-01 13:41:03 +00:00
|
|
|
#include "sound.h"
|
2005-04-19 11:34:22 +00:00
|
|
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
|
|
|
#include "button.h"
|
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
#include "usb.h"
|
2005-11-19 19:50:04 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
#include "radio.h"
|
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
|
2005-10-28 00:00:00 +00:00
|
|
|
enum playmode ff_mode;
|
2002-07-22 22:41:32 +00:00
|
|
|
|
|
|
|
void status_init(void)
|
|
|
|
{
|
2004-06-27 01:05:40 +00:00
|
|
|
ff_mode = 0;
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
void status_set_ffmode(enum playmode mode)
|
2002-07-22 22:41:32 +00:00
|
|
|
{
|
2004-06-27 01:05:40 +00:00
|
|
|
ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
|
|
|
|
2005-08-21 19:17:50 +00:00
|
|
|
enum playmode status_get_ffmode(void)
|
|
|
|
{
|
|
|
|
/* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
|
|
|
|
/* use audio_status() for other modes */
|
|
|
|
return ff_mode;
|
|
|
|
}
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
int current_playmode(void)
|
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
int audio_stat = audio_status();
|
2004-06-27 01:05:40 +00:00
|
|
|
|
|
|
|
/* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
|
|
|
|
and that supercedes the other modes */
|
|
|
|
if(ff_mode)
|
|
|
|
return ff_mode;
|
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PLAY)
|
2004-06-27 01:05:40 +00:00
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
2004-06-27 01:05:40 +00:00
|
|
|
return STATUS_PAUSE;
|
|
|
|
else
|
|
|
|
return STATUS_PLAY;
|
|
|
|
}
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == MAS3587F
|
2004-06-27 01:05:40 +00:00
|
|
|
else
|
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
2004-06-27 01:05:40 +00:00
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
2004-06-27 01:05:40 +00:00
|
|
|
return STATUS_RECORD_PAUSE;
|
|
|
|
else
|
|
|
|
return STATUS_RECORD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2005-11-19 19:50:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
audio_stat = get_radio_status();
|
|
|
|
|
|
|
|
if(audio_stat == FMRADIO_PLAYING)
|
2005-11-19 20:45:32 +00:00
|
|
|
return STATUS_RADIO;
|
2005-11-19 19:50:04 +00:00
|
|
|
|
|
|
|
if(audio_stat == FMRADIO_PAUSED)
|
2005-11-19 20:45:32 +00:00
|
|
|
return STATUS_RADIO_PAUSE;
|
2005-11-19 19:50:04 +00:00
|
|
|
#endif
|
2004-06-27 01:05:40 +00:00
|
|
|
|
|
|
|
return STATUS_STOP;
|
|
|
|
}
|
|
|
|
|
2002-10-15 12:53:33 +00:00
|
|
|
#if defined(HAVE_LCD_CHARCELLS)
|
2005-10-28 00:00:00 +00:00
|
|
|
bool record = false;
|
|
|
|
bool audio = false;
|
|
|
|
bool param = false;
|
|
|
|
bool usb = false;
|
2002-10-15 12:53:33 +00:00
|
|
|
|
|
|
|
void status_set_record(bool b)
|
|
|
|
{
|
|
|
|
record = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_set_audio(bool b)
|
|
|
|
{
|
|
|
|
audio = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_set_param(bool b)
|
|
|
|
{
|
|
|
|
param = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_set_usb(bool b)
|
|
|
|
{
|
|
|
|
usb = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAVE_LCD_CHARCELLS */
|