mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-12-25 02:18:29 +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);
|
||||
|
||||
/* swap I and Q ADC, this allows to select between two inputs */
|
||||
if (on > 1)
|
||||
r |= rtlsdr_demod_write_reg(dev, 0, 0x06, 0x90, 1);
|
||||
r |= rtlsdr_demod_write_reg(dev, 0, 0x06, (on > 1) ? 0x90 : 0x80, 1);
|
||||
|
||||
fprintf(stderr, "Enabled direct sampling mode\n");
|
||||
dev->direct_sampling = 1;
|
||||
fprintf(stderr, "Enabled direct sampling mode, input %i\n", on);
|
||||
dev->direct_sampling = on;
|
||||
} else {
|
||||
if (dev->tuner && dev->tuner->init) {
|
||||
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;
|
||||
}
|
||||
|
||||
r |= rtlsdr_set_center_freq(dev, dev->freq);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user