aboutsummaryrefslogtreecommitdiffstats
path: root/src/tuner_e4k.c
diff options
context:
space:
mode:
authorHoernchen <la@tfc-server.de>2012-05-05 12:56:42 +0200
committerSteve Markgraf <steve@steve-m.de>2012-05-05 13:54:24 +0200
commitb6652f33df4e12c77f4fd2687426eb4afae632b0 (patch)
tree413a8b4ac1a00d465d6d63811edf0110c44e5f7a /src/tuner_e4k.c
parent259e61fb17618cc5b49bdf48296dc571c21bb69b (diff)
uhf appears to work better for ads-b
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src/tuner_e4k.c')
-rw-r--r--src/tuner_e4k.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/tuner_e4k.c b/src/tuner_e4k.c
index 08b812a..cda0c2a 100644
--- a/src/tuner_e4k.c
+++ b/src/tuner_e4k.c
@@ -167,20 +167,29 @@ static int closest_arr_idx(const uint32_t *arr, unsigned int arr_size, uint32_t
}
/* return 4-bit index as to which RF filter to select */
-static int choose_rf_filter(uint32_t freq)
+static int choose_rf_filter(enum e4k_band band, uint32_t freq)
{
int rc;
- if (freq < MHZ(350))
- rc = 0;
- else if (freq < MHZ(1000))
- rc = closest_arr_idx(rf_filt_center_uhf,
- ARRAY_SIZE(rf_filt_center_uhf),
- freq);
- else
- rc = closest_arr_idx(rf_filt_center_l,
- ARRAY_SIZE(rf_filt_center_l),
- freq);
+ switch (band) {
+ case E4K_BAND_VHF2:
+ case E4K_BAND_VHF3:
+ rc = 0;
+ break;
+ case E4K_BAND_UHF:
+ rc = closest_arr_idx(rf_filt_center_uhf,
+ ARRAY_SIZE(rf_filt_center_uhf),
+ freq);
+ break;
+ case E4K_BAND_L:
+ rc = closest_arr_idx(rf_filt_center_l,
+ ARRAY_SIZE(rf_filt_center_l),
+ freq);
+ break;
+ default:
+ rc -EINVAL;
+ break;
+ }
return rc;
}
@@ -190,7 +199,7 @@ int e4k_rf_filter_set(struct e4k_state *e4k)
{
int rc;
- rc = choose_rf_filter(e4k->vco.flo);
+ rc = choose_rf_filter(e4k->band, e4k->vco.flo);
if (rc < 0)
return rc;
@@ -525,7 +534,7 @@ int e4k_tune_params(struct e4k_state *e4k, struct e4k_pll_params *p)
e4k_band_set(e4k, E4K_BAND_VHF2);
else if (e4k->vco.flo < MHZ(350))
e4k_band_set(e4k, E4K_BAND_VHF3);
- else if (e4k->vco.flo < MHZ(1000))
+ else if (e4k->vco.flo < MHZ(1135))
e4k_band_set(e4k, E4K_BAND_UHF);
else
e4k_band_set(e4k, E4K_BAND_L);