diff options
| author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-10-18 07:58:59 +0000 |
|---|---|---|
| committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-10-18 07:58:59 +0000 |
| commit | 6694212a6f2eda4bd70933ddabbc0243652f32d1 (patch) | |
| tree | e91ae3ca579873c1463d5b623a8d9899aa578568 | |
| parent | d8426965a2284fc47bc6e1d9f932d0a9fb1a90ac (diff) | |
| download | rockbox-6694212a6f2eda4bd70933ddabbc0243652f32d1.zip rockbox-6694212a6f2eda4bd70933ddabbc0243652f32d1.tar.gz rockbox-6694212a6f2eda4bd70933ddabbc0243652f32d1.tar.bz2 rockbox-6694212a6f2eda4bd70933ddabbc0243652f32d1.tar.xz | |
minor touchup, to make the tuner interface independent from the IF
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5302 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/recorder/radio.c | 9 | ||||
| -rw-r--r-- | firmware/export/tuner.h | 2 | ||||
| -rw-r--r-- | firmware/tuner_philips.c | 21 | ||||
| -rw-r--r-- | firmware/tuner_samsung.c | 4 |
4 files changed, 17 insertions, 19 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 9eac63a..d60d1bd 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -20,6 +20,7 @@ #include "config.h" #include <stdio.h> #include <stdbool.h> +#include <stdlib.h> #include "sprintf.h" #include "lcd.h" #include "mas.h" @@ -160,7 +161,7 @@ bool radio_screen(void) bool done = false; int button; int freq; - int i_freq; + int freq_diff; bool stereo = false; int search_dir = 0; int fw, fh; @@ -254,10 +255,10 @@ bool radio_screen(void) sleep(1); /* Now check how close to the IF frequency we are */ - i_freq = radio_get(RADIO_IF_MEASURED); + freq_diff = radio_get(RADIO_DEVIATION); - /* Stop searching if the IF frequency is close to 10.7MHz */ - if(i_freq > 1065 && i_freq < 1075) + /* Stop searching if the tuning is close */ + if(abs(freq_diff) < 50) { search_dir = 0; curr_preset = find_preset(curr_freq); diff --git a/firmware/export/tuner.h b/firmware/export/tuner.h index ae31c6d..c399bb3 100644 --- a/firmware/export/tuner.h +++ b/firmware/export/tuner.h @@ -29,7 +29,7 @@ #define RADIO_FORCE_MONO 5 /* readback from the tuner layer */ #define RADIO_PRESENT 0 -#define RADIO_IF_MEASURED 1 +#define RADIO_DEVIATION 1 #define RADIO_STEREO 2 #ifdef CONFIG_TUNER diff --git a/firmware/tuner_philips.c b/firmware/tuner_philips.c index e63d063..3fdf0f7 100644 --- a/firmware/tuner_philips.c +++ b/firmware/tuner_philips.c @@ -29,7 +29,6 @@ static unsigned char write_bytes[5]; /* tuner abstraction layer: set something to the tuner */ void philips_set(int setting, int value) { - (void)value; switch(setting) { case RADIO_INIT: @@ -42,33 +41,31 @@ void philips_set(int setting, int value) n = (4 * (value - 225000)) / 50000; write_bytes[0] = (write_bytes[0] & 0xC0) | (n >> 8); write_bytes[1] = n & 0xFF; - fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes)); } break; case RADIO_MUTE: write_bytes[0] = (write_bytes[0] & 0x7F) | (value ? 0x80 : 0); - fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes)); - break; - - case RADIO_IF_MEASUREMENT: - break; - - case RADIO_SENSITIVITY: break; case RADIO_FORCE_MONO: write_bytes[2] = (write_bytes[2] & 0xF7) | (value ? 0x08 : 0); fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes)); break; + + case RADIO_IF_MEASUREMENT: + case RADIO_SENSITIVITY: + default: + return; } + fmradio_i2c_write(I2C_ADR, write_bytes, sizeof(write_bytes)); } /* tuner abstraction layer: read something from the tuner */ int philips_get(int setting) { unsigned char read_bytes[5]; - int val = -1; + int val = -1; /* default for unsupported query */ fmradio_i2c_read(I2C_ADR, read_bytes, sizeof(read_bytes)); @@ -78,9 +75,9 @@ int philips_get(int setting) val = 1; /* true */ break; - case RADIO_IF_MEASURED: + case RADIO_DEVIATION: val = read_bytes[2] & 0x7F; - val = 1070 + (val-55)/2; + val = 222 - val*4; /* convert to kHz */ break; case RADIO_STEREO: diff --git a/firmware/tuner_samsung.c b/firmware/tuner_samsung.c index 781a4bc..98166e1 100644 --- a/firmware/tuner_samsung.c +++ b/firmware/tuner_samsung.c @@ -96,9 +96,9 @@ int samsung_get(int setting) val = (val == 0x140885); break; - case RADIO_IF_MEASURED: + case RADIO_DEVIATION: val = fmradio_read(3); - val = (val & 0x7ffff) / 80; /* convert to kHz */ + val = 10700 - ((val & 0x7ffff) / 8); /* convert to kHz */ break; case RADIO_STEREO: |