diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-12-14 16:56:06 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-12-15 13:58:32 -0800 |
commit | 04f345b443963819741175c65e6d121319f0ec1d (patch) | |
tree | 9a2e4c59443913208951e204c2dbe7f4d7df6c1c /gr-uhd | |
parent | 053744e80374c0400c94225fe6d8edfcfed2be9b (diff) |
uhd: Fix GRC bindings (gain, freq...)
The YML file generated during CMake was simply not correct. Frequency,
gain, etc. weren't propagated properly to the underlying C++ object.
Diffstat (limited to 'gr-uhd')
-rw-r--r-- | gr-uhd/grc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gr-uhd/grc/gen_uhd_usrp_blocks.py | 33 |
2 files changed, 26 insertions, 9 deletions
diff --git a/gr-uhd/grc/CMakeLists.txt b/gr-uhd/grc/CMakeLists.txt index 72a6543df3..0f4ef3678a 100644 --- a/gr-uhd/grc/CMakeLists.txt +++ b/gr-uhd/grc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011,2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py index 40c674b5fa..9af9777bb7 100644 --- a/gr-uhd/grc/gen_uhd_usrp_blocks.py +++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py @@ -18,6 +18,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ +import sys + MAIN_TMPL = """\ id: uhd_usrp_${sourk} label: 'UHD: USRP ${sourk.title()}' @@ -153,6 +155,22 @@ templates: ${'$'}{len_tag_name}, ${'%'} endif ) + % for n in range(max_nchan): + ${'%'} if context.get('nchan')() > ${n}: + self.${'$'}{id}.set_center_freq(${'$'}{${'center_freq' + str(n)}}, ${n}) + ${'%'} if bool(eval(context.get('norm_gain' + '${n}')())): + self.${'$'}{id}.set_normalized_gain(${'$'}{${'gain' + str(n)}}, ${n}) + ${'%'} else: + self.${'$'}{id}.set_gain(${'$'}{${'gain' + str(n)}}, ${n}) + ${'%'} endif + self.${'$'}{id}.set_antenna(${'$'}{${'ant' + str(n)}}, ${n}) + self.${'$'}{id}.set_bandwidth(${'$'}{${'bw' + str(n)}}, ${n}) + ${'%'} if context.get('show_lo_controls')(): + self.${'$'}{id}.set_lo_source(${'$'}{${'lo_source' + str(n)}}, uhd.ALL_LOS, ${n}) + self.${'$'}{id}.set_lo_export_enabled(${'$'}{${'lo_export' + str(n)}}, uhd.ALL_LOS, ${n}) + ${'%'} endif + ${'%'} endif + % endfor ${'%'} if clock_rate(): self.${'$'}{id}.set_clock_rate(${'$'}{clock_rate}, uhd.ALL_MBOARDS) ${'%'} endif @@ -165,12 +183,12 @@ templates: callbacks: - set_samp_rate(${'$'}{samp_rate}) % for n in range(max_nchan): - - set_center_freq(${'center_freq' + str(n)}, ${n}) - - self.${'$'}{id}.set_${'$'}{'normalized_' if norm_gain${n} else ''}gain(gain${n}, ${n}) - - ${'$'}{'set_lo_source(lo_source${n}, uhd.ALL_LOS, ${n})' if show_lo_controls else ''} - - ${'$'}{'set_lo_export_enabled(lo_export${n}, uhd.ALL_LOS, ${n})' if show_lo_controls else ''} - - set_antenna(${'ant' + str(n)}, ${n}) - - set_bandwidth(${'bw' + str(n)}, ${n}) + - set_center_freq(${'$'}{${'center_freq' + str(n)}}, ${n}) + - self.${'$'}{id}.set_${'$'}{'normalized_' if bool(eval(norm_gain${n})) else ''}gain(${'$'}{${'gain' + str(n)}}, ${n}) + - ${'$'}{'set_lo_source(' + lo_source${n} + ', uhd.ALL_LOS, ${n})' if show_lo_controls else ''} + - ${'$'}{'set_lo_export_enabled(' + lo_export${n} + ', uhd.ALL_LOS, ${n})' if show_lo_controls else ''} + - set_antenna(${'$'}{${'ant' + str(n)}}, ${n}) + - set_bandwidth(${'$'}{${'bw' + str(n)}}, ${n}) % endfor @@ -293,7 +311,6 @@ PARAMS_TMPL = """ dtype: real default: '0' hide: ${'$'}{ 'all' if not nchan > ${n} else ('none' if eval('bw' + str(${n})) else 'part')} -% if sourk == 'source': - id: lo_source${n} label: 'Ch${n}: LO Source' category: RF Options @@ -308,6 +325,7 @@ PARAMS_TMPL = """ default: 'False' options: ['True', 'False'] hide: ${'$'}{ 'all' if not nchan > ${n} else ('none' if show_lo_controls else 'all')} +% if sourk == 'source': - id: dc_offs_enb${n} label: 'Ch${n}: Enable DC Offset Correction' category: FE Corrections @@ -366,7 +384,6 @@ MAX_NUM_MBOARDS = 8 MAX_NUM_CHANNELS = MAX_NUM_MBOARDS*4 if __name__ == '__main__': - import sys for file in sys.argv[1:]: if file.endswith('source.block.yml'): sourk = 'source' |