From 782a02b45c543f14ff8e3e6767da3f7c9c272ce8 Mon Sep 17 00:00:00 2001
From: Derek Kozel <derek.kozel@ettus.com>
Date: Wed, 20 Apr 2016 16:17:15 -0700
Subject: Added controls for importing, exporting, and sharing LOs

---
 gr-uhd/grc/gen_uhd_usrp_blocks.py | 92 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 91 insertions(+), 1 deletion(-)

(limited to 'gr-uhd/grc/gen_uhd_usrp_blocks.py')

diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index fd2e77707e..e99de0d7d0 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -82,6 +82,12 @@ self.\$(id).set_antenna(\$ant$(n), $n)
 self.\$(id).set_bandwidth(\$bw$(n), $n)
 	\#end if
 #if $sourk == 'source'
+	\#if \$lo_export$(n)() and not \$hide_lo_controls()
+self.\$(id).set_lo_export_enabled(\$lo_export$(n), uhd.ALL_LOS, $n)
+	\#end if
+    \#if \$lo_source$(n)() and not \$hide_lo_controls()
+self.\$(id).set_lo_source(\$lo_source$(n), uhd.ALL_LOS, $n)
+	\#end if
 	\#if \$dc_offs_enb$(n)()
 self.\$(id).set_auto_dc_offset(\$dc_offs_enb$(n), $n)
 	\#end if
@@ -99,6 +105,14 @@ self.\$(id).set_auto_iq_balance(\$iq_imbal_enb$(n), $n)
 self.\$(id).set_normalized_gain(\$gain$(n), $n)
 \#else
 self.\$(id).set_gain(\$gain$(n), $n)
+\#end if
+	</callback>
+	<callback>\#if not \$hide_lo_controls()
+set_lo_source(\$lo_source$(n), uhd.ALL_LOS, $n)
+\#end if
+	</callback>
+    <callback>\#if not \$hide_lo_controls()
+set_lo_export_enabled(\$lo_export$(n), uhd.ALL_LOS, $n)
 \#end if
 	</callback>
 	<callback>set_antenna(\$ant$(n), $n)</callback>
@@ -522,6 +536,62 @@ PARAMS_TMPL = """	<param>
 		</hide>
 		<tab>RF Options</tab>
 	</param>
+#if $sourk == 'source'
+	<param>
+		<name>Ch$(n): LO Source</name>
+		<key>lo_source$(n)</key>
+		<value>internal</value>
+		<type>string</type>
+		<hide>
+			\#if not \$nchan() > $n
+				all
+			\#elif \$hide_lo_controls()
+				all
+			\#else
+				none
+			\#end if
+		</hide>
+		<option>
+			<name>Internal</name>
+			<key>internal</key>
+		</option>
+		<option>
+			<name>External</name>
+			<key>external</key>
+		</option>
+		<option>
+			<name>Companion</name>
+			<key>companion</key>
+		</option>
+		<tab>RF Options</tab>
+	</param>
+#end if
+#if $sourk == 'source'
+	<param>
+		<name>Ch$(n): LO Export</name>
+		<key>lo_export$(n)</key>
+		<value>False</value>
+		<type>bool</type>
+		<hide>
+			\#if not \$nchan() > $n
+				all
+			\#elif \$hide_lo_controls()
+				all
+			\#else
+				none
+			\#end if
+		</hide>
+		<option>
+			<name>True</name>
+			<key>True</key>
+		</option>
+		<option>
+			<name>False</name>
+			<key>False</key>
+		</option>
+		<tab>RF Options</tab>
+	</param>
+#end if
 #if $sourk == 'source'
 	<param>
 		<name>Ch$(n): Enable DC Offset Correction</name>
@@ -573,6 +643,25 @@ SHOW_CMD_PORT_PARAM = """
 	</param>
 """
 
+SHOW_LO_CONTROLS_PARAM = """
+	<param>
+		<name>Show LO Controls</name>
+		<key>hide_lo_controls</key>
+		<value>True</value>
+		<type>bool</type>
+		<hide>part</hide>
+		<option>
+			<name>Yes</name>
+			<key>False</key>
+		</option>
+		<option>
+			<name>No</name>
+			<key>True</key>
+		</option>
+		<tab>Advanced</tab>
+	</param>
+"""
+
 TSBTAG_PARAM = """	<param>
 		<name>TSB tag name</name>
 		<key>len_tag_name</key>
@@ -605,7 +694,8 @@ if __name__ == '__main__':
 		else: raise Exception, 'is %s a source or sink?'%file
 
 		params = ''.join([parse_tmpl(PARAMS_TMPL, n=n, sourk=sourk) for n in range(max_num_channels)])
-                params += SHOW_CMD_PORT_PARAM
+		params += SHOW_CMD_PORT_PARAM
+		params += SHOW_LO_CONTROLS_PARAM
 		if sourk == 'sink':
 			params += TSBTAG_PARAM
 			lentag_arg = TSBTAG_ARG
-- 
cgit v1.2.3