-
Notifications
You must be signed in to change notification settings - Fork 794
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gym
committed
Jan 12, 2022
1 parent
986ebf0
commit 243ec72
Showing
17 changed files
with
1,950 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
# a small script to transmit simulated GPS samples via UHD | ||
# (C) 2015 by Harald Welte <[email protected]> | ||
# Licensed under the MIT License (see LICENSE) | ||
|
@@ -20,16 +20,11 @@ def __init__(self, options): | |
################################################## | ||
# Blocks | ||
################################################## | ||
self.uhd_usrp_sink = uhd.usrp_sink( | ||
",".join(("", "")), | ||
uhd.stream_args( | ||
cpu_format="fc32", | ||
channels=range(1), | ||
), | ||
) | ||
self.uhd_usrp_sink = uhd.usrp_sink(options.args, uhd.stream_args(cpu_format="fc32")) | ||
self.uhd_usrp_sink.set_samp_rate(options.sample_rate) | ||
self.uhd_usrp_sink.set_center_freq(options.frequency, 0) | ||
self.uhd_usrp_sink.set_gain(options.gain, 0) | ||
self.uhd_usrp_sink.set_clock_source(options.clock_source) | ||
|
||
if options.bits == 16: | ||
# a file source for the file generated by the gps-sdr-sim | ||
|
@@ -55,7 +50,13 @@ def __init__(self, options): | |
self.connect((self.blocks_file_source, 0), (self.blocks_char_to_short, 0)) | ||
self.connect((self.blocks_char_to_short, 0), (self.blocks_interleaved_short_to_complex, 0)) | ||
|
||
self.connect((self.blocks_interleaved_short_to_complex, 0), (self.uhd_usrp_sink, 0)) | ||
# scale complex values to within +/- 1.0 so don't overflow USRP DAC | ||
# scale of 1.0/2**11 will scale it to +/- 0.5 | ||
self.blocks_multiply_const = blocks.multiply_const_vcc((1.0/2**11, )) | ||
|
||
# establish the connections | ||
self.connect((self.blocks_interleaved_short_to_complex, 0), (self.blocks_multiply_const, 0)) | ||
self.connect((self.blocks_multiply_const, 0), (self.uhd_usrp_sink, 0)) | ||
|
||
def get_options(): | ||
parser = OptionParser(option_class=eng_option) | ||
|
@@ -71,18 +72,23 @@ def get_options(): | |
help="set output file name [default=gpssim.bin]") | ||
parser.add_option("-b", "--bits", type="eng_float", default=16, | ||
help="set size of every sample [default=16]") | ||
parser.add_option("-a", "--args", type="string", default="", | ||
help="set UHD arguments [default='']") | ||
parser.add_option("-c", "--clock_source", type="string", default="internal", | ||
help="set clock source [default='internal']") | ||
|
||
|
||
(options, args) = parser.parse_args() | ||
if len(args) != 0: | ||
parser.print_help() | ||
raise SystemExit, 1 | ||
raise SystemExit(1) | ||
|
||
return (options) | ||
|
||
if __name__ == '__main__': | ||
(options) = get_options() | ||
tb = top_block(options) | ||
tb.start() | ||
raw_input('Press Enter to quit: ') | ||
input('Press Enter to quit: ') | ||
tb.stop() | ||
tb.wait() |
Oops, something went wrong.