forked from sdr/gr-osmosdr
bladeRF: add support for biastee on bladeRF micro
This commit is contained in:
parent
2e2ff98c83
commit
c06db96489
|
@ -90,6 +90,11 @@ bladerf_sink_c::bladerf_sink_c(const std::string &args) :
|
||||||
"and will have no effect.");
|
"and will have no effect.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Bias tee */
|
||||||
|
if (dict.count("biastee")) {
|
||||||
|
set_biastee_mode(dict["biastee"]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize channel <-> antenna map */
|
/* Initialize channel <-> antenna map */
|
||||||
BOOST_FOREACH(std::string ant, get_antennas()) {
|
BOOST_FOREACH(std::string ant, get_antennas()) {
|
||||||
_chanmap[str2channel(ant)] = -1;
|
_chanmap[str2channel(ant)] = -1;
|
||||||
|
@ -582,3 +587,23 @@ std::string bladerf_sink_c::get_clock_source(size_t mboard)
|
||||||
{
|
{
|
||||||
return bladerf_common::get_clock_source(mboard);
|
return bladerf_common::get_clock_source(mboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bladerf_sink_c::set_biastee_mode(const std::string &mode)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
bool enable;
|
||||||
|
|
||||||
|
if (mode == "on" || mode == "1" || mode == "rx") {
|
||||||
|
enable = true;
|
||||||
|
} else {
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = bladerf_set_bias_tee(_dev.get(), BLADERF_CHANNEL_TX(0), enable);
|
||||||
|
if (BLADERF_ERR_UNSUPPORTED == status) {
|
||||||
|
// unsupported, but not worth crashing out
|
||||||
|
BLADERF_WARNING("Bias-tee not supported by device");
|
||||||
|
} else if (status != 0) {
|
||||||
|
BLADERF_THROW_STATUS(status, "Failed to set bias-tee");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -117,6 +117,8 @@ public:
|
||||||
void set_clock_source(const std::string &source, size_t mboard = 0);
|
void set_clock_source(const std::string &source, size_t mboard = 0);
|
||||||
std::string get_clock_source(size_t mboard);
|
std::string get_clock_source(size_t mboard);
|
||||||
|
|
||||||
|
void set_biastee_mode(const std::string &mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int transmit_with_tags(int16_t const *samples, int noutput_items);
|
int transmit_with_tags(int16_t const *samples, int noutput_items);
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,11 @@ bladerf_source_c::bladerf_source_c(const std::string &args) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Bias tee */
|
||||||
|
if (dict.count("biastee")) {
|
||||||
|
set_biastee_mode(dict["biastee"]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Loopback */
|
/* Loopback */
|
||||||
set_loopback_mode(dict.count("loopback") ? dict["loopback"] : "none");
|
set_loopback_mode(dict.count("loopback") ? dict["loopback"] : "none");
|
||||||
|
|
||||||
|
@ -548,6 +553,26 @@ std::string bladerf_source_c::get_clock_source(size_t mboard)
|
||||||
return bladerf_common::get_clock_source(mboard);
|
return bladerf_common::get_clock_source(mboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bladerf_source_c::set_biastee_mode(const std::string &mode)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
bool enable;
|
||||||
|
|
||||||
|
if (mode == "on" || mode == "1" || mode == "rx") {
|
||||||
|
enable = true;
|
||||||
|
} else {
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = bladerf_set_bias_tee(_dev.get(), BLADERF_CHANNEL_RX(0), enable);
|
||||||
|
if (BLADERF_ERR_UNSUPPORTED == status) {
|
||||||
|
// unsupported, but not worth crashing out
|
||||||
|
BLADERF_WARNING("Bias-tee not supported by device");
|
||||||
|
} else if (status != 0) {
|
||||||
|
BLADERF_THROW_STATUS(status, "Failed to set bias-tee");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void bladerf_source_c::set_loopback_mode(const std::string &loopback)
|
void bladerf_source_c::set_loopback_mode(const std::string &loopback)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
|
@ -120,6 +120,8 @@ public:
|
||||||
void set_clock_source(const std::string &source, size_t mboard = 0);
|
void set_clock_source(const std::string &source, size_t mboard = 0);
|
||||||
std::string get_clock_source(size_t mboard);
|
std::string get_clock_source(size_t mboard);
|
||||||
|
|
||||||
|
void set_biastee_mode(const std::string &mode);
|
||||||
|
|
||||||
void set_loopback_mode(const std::string &loopback);
|
void set_loopback_mode(const std::string &loopback);
|
||||||
void set_rx_mux_mode(const std::string &rxmux);
|
void set_rx_mux_mode(const std::string &rxmux);
|
||||||
void set_agc_mode(const std::string &agcmode);
|
void set_agc_mode(const std::string &agcmode);
|
||||||
|
|
Loading…
Reference in New Issue