aboutsummaryrefslogtreecommitdiffstats
path: root/utils/rtl_power.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rtl_power.c')
-rw-r--r--utils/rtl_power.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/utils/rtl_power.c b/utils/rtl_power.c
index 23b516c..6204de2 100644
--- a/utils/rtl_power.c
+++ b/utils/rtl_power.c
@@ -133,6 +133,7 @@ void usage(void)
"\t[-d device_index (default: 0)]\n"
"\t[-g tuner_gain (default: automatic)]\n"
"\t[-p ppm_error (default: 0)]\n"
+ "\t[-T enable bias-T on GPIO PIN 0 (works for rtl-sdr.com v3 dongles)]\n"
"\tfilename (a '-' dumps samples to stdout)\n"
"\t (omitting the filename also uses stdout)\n"
"\n"
@@ -249,7 +250,7 @@ void sine_table(int size)
}
}
-int16_t FIX_MPY(int16_t a, int16_t b)
+static inline int16_t FIX_MPY(int16_t a, int16_t b)
/* fixed point multiply and scale */
{
int c = ((int)a * (int)b) >> 14;
@@ -436,8 +437,16 @@ void frequency_range(char *arg, double crop)
/* hacky string parsing */
start = arg;
stop = strchr(start, ':') + 1;
+ if (stop == (char *)1) {
+ fprintf(stderr, "Bad frequency range specification: %s\n", arg);
+ exit(1);
+ }
stop[-1] = '\0';
step = strchr(stop, ':') + 1;
+ if (step == (char *)1) {
+ fprintf(stderr, "Bad frequency range specification: %s\n", arg);
+ exit(1);
+ }
step[-1] = '\0';
lower = (int)atofs(start);
upper = (int)atofs(stop);
@@ -771,6 +780,7 @@ int main(int argc, char **argv)
int single = 0;
int direct_sampling = 0;
int offset_tuning = 0;
+ int enable_biastee = 0;
double crop = 0.0;
char *freq_optarg;
time_t next_tick;
@@ -781,7 +791,7 @@ int main(int argc, char **argv)
double (*window_fn)(int, int) = rectangle;
freq_optarg = "";
- while ((opt = getopt(argc, argv, "f:i:s:t:d:g:p:e:w:c:F:1PDOh")) != -1) {
+ while ((opt = getopt(argc, argv, "f:i:s:t:d:g:p:e:w:c:F:1PDOhT")) != -1) {
switch (opt) {
case 'f': // lower:upper:bin_size
freq_optarg = strdup(optarg);
@@ -849,6 +859,9 @@ int main(int argc, char **argv)
boxcar = 0;
comp_fir_size = atoi(optarg);
break;
+ case 'T':
+ enable_biastee = 1;
+ break;
case 'h':
default:
usage();
@@ -925,6 +938,10 @@ int main(int argc, char **argv)
verbose_ppm_set(dev, ppm_error);
+ rtlsdr_set_bias_tee(dev, enable_biastee);
+ if (enable_biastee)
+ fprintf(stderr, "activated bias-T on GPIO PIN 0\n");
+
if (strcmp(filename, "-") == 0) { /* Write log to stdout */
file = stdout;
#ifdef _WIN32