1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
|