From 2aef04843d248d0584b4865c62d7ca0772113dc9 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Thu, 28 Oct 2010 17:22:25 -0700
Subject: uhd: added ref clock option to single usrp blocks, minor grc fix on
empty option keys
---
gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py | 22 ++++++++++++++++++++++
grc/base/Param.py | 2 +-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
index 9b6422f7a..7337c71d7 100755
--- a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
@@ -30,6 +30,13 @@ MAIN_TMPL = """\
io_type=uhd.io_type_t.\$type.type,
num_channels=\$nchan,
)
+\#if \$ref_clk()
+_clk_cfg = uhd.clock_config_t()
+_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
+_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
+_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
+self.\$(id).set_clock_config(_clk_cfg);
+\#end if
\#if \$sd_spec()
self.\$(id).set_subdev_spec(\$sd_spec)
\#end if
@@ -103,6 +110,21 @@ self.\$(id).set_bandwidth(\$bw$(n), $n)
\#end if
+
+ Ref Clock
+ ref_clk
+
+ enum
+ \#if \$ref_clk() then 'none' else 'part'#
+
+
+
Subdev Specsd_spec
diff --git a/grc/base/Param.py b/grc/base/Param.py
index e56eac36e..5cd0f9d6d 100644
--- a/grc/base/Param.py
+++ b/grc/base/Param.py
@@ -94,7 +94,7 @@ class Param(Element):
try: assert set(opt_keys) == set(option.get_opt_keys())
except AssertionError: raise Exception, 'Opt keys "%s" are not identical across all options.'%opt_keys
#if a value is specified, it must be in the options keys
- self._value = value or self.get_option_keys()[0]
+ self._value = value if value or value in self.get_option_keys() else self.get_option_keys()[0]
try: assert self.get_value() in self.get_option_keys()
except AssertionError: raise Exception, 'The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys())
else: self._value = value or ''
--
cgit