diff options
-rwxr-xr-x | gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py | 22 | ||||
-rw-r--r-- | grc/base/Param.py | 2 |
2 files changed, 23 insertions, 1 deletions
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 @@ -104,6 +111,21 @@ self.\$(id).set_bandwidth(\$bw$(n), $n) </hide> </param> <param> + <name>Ref Clock</name> + <key>ref_clk</key> + <value></value> + <type>enum</type> + <hide>\#if \$ref_clk() then 'none' else 'part'#</hide> + <option> + <name>External</name> + <key>ext</key> + </option> + <option> + <name>Internal</name> + <key></key> + </option> + </param> + <param> <name>Subdev Spec</name> <key>sd_spec</key> <value></value> 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 '' |