add toggle test function for tuner register debugging purposes

This commit is contained in:
rtlsdrblog 2023-08-25 14:43:50 +12:00
parent bb5c047fa1
commit 18954dac9e
3 changed files with 30 additions and 0 deletions

View File

@ -116,5 +116,6 @@ int r82xx_init(struct r82xx_priv *priv);
int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq);
int r82xx_set_gain(struct r82xx_priv *priv, int set_manual_gain, int gain);
int r82xx_set_bandwidth(struct r82xx_priv *priv, int bandwidth, uint32_t rate);
int r82xx_toggle_test(struct r82xx_priv *priv, int toggle);
#endif

View File

@ -1177,6 +1177,16 @@ int rtlsdr_set_agc_mode(rtlsdr_dev_t *dev, int on)
if (!dev)
return -1;
/* FOR TESTING ONLY. Uncomment to enable repurposing the RTL AGC button
* for switching registers on/off. Uses to test functions of registers easily. */
/*
rtlsdr_set_i2c_repeater(dev, 1);
r82xx_toggle_test(&dev->r82xx_p, on);
rtlsdr_set_i2c_repeater(dev, 0);
return 0;
*/
return rtlsdr_demod_write_reg(dev, 0, 0x19, on ? 0x25 : 0x05, 1);
}

View File

@ -1105,6 +1105,25 @@ int r82xx_set_bandwidth(struct r82xx_priv *priv, int bw, uint32_t rate)
return priv->int_freq;
}
int r82xx_toggle_test(struct r82xx_priv *priv, int toggle)
{
int rc;
if (toggle)
{
fprintf(stderr, "TOGGLE ON \n");
rc = r82xx_write_reg_mask(priv, 0x17, 0x08, 0x08); /* open_d notch on */
}
else
{
fprintf(stderr, "TOGGLE OFF \n");
rc = r82xx_write_reg_mask(priv, 0x17, 0x00, 0x08); /* open_d notch off */
}
return rc;
}
#undef FILT_HP_BW1
#undef FILT_HP_BW2