mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2025-01-14 12:17:19 +01:00
add tuner initialization, fix fc0013 replug bug
Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
parent
ff79104824
commit
31cb96fc3c
@ -160,10 +160,14 @@ int rtlsdr_write_array(rtlsdr_dev_t *dev, uint8_t block, uint16_t addr, uint8_t
|
||||
return r;
|
||||
}
|
||||
|
||||
int rtlsdr_i2c_write_reg(rtlsdr_dev_t *dev, uint8_t i2c_addr, uint8_t data)
|
||||
int rtlsdr_i2c_write_reg(rtlsdr_dev_t *dev, uint8_t i2c_addr, uint8_t reg, uint8_t val)
|
||||
{
|
||||
uint16_t addr = i2c_addr;
|
||||
return rtlsdr_write_array(dev, IICB, addr, &data, 1);
|
||||
uint8_t data[2];
|
||||
|
||||
data[0] = reg;
|
||||
data[1] = val;
|
||||
return rtlsdr_write_array(dev, IICB, addr, &data, 2);
|
||||
}
|
||||
|
||||
uint8_t rtlsdr_i2c_read_reg(rtlsdr_dev_t *dev, uint8_t i2c_addr, uint8_t reg)
|
||||
@ -601,6 +605,9 @@ rtlsdr_dev_t *rtlsdr_open(int index)
|
||||
}
|
||||
|
||||
found:
|
||||
if (dev->tuner)
|
||||
dev->tuner->init(dev);
|
||||
|
||||
rtlsdr_set_i2c_repeater(dev, 0);
|
||||
return dev;
|
||||
|
||||
|
@ -129,6 +129,9 @@ int FC0013_Open(void *pTuner)
|
||||
// FC0013 Reset = High -> Low
|
||||
// (...)
|
||||
|
||||
/* FIXME added to fix replug-bug with rtl-sdr */
|
||||
if(FC0013_Write(pTuner, 0x0C, 0x00) != FC0013_I2C_SUCCESS) goto error_status;
|
||||
|
||||
//================================ update base on new FC0013 register bank
|
||||
if(FC0013_Write(pTuner, 0x01, 0x09) != FC0013_I2C_SUCCESS) goto error_status;
|
||||
if(FC0013_Write(pTuner, 0x02, 0x16) != FC0013_I2C_SUCCESS) goto error_status;
|
||||
|
Loading…
Reference in New Issue
Block a user