Added a debug option for the FM radio detection

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4293 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-02-04 09:53:22 +00:00
parent facfec0c77
commit 04f9cc7993
2 changed files with 48 additions and 1 deletions

View file

@ -42,6 +42,7 @@
#include "settings.h"
#include "ata.h"
#include "fat.h"
#include "radio.h"
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
#include "peakmeter.h"
@ -1377,6 +1378,46 @@ bool dbg_save_roms(void)
return false;
}
#ifdef HAVE_FMRADIO
extern int debug_fm_detection;
bool dbg_fm_radio(void)
{
char buf[32];
int button;
bool fm_detected;
#ifdef HAVE_LCD_BITMAP
lcd_setmargins(0, 0);
#endif
while(1)
{
lcd_clear_display();
fm_detected = radio_hardware_present();
snprintf(buf, sizeof buf, "HW detected: %s", fm_detected?"yes":"no");
lcd_puts(0, 0, buf);
snprintf(buf, sizeof buf, "Result: %08x", debug_fm_detection);
lcd_puts(0, 1, buf);
lcd_update();
button = button_get(true);
switch(button)
{
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
#else
case BUTTON_STOP:
#endif
return false;
}
}
return false;
}
#endif
bool debug_menu(void)
{
int m;
@ -1411,6 +1452,9 @@ bool debug_menu(void)
#endif /* PM_DEBUG */
#endif /* HAVE_LCD_BITMAP */
{ "View runtime", view_runtime },
#ifdef HAVE_FMRADIO
{ "FM Radio", dbg_fm_radio },
#endif
};
m=menu_init( items, sizeof items / sizeof(struct menu_items) );

View file

@ -64,6 +64,8 @@ static struct fmstation presets[MAX_PRESETS];
static char default_filename[] = "/.rockbox/fm-presets-default.fmr";
int debug_fm_detection;
void radio_load_presets(void);
bool radio_preset_select(void);
bool radio_menu(void);
@ -81,6 +83,7 @@ bool radio_hardware_present(void)
fmradio_set(2, 0x140885); /* 5kHz, 7.2MHz crystal, test mode 1 */
val = fmradio_read(0);
debug_fm_detection = val;
if(val == 0x140885)
return true;
else
@ -554,7 +557,7 @@ void radio_load_presets(void)
if(fd >= 0)
{
i = 0;
while(!done)
while(!done && num_presets < MAX_PRESETS)
{
rc = read_line(fd, buf, 128);
if(rc > 0)