forked from len0rd/rockbox
Automatic detection of FM radio hardware for V2 recorders
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4165 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
47f6cb30ee
commit
ef8fd8e533
3 changed files with 61 additions and 17 deletions
|
@ -266,34 +266,65 @@ bool main_menu(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
bool result;
|
bool result;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
/* main menu */
|
/* main menu */
|
||||||
struct menu_items items[] = {
|
struct menu_items items[14];
|
||||||
{ str(LANG_SOUND_SETTINGS), sound_menu },
|
|
||||||
{ str(LANG_GENERAL_SETTINGS), settings_menu },
|
items[i].desc = str(LANG_SOUND_SETTINGS);
|
||||||
|
items[i++].function = sound_menu;
|
||||||
|
|
||||||
|
items[i].desc = str(LANG_GENERAL_SETTINGS);
|
||||||
|
items[i++].function = settings_menu;
|
||||||
|
|
||||||
#ifdef HAVE_FMRADIO
|
#ifdef HAVE_FMRADIO
|
||||||
{ str(LANG_FM_RADIO), radio_screen },
|
if(radio_hardware_present()) {
|
||||||
|
items[i].desc = str(LANG_FM_RADIO);
|
||||||
|
items[i++].function = radio_screen;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MAS3587F
|
#ifdef HAVE_MAS3587F
|
||||||
{ str(LANG_RECORDING), recording_screen },
|
items[i].desc = str(LANG_RECORDING);
|
||||||
{ str(LANG_RECORDING_SETTINGS), recording_settings},
|
items[i++].function = recording_screen;
|
||||||
|
|
||||||
|
items[i].desc = str(LANG_RECORDING_SETTINGS);
|
||||||
|
items[i++].function = recording_settings;
|
||||||
#endif
|
#endif
|
||||||
{ str(LANG_PLAYLIST_MENU), playlist_menu },
|
|
||||||
{ str(LANG_MENU_SHOW_ID3_INFO), browse_id3 },
|
items[i].desc = str(LANG_PLAYLIST_MENU);
|
||||||
{ str(LANG_SLEEP_TIMER), sleeptimer_screen },
|
items[i++].function = playlist_menu;
|
||||||
|
|
||||||
|
items[i].desc = str(LANG_MENU_SHOW_ID3_INFO);
|
||||||
|
items[i++].function = browse_id3;
|
||||||
|
|
||||||
|
items[i].desc = str(LANG_SLEEP_TIMER);
|
||||||
|
items[i++].function = sleeptimer_screen;
|
||||||
|
|
||||||
#ifdef HAVE_ALARM_MOD
|
#ifdef HAVE_ALARM_MOD
|
||||||
{ str(LANG_ALARM_MOD_ALARM_MENU), alarm_screen },
|
items[i].desc = str(LANG_ALARM_MOD_ALARM_MENU);
|
||||||
|
items[i++].function = alarm_screen;
|
||||||
#endif
|
#endif
|
||||||
{ str(LANG_PLUGINS), plugin_browse },
|
|
||||||
{ str(LANG_FIRMWARE), firmware_browse },
|
items[i].desc = str(LANG_PLUGINS);
|
||||||
{ str(LANG_INFO), show_info },
|
items[i++].function = plugin_browse;
|
||||||
{ str(LANG_VERSION), show_credits },
|
|
||||||
|
items[i].desc = str(LANG_FIRMWARE);
|
||||||
|
items[i++].function = firmware_browse;
|
||||||
|
|
||||||
|
items[i].desc = str(LANG_INFO);
|
||||||
|
items[i++].function = show_info;
|
||||||
|
|
||||||
|
items[i].desc = str(LANG_VERSION);
|
||||||
|
items[i++].function = show_credits;
|
||||||
|
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
{ str(LANG_DEBUG), debug_menu },
|
items[i].desc = str(LANG_DEBUG);
|
||||||
|
items[i++].function = debug_menu;
|
||||||
#else
|
#else
|
||||||
{ str(LANG_USB), simulate_usb },
|
items[i].desc = str(LANG_USB);
|
||||||
|
items[i++].function = simulate_usb;
|
||||||
#endif
|
#endif
|
||||||
};
|
|
||||||
|
|
||||||
m=menu_init( items, sizeof items / sizeof(struct menu_items) );
|
m=menu_init( items, sizeof items / sizeof(struct menu_items) );
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
|
|
@ -74,6 +74,18 @@ void radio_stop(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool radio_hardware_present(void)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
|
||||||
|
fmradio_set(2, 0x140885); /* 5kHz, 7.2MHz crystal, test mode 1 */
|
||||||
|
val = fmradio_read(0);
|
||||||
|
if(val == 0x140885)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void radio_set_frequency(int freq)
|
void radio_set_frequency(int freq)
|
||||||
{
|
{
|
||||||
/* We add the standard Intermediate Frequency 10.7MHz before calculating
|
/* We add the standard Intermediate Frequency 10.7MHz before calculating
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#ifdef HAVE_FMRADIO
|
#ifdef HAVE_FMRADIO
|
||||||
bool radio_screen(void);
|
bool radio_screen(void);
|
||||||
void radio_stop(void);
|
void radio_stop(void);
|
||||||
|
bool radio_hardware_present(void);
|
||||||
|
|
||||||
struct fmstation
|
struct fmstation
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue