minor changes to make testing easier

This commit is contained in:
rtlsdrblog 2023-06-08 22:20:41 +12:00
parent b8be1be937
commit 70805d02eb
2 changed files with 30 additions and 10 deletions

View File

@ -1193,6 +1193,7 @@ uint32_t rtlsdr_get_sample_rate(rtlsdr_dev_t *dev)
return dev->rate;
}
/* Used to test any register setting with a toggle */
int rtlsdr_set_testmode(rtlsdr_dev_t *dev, int on)
{
if (!dev)
@ -1209,13 +1210,14 @@ int rtlsdr_set_agc_mode(rtlsdr_dev_t *dev, int on)
/* testing:
* replaceme the useless RTL AGC function with a function that
implements max LNA gain for sensitivity when on */
rtlsdr_set_i2c_repeater(dev, 1);
sensitivity_mode_toggle(&dev->r82xx_p, on);
rtlsdr_set_i2c_repeater(dev, 0);
//rtlsdr_set_i2c_repeater(dev, 1);
//sensitivity_mode_toggle(&dev->r82xx_p, on);
//notch_toggle(&dev->r82xx_p, on);
//rtlsdr_set_i2c_repeater(dev, 0);
return 0;
//return 0;
//return rtlsdr_demod_write_reg(dev, 0, 0x19, on ? 0x25 : 0x05, 1);
return rtlsdr_demod_write_reg(dev, 0, 0x19, on ? 0x25 : 0x05, 1);
}
int rtlsdr_set_direct_sampling(rtlsdr_dev_t *dev, int on)

View File

@ -377,9 +377,9 @@ static int r82xx_set_mux(struct r82xx_priv *priv, uint32_t freq)
range = &freq_ranges[i];
/* Open Drain */
rc = r82xx_write_reg_mask(priv, 0x17, range->open_d, 0x08);
if (rc < 0)
return rc;
//rc = r82xx_write_reg_mask(priv, 0x17, range->open_d, 0x08);
//if (rc < 0)
// return rc;
/* RF_MUX,Polymux */
rc = r82xx_write_reg_mask(priv, 0x1a, range->rf_mux_ploy, 0xc3);
@ -1145,6 +1145,24 @@ int sensitivity_mode_toggle(struct r82xx_priv *priv, int toggle)
return rc;
}
int notch_toggle(struct r82xx_priv *priv, int toggle)
{
int rc;
if (toggle)
{
//fprintf(stdout, "TOGGLE ON");
rc = r82xx_write_reg_mask(priv, 0x17, 0x08, 0x08);
}
else
{
//fprintf(stdout, "TOGGLE OFF");
rc = r82xx_write_reg_mask(priv, 0x17, 0x00, 0x08);
}
return rc;
}
int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq)
{
int rc = -1;
@ -1180,7 +1198,7 @@ int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq)
/* select tuner band based on frequency
* and only switch if there is a band change
*(to avoid excessive register writes when tuning rapidly) */
uint8_t band = (freq <= MHZ(28.8)) ? HF : ((freq > MHZ(28.8) && freq < MHZ(300)) ? VHF : UHF);
uint8_t band = (freq <= MHZ(28.8)) ? HF : ((freq > MHZ(28.8) && freq < MHZ(250)) ? VHF : UHF);
/* switch between tuner inputs on the RTL-SDR Blog V4 */
if (band != priv->input)