- # Create and setup transmit path flow graph
- fg.connect(self.packet_transmitter, self.amp, self.u)
- gr.hier_block.__init__(self, fg, None, None)
-
- def _setup_usrp_sink(self):
- """
- Creates a USRP sink, determines the settings for best bitrate,
- and attaches to the transmitter's subdevice.
- """
- self.u = usrp.sink_c(fusb_block_size=self._fusb_block_size,
- fusb_nblocks=self._fusb_nblocks)
- dac_rate = self.u.dac_rate();
-
- # derive values of bitrate, samples_per_symbol, and interp from desired info
- (self._bitrate, self._samples_per_symbol, self._interp) = \
- pick_tx_bitrate(self._bitrate, self._modulator_class.bits_per_symbol(),
- self._samples_per_symbol, self._interp, dac_rate)
-
- self.u.set_interp_rate(self._interp)
-
- # determine the daughterboard subdevice we're using
- if self._tx_subdev_spec is None:
- self._tx_subdev_spec = usrp.pick_tx_subdevice(self.u)
- self.u.set_mux(usrp.determine_tx_mux_value(self.u, self._tx_subdev_spec))
- self.subdev = usrp.selected_subdev(self.u, self._tx_subdev_spec)
-
-
- def set_freq(self, target_freq):
- """
- Set the center frequency we're interested in.
-
- @param target_freq: frequency in Hz
- @rypte: bool
-
- Tuning is a two step process. First we ask the front-end to
- tune as close to the desired frequency as it can. Then we use
- the result of that operation and our target_frequency to
- determine the value for the digital up converter.
- """
- r = self.u.tune(self.subdev._which, self.subdev, target_freq)
- if r:
- return True
-
- return False
-
- def set_gain(self, gain):
- """
- Sets the analog gain in the USRP
- """
- self.gain = gain
- self.subdev.set_gain(gain)