diff options
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r-- | host/lib/usrp/dboard/db_tvrx.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 5235b1bfe..cd238ddc8 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -1,6 +1,7 @@ // // Copyright 2010-2012 Ettus Research LLC // Copyright 2018 Ettus Research, a National Instruments Company +// Copyright 2019 Ettus Research, A National Instruments Brand // // SPDX-License-Identifier: GPL-3.0-or-later // @@ -26,6 +27,7 @@ #include <uhd/utils/assert_has.hpp> #include <uhd/utils/log.hpp> #include <uhd/utils/static.hpp> +#include <uhdlib/utils/narrow.hpp> #include <tuner_4937di5_regs.hpp> #include <boost/array.hpp> #include <boost/assign/list_of.hpp> @@ -264,7 +266,9 @@ static double gain_interp(double gain, const boost::array<double, 17>& db_vector uint8_t gain_step = 0; //find which bin we're in for(size_t i = 0; i < db_vector.size()-1; i++) { - if(gain >= db_vector[i] && gain <= db_vector[i+1]) gain_step = i; + if (gain >= db_vector[i] && gain <= db_vector[i+1]) { + gain_step = uhd::narrow_cast<uint8_t>(i); + } } //find the current slope for linear interpolation diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 91cfa22ca..85ed3ddb7 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -1,5 +1,6 @@ // // Copyright 2015-2017 Ettus Research, A National Instruments Company +// Copyright 2019 Ettus Research, A National Instruments Brand // // SPDX-License-Identifier: GPL-3.0-or-later // @@ -8,6 +9,7 @@ #include "twinrx_ids.hpp" #include <uhdlib/usrp/common/adf435x.hpp> #include <uhdlib/usrp/common/adf535x.hpp> +#include <uhdlib/utils/narrow.hpp> #include <uhd/utils/math.hpp> #include <uhd/utils/safe_call.hpp> #include <chrono> @@ -41,7 +43,8 @@ public: { // SPI configuration _spi_config.use_custom_divider = true; - _spi_config.divider = std::ceil(_db_iface->get_codec_rate(dboard_iface::UNIT_TX) / TWINRX_SPI_CLOCK_FREQ); + _spi_config.divider = uhd::narrow_cast<size_t>(std::ceil( + _db_iface->get_codec_rate(dboard_iface::UNIT_TX) / TWINRX_SPI_CLOCK_FREQ)); //Initialize dboard clocks bool found_rate = false; |