From 0260852771aef7a6e9045684f0c3d0d7e01909f7 Mon Sep 17 00:00:00 2001 From: Laurent Gautier Date: Tue, 1 Dec 2009 17:54:40 +0000 Subject: Add support for the ipod FM remote to the 4G, Color, 5G, nano 1G with RDS git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23805 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/radio.c | 63 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 7 deletions(-) (limited to 'apps/recorder/radio.c') diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index b70c682922..87614aec15 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -49,6 +49,9 @@ #ifdef HAVE_RECORDING #include "recording.h" #endif +#ifdef IPOD_ACCESSORY_PROTOCOL +#include "iap.h" +#endif #include "talk.h" #include "tuner.h" #include "power.h" @@ -114,6 +117,15 @@ #define FM_MODE #define FM_EXIT #define FM_PLAY + +#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ + (CONFIG_KEYPAD == IPOD_1G2G_PAD) +#define FM_MENU +#define FM_STOP +#define FM_EXIT +#define FM_PLAY +#define FM_MODE + #endif #define RADIO_SCAN_MODE 0 @@ -586,7 +598,6 @@ int radio_screen(void) end_search(); talk = true; } - trigger_cpu_boost(); } @@ -873,6 +884,33 @@ int radio_screen(void) default: default_event_handler(button); +#ifdef HAVE_RDS_CAP + if (tuner_get(RADIO_EVENT)) + update_screen = true; +#endif + if (!tuner_get(RADIO_PRESENT)) + { +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) + if(audio_status() == AUDIO_STATUS_RECORD) + audio_stop(); +#endif + keep_playing = false; + done = true; + ret_val = GO_TO_ROOT; + if(presets_changed) + { + if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) + { + if(filepreset[0] == '\0') + save_preset_list(); + else + radio_save_presets(); + } + } + + /* Clear the preset list on exit. */ + clear_preset_list(); + } break; } /*switch(button)*/ @@ -895,11 +933,11 @@ int radio_screen(void) { screens[i].set_viewport(&vp[i]); peak_meter_screen(&screens[i],0, - STATUSBAR_HEIGHT + fh*(top_of_screen + 4), - fh); + STATUSBAR_HEIGHT + fh*(top_of_screen + 4), + fh); screens[i].update_rect(0, - STATUSBAR_HEIGHT + fh*(top_of_screen + 4), - screens[i].getwidth(), fh); + STATUSBAR_HEIGHT + fh*(top_of_screen + 4), + screens[i].getwidth(), fh); screens[i].set_viewport(NULL); } } @@ -963,7 +1001,18 @@ int radio_screen(void) str(LANG_RADIO_SCAN_MODE)); FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen + 3, buf); +#ifndef SIMULATOR +#ifdef HAVE_RDS_CAP + snprintf(buf, 128, "%s",tuner_get_rds_info(RADIO_RDS_NAME)); + FOR_NB_SCREENS(i) + screens[i].puts_scroll(0, top_of_screen + 4, buf); + snprintf(buf, 128, "%s",tuner_get_rds_info(RADIO_RDS_TEXT)); + FOR_NB_SCREENS(i) + screens[i].puts_scroll(0, top_of_screen + 5, buf); +#endif +#endif /* SIMULATOR */ + #if CONFIG_CODEC != SWCODEC if(audio_status() == AUDIO_STATUS_RECORD) { @@ -1498,6 +1547,7 @@ static int scan_presets(void *viewports) curr_freq = fmr->freq_min; num_presets = 0; memset(presets, 0, sizeof(presets)); + tuner_set(RADIO_MUTE, 1); while(curr_freq <= fmr->freq_max) @@ -1563,7 +1613,6 @@ static int fm_recording_screen(void) /* switch recording source to FMRADIO for the duration */ int rec_source = global_settings.rec_source; global_settings.rec_source = AUDIO_SRC_FMRADIO; - ret = recording_screen(true); /* safe to reset as changing sources is prohibited here */ @@ -1649,7 +1698,7 @@ MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, static bool radio_menu(void) { return do_menu(&radio_settings_menu, NULL, NULL, false) == - MENU_ATTACHED_USB; + MENU_ATTACHED_USB; } #endif -- cgit