diff options
Diffstat (limited to 'host/lib/usrp/b100/codec_ctrl.cpp')
-rw-r--r-- | host/lib/usrp/b100/codec_ctrl.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/host/lib/usrp/b100/codec_ctrl.cpp b/host/lib/usrp/b100/codec_ctrl.cpp index fad25cf8c..4b9f0e62b 100644 --- a/host/lib/usrp/b100/codec_ctrl.cpp +++ b/host/lib/usrp/b100/codec_ctrl.cpp @@ -13,9 +13,10 @@ #include <uhd/utils/algorithm.hpp> #include <uhd/utils/log.hpp> #include <uhd/utils/safe_call.hpp> -#include <stdint.h> +#include <uhdlib/utils/narrow.hpp> +#include <cstdint> #include <boost/assign/list_of.hpp> -#include <boost/math/special_functions/round.hpp> +#include <cmath> #include <tuple> using namespace uhd; @@ -241,7 +242,8 @@ void b100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts) { // special case for aux dac d (aka sigma delta word) if (which == AUX_DAC_D) { - uint16_t dac_word = uhd::clip(boost::math::iround(volts * 0xfff / 3.3), 0, 0xfff); + uint16_t dac_word = + uhd::clip(uhd::narrow_cast<int>(std::lround(volts * 0xfff / 3.3)), 0, 0xfff); _ad9862_regs.sig_delt_11_4 = uint8_t(dac_word >> 4); _ad9862_regs.sig_delt_3_0 = uint8_t(dac_word & 0xf); this->send_reg(42); @@ -250,7 +252,8 @@ void b100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts) } // calculate the dac word for aux dac a, b, c - uint8_t dac_word = uhd::clip(boost::math::iround(volts * 0xff / 3.3), 0, 0xff); + uint8_t dac_word = + uhd::clip(uhd::narrow_cast<int>(std::lround(volts * 0xff / 3.3)), 0, 0xff); // setup a lookup table for the aux dac params (reg ref, reg addr) typedef std::tuple<uint8_t*, uint8_t> dac_params_t; |