Idle poweroff fix for FM radio, as suggested by Mike Holden

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3645 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2003-05-03 15:39:40 +00:00
parent 568baaf81a
commit 23b0fdaca1
4 changed files with 25 additions and 12 deletions

View file

@ -69,7 +69,8 @@ bool radio_screen(void)
lcd_clear_display();
lcd_setmargins(0, 8);
status_draw(false);
fmradio_set_status(FMRADIO_PLAYING);
/* Enable the Left and right A/D Converter */
mas_codec_writereg(0x0, 0xccc7);
@ -182,6 +183,8 @@ bool radio_screen(void)
break;
}
}
fmradio_set_status(0);
return false;
}
#endif

View file

@ -50,17 +50,7 @@
/* delay loop */
#define DELAY do { int _x; for(_x=0;_x<10;_x++);} while (0)
static struct mutex fmradio_mtx;
void fmradio_begin(void)
{
mutex_lock(&fmradio_mtx);
}
void fmradio_end(void)
{
mutex_unlock(&fmradio_mtx);
}
static int fmstatus = 0;
int fmradio_read(int addr)
{
@ -130,4 +120,14 @@ void fmradio_set(int addr, int data)
CE_LO;
}
void fmradio_set_status(int status)
{
fmstatus = status;
}
int fmradio_get_status(void)
{
return fmstatus;
}
#endif

View file

@ -21,5 +21,9 @@
extern int fmradio_read(int addr);
extern void fmradio_set(int addr, int data);
extern void fmradio_set_status(int status);
extern int fmradio_get_status(void);
#define FMRADIO_PLAYING 1
#endif

View file

@ -34,6 +34,9 @@
#include "usb.h"
#include "powermgmt.h"
#include "backlight.h"
#ifdef HAVE_FMRADIO
#include "fmradio.h"
#endif
#ifdef SIMULATOR
@ -299,6 +302,9 @@ static void handle_auto_poweroff(void)
charger_was_inserted = charger_is_inserted;
if(timeout &&
#ifdef HAVE_FMRADIO
!fmradio_get_status() &&
#endif
!usb_inserted() &&
(mpeg_stat == 0 ||
mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))