diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-12-19 01:24:02 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-12-19 01:24:02 +0000 |
commit | ef8fd8e53327c042c2444eef7f0d61ee616dd01c (patch) | |
tree | 0b719812d7a666d2031f0f7bd14494050a483d49 /apps | |
parent | 47f6cb30ee2333d64b6470317cf378d10b38c0f2 (diff) |
Automatic detection of FM radio hardware for V2 recorders
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4165 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/main_menu.c | 65 | ||||
-rw-r--r-- | apps/recorder/radio.c | 12 | ||||
-rw-r--r-- | apps/recorder/radio.h | 1 |
3 files changed, 61 insertions, 17 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c index 8a657f90f6..c1faf815fe 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -266,34 +266,65 @@ bool main_menu(void) { int m; bool result; + int i = 0; /* main menu */ - struct menu_items items[] = { - { str(LANG_SOUND_SETTINGS), sound_menu }, - { str(LANG_GENERAL_SETTINGS), settings_menu }, + struct menu_items items[14]; + + 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 - { str(LANG_FM_RADIO), radio_screen }, + if(radio_hardware_present()) { + items[i].desc = str(LANG_FM_RADIO); + items[i++].function = radio_screen; + } #endif + #ifdef HAVE_MAS3587F - { str(LANG_RECORDING), recording_screen }, - { str(LANG_RECORDING_SETTINGS), recording_settings}, + items[i].desc = str(LANG_RECORDING); + items[i++].function = recording_screen; + + items[i].desc = str(LANG_RECORDING_SETTINGS); + items[i++].function = recording_settings; #endif - { str(LANG_PLAYLIST_MENU), playlist_menu }, - { str(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, - { str(LANG_SLEEP_TIMER), sleeptimer_screen }, + + items[i].desc = str(LANG_PLAYLIST_MENU); + 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 - { str(LANG_ALARM_MOD_ALARM_MENU), alarm_screen }, + items[i].desc = str(LANG_ALARM_MOD_ALARM_MENU); + items[i++].function = alarm_screen; #endif - { str(LANG_PLUGINS), plugin_browse }, - { str(LANG_FIRMWARE), firmware_browse }, - { str(LANG_INFO), show_info }, - { str(LANG_VERSION), show_credits }, + + items[i].desc = str(LANG_PLUGINS); + items[i++].function = plugin_browse; + + 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 - { str(LANG_DEBUG), debug_menu }, + items[i].desc = str(LANG_DEBUG); + items[i++].function = debug_menu; #else - { str(LANG_USB), simulate_usb }, + items[i].desc = str(LANG_USB); + items[i++].function = simulate_usb; #endif - }; m=menu_init( items, sizeof items / sizeof(struct menu_items) ); #ifdef HAVE_LCD_CHARCELLS diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 0459ff3d74..ab0c1eb004 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -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) { /* We add the standard Intermediate Frequency 10.7MHz before calculating diff --git a/apps/recorder/radio.h b/apps/recorder/radio.h index 45942a9990..5ddbf13d6b 100644 --- a/apps/recorder/radio.h +++ b/apps/recorder/radio.h @@ -22,6 +22,7 @@ #ifdef HAVE_FMRADIO bool radio_screen(void); void radio_stop(void); +bool radio_hardware_present(void); struct fmstation { |