From b3ab5963fb8c37d258e63ab14fc56e339d1b33ca Mon Sep 17 00:00:00 2001 From: Sergey Musikhin <musihin_sergei@mail.ru> Date: Thu, 10 Jun 2021 11:31:02 +0000 Subject: [PATCH] set dac only if refclk=0 --- grc/gen_bladerf_blocks.py | 2 +- lib/bladerf/bladerf_common.cc | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/grc/gen_bladerf_blocks.py b/grc/gen_bladerf_blocks.py index 9fba633..ccef8f7 100644 --- a/grc/gen_bladerf_blocks.py +++ b/grc/gen_bladerf_blocks.py @@ -175,7 +175,7 @@ templates: + ",fpga=" + str(${'$'}{fpga_image}) + ",fpga-reload=" + '${'$'}{fpga_reload}' + ",power_monitoring=" + '${'$'}{power_monitoring}' - + ",ref_clk=" + str(${'$'}{ref_clk}) + + ",ref_clk=" + str(int(${'$'}{ref_clk})) + ",in_clk=" + '${'$'}{in_clk}' + ",out_clk=" + str(${'$'}{out_clk}) + ",dac=" + str(${'$'}{dac}) diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc index 48882be..d3f781c 100644 --- a/lib/bladerf/bladerf_common.cc +++ b/lib/bladerf/bladerf_common.cc @@ -259,6 +259,12 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction) { init_refclk(freq); } + else + { + if (dict.count("dac")) { + init_dac(boost::lexical_cast<uint16_t>(_get(dict, "dac"))); + } + } } if (dict.count("in_clk")) { @@ -269,9 +275,7 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction) init_output_clock(_get(dict, "out_clk") == "True"); } - if (dict.count("dac")) { - init_dac(boost::lexical_cast<uint16_t>(_get(dict, "dac"))); - } + /* Show some info about the device we've opened */ -- GitLab