|
1 | 1 | from .pyhackrf_tools import pyhackrf_info, pyhackrf_sweep |
| 2 | +from .libhackrf import pyhackrf |
2 | 3 | import argparse |
3 | 4 |
|
4 | 5 | if __name__ == '__main__': |
|
15 | 16 | pyhackrf_info_parser.add_argument('-s', '--serial_numbers', action='store_true', help='show only founded serial_numbers') |
16 | 17 |
|
17 | 18 | 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]' |
19 | 20 | ) |
20 | 21 | pyhackrf_sweep_parser.add_argument('-d', action='store', help='serial_number. serial number of desired HackRF', metavar='') |
21 | 22 | pyhackrf_sweep_parser.add_argument('-a', action='store_true', help='amp_enable. RX RF amplifier. If specified = Enable') |
|
27 | 28 | pyhackrf_sweep_parser.add_argument('-1', action='store_true', help='one shot mode. If specified = Enable') |
28 | 29 | pyhackrf_sweep_parser.add_argument('-N', action='store', help='num_sweeps. Number of sweeps to perform', metavar='') |
29 | 30 | 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) |
30 | 33 | pyhackrf_sweep_parser.add_argument('-r', action='store', help='filename. output file', metavar='') |
31 | 34 | args, unparsed_args = parser.parse_known_args() |
32 | 35 |
|
|
52 | 55 | pass |
53 | 56 | if freq_min is not None and freq_max is not None: |
54 | 57 | frequencies.extend([freq_min, freq_max]) |
| 58 | + |
55 | 59 |
|
56 | 60 | pyhackrf_sweep.pyhackrf_sweep(frequencies=frequencies, |
57 | 61 | lna_gain=int(args.l), |
|
64 | 68 | binary_output=args.B, |
65 | 69 | one_shot=args.__dict__.get('1'), |
66 | 70 | 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), |
67 | 73 | print_to_console=True, |
68 | 74 | ) |
0 commit comments