diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:25:13 -0800 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 |
commit | 876d4150aa3da531ddd687b48afada6e43f79146 (patch) | |
tree | fd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/usrp/fe_connection.cpp | |
parent | 1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff) | |
download | uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2 uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip |
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
Diffstat (limited to 'host/lib/usrp/fe_connection.cpp')
-rw-r--r-- | host/lib/usrp/fe_connection.cpp | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/host/lib/usrp/fe_connection.cpp b/host/lib/usrp/fe_connection.cpp index 8e3c0c88b..73c0020f8 100644 --- a/host/lib/usrp/fe_connection.cpp +++ b/host/lib/usrp/fe_connection.cpp @@ -5,35 +5,42 @@ // SPDX-License-Identifier: GPL-3.0-or-later // -#include <uhd/usrp/fe_connection.hpp> #include <uhd/exception.hpp> -#include <regex> +#include <uhd/usrp/fe_connection.hpp> #include <uhd/utils/math.hpp> +#include <regex> using namespace uhd::usrp; -fe_connection_t::fe_connection_t( - sampling_t sampling_mode, bool iq_swapped, - bool i_inverted, bool q_inverted, double if_freq -) : _sampling_mode(sampling_mode), _iq_swapped(iq_swapped), - _i_inverted(i_inverted), _q_inverted(q_inverted), _if_freq(if_freq) +fe_connection_t::fe_connection_t(sampling_t sampling_mode, + bool iq_swapped, + bool i_inverted, + bool q_inverted, + double if_freq) + : _sampling_mode(sampling_mode) + , _iq_swapped(iq_swapped) + , _i_inverted(i_inverted) + , _q_inverted(q_inverted) + , _if_freq(if_freq) { } -fe_connection_t::fe_connection_t(const std::string& conn_str, double if_freq) { +fe_connection_t::fe_connection_t(const std::string& conn_str, double if_freq) +{ static const std::regex conn_regex("([IQ])(b?)(([IQ])(b?))?"); std::cmatch matches; if (std::regex_match(conn_str.c_str(), matches, conn_regex)) { if (matches[3].length() == 0) { - //Connection in {I, Q, Ib, Qb} + // Connection in {I, Q, Ib, Qb} _sampling_mode = REAL; - _iq_swapped = (matches[1].str() == "Q"); - _i_inverted = (matches[2].length() != 0); - _q_inverted = false; //IQ is swapped after inversion + _iq_swapped = (matches[1].str() == "Q"); + _i_inverted = (matches[2].length() != 0); + _q_inverted = false; // IQ is swapped after inversion } else { - //Connection in {I(b?)Q(b?), Q(b?)I(b?), I(b?)I(b?), Q(b?)Q(b?)} - _sampling_mode = (matches[1].str() == matches[4].str()) ? HETERODYNE : QUADRATURE; - _iq_swapped = (matches[1].str() == "Q"); + // Connection in {I(b?)Q(b?), Q(b?)I(b?), I(b?)I(b?), Q(b?)Q(b?)} + _sampling_mode = (matches[1].str() == matches[4].str()) ? HETERODYNE + : QUADRATURE; + _iq_swapped = (matches[1].str() == "Q"); size_t i_idx = _iq_swapped ? 5 : 2, q_idx = _iq_swapped ? 2 : 5; _i_inverted = (matches[i_idx].length() != 0); _q_inverted = (matches[q_idx].length() != 0); @@ -48,10 +55,11 @@ fe_connection_t::fe_connection_t(const std::string& conn_str, double if_freq) { } } -bool uhd::usrp::operator==(const fe_connection_t &lhs, const fe_connection_t &rhs){ - return ((lhs.get_sampling_mode() == rhs.get_sampling_mode()) and - (lhs.is_iq_swapped() == rhs.is_iq_swapped()) and - (lhs.is_i_inverted() == rhs.is_i_inverted()) and - (lhs.is_q_inverted() == rhs.is_q_inverted()) and - uhd::math::frequencies_are_equal(lhs.get_if_freq(), rhs.get_if_freq())); +bool uhd::usrp::operator==(const fe_connection_t& lhs, const fe_connection_t& rhs) +{ + return ((lhs.get_sampling_mode() == rhs.get_sampling_mode()) + and (lhs.is_iq_swapped() == rhs.is_iq_swapped()) + and (lhs.is_i_inverted() == rhs.is_i_inverted()) + and (lhs.is_q_inverted() == rhs.is_q_inverted()) + and uhd::math::frequencies_are_equal(lhs.get_if_freq(), rhs.get_if_freq())); } |