|
|
@ -509,13 +509,9 @@ int rtlsdr_deinit_baseband(rtlsdr_dev_t *dev) |
|
|
|
if (!dev) |
|
|
|
if (!dev) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if (dev->tuner) { |
|
|
|
if (dev->tuner && dev->tuner->exit) { |
|
|
|
/* deinitialize tuner */ |
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 1); |
|
|
|
rtlsdr_set_i2c_repeater(dev, 1); |
|
|
|
|
|
|
|
r = dev->tuner->exit(dev); /* deinitialize tuner */ |
|
|
|
if (dev->tuner->exit) |
|
|
|
|
|
|
|
r = dev->tuner->exit(dev); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -585,18 +581,16 @@ int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq) |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
if (dev->tuner->set_freq) { |
|
|
|
if (dev->tuner->set_freq) { |
|
|
|
rtlsdr_set_i2c_repeater(dev, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f *= 1.0 + dev->corr / 1e6; |
|
|
|
f *= 1.0 + dev->corr / 1e6; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 1); |
|
|
|
r = dev->tuner->set_freq(dev, (uint32_t) f); |
|
|
|
r = dev->tuner->set_freq(dev, (uint32_t) f); |
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
|
|
|
|
|
|
|
|
|
if (!r) |
|
|
|
if (!r) |
|
|
|
dev->freq = freq; |
|
|
|
dev->freq = freq; |
|
|
|
else |
|
|
|
else |
|
|
|
dev->freq = 0; |
|
|
|
dev->freq = 0; |
|
|
|
|
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return r; |
|
|
|
return r; |
|
|
@ -681,8 +675,6 @@ int rtlsdr_set_tuner_gain_mode(rtlsdr_dev_t *dev, int mode) |
|
|
|
return r; |
|
|
|
return r; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t samp_rate) |
|
|
|
int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t samp_rate) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint16_t tmp; |
|
|
|
uint16_t tmp; |
|
|
@ -704,8 +696,11 @@ int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t samp_rate) |
|
|
|
if ( ((double)samp_rate) != real_rate ) |
|
|
|
if ( ((double)samp_rate) != real_rate ) |
|
|
|
fprintf(stderr, "Exact sample rate is: %f Hz\n", real_rate); |
|
|
|
fprintf(stderr, "Exact sample rate is: %f Hz\n", real_rate); |
|
|
|
|
|
|
|
|
|
|
|
if (dev->tuner && dev->tuner->set_bw) |
|
|
|
if (dev->tuner && dev->tuner->set_bw) { |
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 1); |
|
|
|
dev->tuner->set_bw(dev, real_rate); |
|
|
|
dev->tuner->set_bw(dev, real_rate); |
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dev->rate = samp_rate; |
|
|
|
dev->rate = samp_rate; |
|
|
|
|
|
|
|
|
|
|
|