Commit Graph

3 Commits

Author SHA1 Message Date
Clayton Smith bc629b03fe hackrf: fix bandwidth setting
The T/R switching code added in ae2253c516
fails to set custom filter bandwidths because it sets bandwidth and
sample rate in the wrong order. As noted in the documentation for
hackrf_set_sample_rate: "If you want to override the baseband filter
selection, you must do so after setting the sample rate."

To solve this problem I moved the set_bandwidth call after
set_sample_rate. It was also necessary to skip the call if a custom
bandwidth was not requested.

Signed-off-by: Eric Wild <ewild@sysmocom.de>
2021-01-04 22:27:53 +01:00
Clayton Smith 4d1c05e84b hackrf: replace boost::assign with C++11
Since GNU Radio is gradually replacing Boost with C++11, it seemed worth
doing that for the HackRF blocks I was working on. This change removes
all usage of boost::assign.

From: Clayton Smith <argilo@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-02-16 09:52:00 +01:00
Clayton Smith ae2253c516 hackrf: allow transmit/receive switching
To allow switching between transmit and receive mode within a single
flow graph, I've followed the model used by the BladeRF: I factored
common code into hackrf_common.cc and hackrf_common.h, and created a
"_devs" map there to keep track of which devices have been previously
opened. Shared pointers are used to track how many source & sink blocks
are using a particular device.

Because some properties (center frequency, sample rate, bandwidth, RF
amplifier state, bias tee) are shared between receive and transmit, the
blocks defer setting these until receiving or transmitting is started.
That way a source and sink can safely use different values for these
properties, and the correct values are set during T/R switching.

Because the HackRF driver and/or hardware does not seem to fully
transmit all samples sent to it, the code adds some silence to the end
of transmissions to ensure all samples are transmitted.

I've also replaced boost with C++11 code where possible.

From: Clayton Smith <argilo@gmail.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2020-02-16 09:52:00 +01:00