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:
Steve Markgraf 2012-10-07 16:24:18 +02:00
parent d64c969bd6
commit 22549e0da0

View File

@ -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;
}