Skip to content

Commit e5f0b9d

Browse files
committed
updated
1 parent 6d87fe8 commit e5f0b9d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python_hackrf/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .pyhackrf_tools import pyhackrf_info, pyhackrf_sweep
2+
from .libhackrf import pyhackrf
23
import argparse
34

45
if __name__ == '__main__':
@@ -15,7 +16,7 @@
1516
pyhackrf_info_parser.add_argument('-s', '--serial_numbers', action='store_true', help='show only founded serial_numbers')
1617

1718
pyhackrf_sweep_parser = subparsers.add_parser(
18-
'sweep', help='a command-line spectrum analyzer.', usage='python -m python_hackrf sweep [-h] [-d] [-a] [-f] [-p] [-l] [-g] [-w] [-1] [-N] [-I] [-r]'
19+
'sweep', help='a command-line spectrum analyzer.', usage='python -m python_hackrf sweep [-h] [-d] [-a] [-f] [-p] [-l] [-g] [-w] [-1] [-N] [-I] [-SR] [-s] [-r]'
1920
)
2021
pyhackrf_sweep_parser.add_argument('-d', action='store', help='serial_number. serial number of desired HackRF', metavar='')
2122
pyhackrf_sweep_parser.add_argument('-a', action='store_true', help='amp_enable. RX RF amplifier. If specified = Enable')
@@ -27,6 +28,8 @@
2728
pyhackrf_sweep_parser.add_argument('-1', action='store_true', help='one shot mode. If specified = Enable')
2829
pyhackrf_sweep_parser.add_argument('-N', action='store', help='num_sweeps. Number of sweeps to perform', metavar='')
2930
pyhackrf_sweep_parser.add_argument('-B', action='store_true', help='binary output. If specified = Enable')
31+
pyhackrf_sweep_parser.add_argument('-s', action='store', help='sweep style ("L" - LINEAR, "I" - INTERLEAVED). Default is INTERLEAVED', metavar='', default='I')
32+
pyhackrf_sweep_parser.add_argument('-SR', action='store', help='sample rate (2, 4, 6, 8, 10, 12, 14, 16, 18, 20). Default is 20', metavar='', default=20)
3033
pyhackrf_sweep_parser.add_argument('-r', action='store', help='filename. output file', metavar='')
3134
args, unparsed_args = parser.parse_known_args()
3235

@@ -52,6 +55,7 @@
5255
pass
5356
if freq_min is not None and freq_max is not None:
5457
frequencies.extend([freq_min, freq_max])
58+
5559

5660
pyhackrf_sweep.pyhackrf_sweep(frequencies=frequencies,
5761
lna_gain=int(args.l),
@@ -64,5 +68,7 @@
6468
binary_output=args.B,
6569
one_shot=args.__dict__.get('1'),
6670
filename=args.r,
71+
sweep_style=pyhackrf.py_sweep_style.LINEAR if args.s == 'L' else pyhackrf.py_sweep_style.INTERLEAVED,
72+
sample_rate=int(args.SR),
6773
print_to_console=True,
6874
)

0 commit comments

Comments
 (0)