summaryrefslogtreecommitdiff
path: root/gr-uhd/apps/hf_radio/input.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-uhd/apps/hf_radio/input.py')
-rw-r--r--gr-uhd/apps/hf_radio/input.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/gr-uhd/apps/hf_radio/input.py b/gr-uhd/apps/hf_radio/input.py
new file mode 100644
index 000000000..5984d8254
--- /dev/null
+++ b/gr-uhd/apps/hf_radio/input.py
@@ -0,0 +1,46 @@
+# Basic USRP setup and control.
+# It's only ever been tried with a basic rx daughter card.
+#
+# Imagine that the gnuradio boilerplate is here.
+#
+# M. Revnell 2005-Dec
+
+from gnuradio import gr, gru, optfir
+from gnuradio import usrp
+from usrpm import usrp_dbid
+import math
+
+# Put special knowlege of usrp here.
+
+class input:
+ def __init__( self, decim ):
+ self.freq = -2.5e6
+ self.src = usrp.source_c( )
+ self.subdev = usrp.pick_subdev( self.src,
+ (usrp_dbid.BASIC_RX,
+ usrp_dbid.TV_RX,
+ usrp_dbid.TV_RX_REV_2,
+ usrp_dbid.TV_RX_REV_3,
+ usrp_dbid.TV_RX_MIMO,
+ usrp_dbid.TV_RX_REV_2_MIMO,
+ usrp_dbid.TV_RX_REV_3_MIMO))
+
+ print self.subdev
+
+ self.subdevice = usrp.selected_subdev( self.src,
+ self.subdev )
+
+ self.mux = usrp.determine_rx_mux_value( self.src,
+ self.subdev )
+ self.decim = decim
+
+ self.adc_rate = self.src.adc_rate()
+ self.usrp_rate = self.adc_rate / self.decim
+ self.src.set_decim_rate( self.decim )
+ self.src.set_mux( self.mux )
+ usrp.tune( self.src, 0, self.subdevice, self.freq )
+
+ def set_freq( self, x ):
+ r = usrp.tune( self.src, 0, self.subdevice, -x )
+ if r:
+ self.freq = -x