mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-11-13 22:12:52 +01:00
rtlsdr_set_direct_sampling(): fix issue when switching between inputs
Switching back from input 2 to 1 didn't work. Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
parent
d64c969bd6
commit
22549e0da0
@ -982,11 +982,10 @@ int rtlsdr_set_direct_sampling(rtlsdr_dev_t *dev, int on)
|
|||||||
r |= rtlsdr_demod_write_reg(dev, 0, 0x08, 0x4d, 1);
|
r |= rtlsdr_demod_write_reg(dev, 0, 0x08, 0x4d, 1);
|
||||||
|
|
||||||
/* swap I and Q ADC, this allows to select between two inputs */
|
/* swap I and Q ADC, this allows to select between two inputs */
|
||||||
if (on > 1)
|
r |= rtlsdr_demod_write_reg(dev, 0, 0x06, (on > 1) ? 0x90 : 0x80, 1);
|
||||||
r |= rtlsdr_demod_write_reg(dev, 0, 0x06, 0x90, 1);
|
|
||||||
|
|
||||||
fprintf(stderr, "Enabled direct sampling mode\n");
|
fprintf(stderr, "Enabled direct sampling mode, input %i\n", on);
|
||||||
dev->direct_sampling = 1;
|
dev->direct_sampling = on;
|
||||||
} else {
|
} else {
|
||||||
if (dev->tuner && dev->tuner->init) {
|
if (dev->tuner && dev->tuner->init) {
|
||||||
rtlsdr_set_i2c_repeater(dev, 1);
|
rtlsdr_set_i2c_repeater(dev, 1);
|
||||||
@ -1016,6 +1015,8 @@ int rtlsdr_set_direct_sampling(rtlsdr_dev_t *dev, int on)
|
|||||||
dev->direct_sampling = 0;
|
dev->direct_sampling = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r |= rtlsdr_set_center_freq(dev, dev->freq);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user