From adc472bec522e5b8bd34302cb3267cfb9a12d12c Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Mon, 26 Jul 2010 20:15:16 +0000 Subject: FM tuner region code cleanup - FS #11492 by me. This removes the tuner-specific region structs and makes each driver use the common one (which is now extended with a deemphasis field) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27579 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/tuner/ipod_remote_tuner.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'firmware/drivers/tuner/ipod_remote_tuner.c') diff --git a/firmware/drivers/tuner/ipod_remote_tuner.c b/firmware/drivers/tuner/ipod_remote_tuner.c index 25ad2d9845..52d93b8b34 100644 --- a/firmware/drivers/tuner/ipod_remote_tuner.c +++ b/firmware/drivers/tuner/ipod_remote_tuner.c @@ -177,8 +177,9 @@ void rmt_tuner_region(int region) { if (region != old_region) { + const struct fm_region_data *rd = &fm_region_data[region]; unsigned char data[] = {0x07, 0x08, 0x00}; - if (region == 2) + if (rd->freq_min == 76000000) { data[2] = 0x02; /* japan band */ } @@ -378,12 +379,14 @@ int ipod_rmt_tuner_set(int setting, int value) case RADIO_REGION: { - const struct rmt_tuner_region_data *rd = - &rmt_tuner_region_data[value]; - - rmt_tuner_region(rd->band); - set_deltafreq(rd->spacing); - set_deemphasis(rd->deemphasis); + const struct fm_region_data *rd = &fm_region_data[value]; + int band = (rd->freq_min == 76000000) ? 2 : 0; + int spacing = (100000 / rd->freq_step); + int deemphasis = (rd->deemphasis == 50) ? 1 : 0; + + rmt_tuner_region(band); + set_deltafreq(spacing); + set_deemphasis(deemphasis); rmt_tuner_set_param(tuner_param); break; } -- cgit v1.2.3