summaryrefslogtreecommitdiff
path: root/gr-uhd/grc/gen_uhd_usrp_blocks.py
diff options
context:
space:
mode:
authorkarel <5636152+karel@users.noreply.github.com>2021-02-22 18:03:03 +0200
committerMartin Braun <martin@gnuradio.org>2021-02-23 04:56:44 -0800
commit1f5dc898e902fdec5afb2d60f3083320e50e34f8 (patch)
tree58f75caa4c522d884a62f442e3b410cc21f585f4 /gr-uhd/grc/gen_uhd_usrp_blocks.py
parentf3b05ac8e79c20908685f283835f6a2728940b62 (diff)
gr-uhd: add start time capability to cpp template
also reorder USRP initialization to match Python template Signed-off-by: karel <5636152+karel@users.noreply.github.com>
Diffstat (limited to 'gr-uhd/grc/gen_uhd_usrp_blocks.py')
-rw-r--r--gr-uhd/grc/gen_uhd_usrp_blocks.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index c2685d6f2e..d9a7d6e478 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -283,6 +283,15 @@ cpp_templates:
${'%'} endif
${'%'} endif
% endfor
+ this->${'$'}{id}->set_samp_rate(${'$'}{samp_rate});
+ ${'%'} if sync == 'sync':
+ this->${'$'}{id}->set_time_unknown_pps(::uhd::time_spec_t());
+ ${'%'} elif sync == 'pc_clock':
+ this->${'$'}{id}->set_time_now(::uhd::time_spec_t(time(NULL)), ::uhd::usrp::multi_usrp::ALL_MBOARDS);
+ ${'%'} else:
+ // No synchronization enforced.
+ ${'%'} endif
+
% for n in range(max_nchan):
${'%'} if context.get('nchan')() > ${n}:
this->${'$'}{id}->set_center_freq(${'$'}{${'center_freq' + str(n)}}, ${n});
@@ -325,13 +334,8 @@ cpp_templates:
${'%'} if clock_rate():
this->${'$'}{id}->set_clock_rate(${'$'}{clock_rate}, ::uhd::usrp::multi_usrp::ALL_MBOARDS);
${'%'} endif
- this->${'$'}{id}->set_samp_rate(${'$'}{samp_rate});
- ${'%'} if sync == 'sync':
- this->${'$'}{id}->set_time_unknown_pps(::uhd::time_spec_t());
- ${'%'} elif sync == 'pc_clock':
- this->${'$'}{id}->set_time_now(::uhd::time_spec_t(time(NULL)), ::uhd::usrp::multi_usrp::ALL_MBOARDS);
- ${'%'} else:
- // No synchronization enforced.
+ ${'%'} if start_time() >= 0.0:
+ this->${'$'}{id}->set_start_time(::uhd::time_spec_t(${'$'}{float(start_time)}));
${'%'} endif
link: ['gnuradio-uhd uhd']
callbacks: