aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types
diff options
context:
space:
mode:
authorJulian Arnold <julian.arnold@ettus.com>2015-01-30 15:11:15 -0800
committerMartin Braun <martin.braun@ettus.com>2015-03-09 17:39:32 -0700
commita55b5a097da01606f23209713bf1ce754be5b7d3 (patch)
tree93ea4476976b88dc1551b6a0be32ff86eda544c4 /host/lib/types
parentc646177e54fed77a9508369ed3f7fc20f1d88a8f (diff)
downloaduhd-a55b5a097da01606f23209713bf1ce754be5b7d3.tar.gz
uhd-a55b5a097da01606f23209713bf1ce754be5b7d3.tar.bz2
uhd-a55b5a097da01606f23209713bf1ce754be5b7d3.zip
uhd: Introduced filter API.
This is a unified API to access filters on USRP devices. Filters can be accessed through the property tree, or multi_usrp.
Diffstat (limited to 'host/lib/types')
-rw-r--r--host/lib/types/CMakeLists.txt1
-rw-r--r--host/lib/types/filters.cpp74
2 files changed, 75 insertions, 0 deletions
diff --git a/host/lib/types/CMakeLists.txt b/host/lib/types/CMakeLists.txt
index 853da3fe2..821754386 100644
--- a/host/lib/types/CMakeLists.txt
+++ b/host/lib/types/CMakeLists.txt
@@ -91,4 +91,5 @@ LIBUHD_APPEND_SOURCES(
${CMAKE_CURRENT_SOURCE_DIR}/tune.cpp
${CMAKE_CURRENT_SOURCE_DIR}/types.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wb_iface.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/filters.cpp
)
diff --git a/host/lib/types/filters.cpp b/host/lib/types/filters.cpp
new file mode 100644
index 000000000..4ee06491f
--- /dev/null
+++ b/host/lib/types/filters.cpp
@@ -0,0 +1,74 @@
+//
+// Copyright 2015 Ettus Research LLC
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+#include <uhd/types/filters.hpp>
+
+using namespace uhd;
+
+std::ostream& uhd::operator<<(std::ostream& os, filter_info_base& f)
+{
+ return os << f.to_pp_string();
+}
+
+std::string filter_info_base::to_pp_string()
+{
+ std::ostringstream os;
+ os << "[filter_info_base]" << std::endl;
+ switch(_type){
+ case ANALOG_LOW_PASS:
+ os << "type: " << "Analog Low-pass" << std::endl;
+ break;
+ case ANALOG_BAND_PASS:
+ os << "type: " << "Analog Band-pass" << std::endl;
+ break;
+ case DIGITAL_I16:
+ os << "type: " << "Digital (i16)" << std::endl;
+ break;
+ case DIGITAL_FIR_I16:
+ os << "type: " << "Digital FIR (i16)" << std::endl;
+ break;
+ default:
+ os << "type: " << "Unknown type!" << std::endl;
+ break;
+ }
+
+ os << "bypass enable: " << _bypass << std::endl
+ <<"position index: " << _position_index << std::endl;
+
+ std::string str = os.str();
+ return str;
+}
+
+std::string analog_filter_base::to_pp_string()
+{
+ std::ostringstream os;
+ os << filter_info_base::to_pp_string() <<
+ "\t[analog_filter_base]" << std::endl <<
+ "\tdesc: " << _analog_type << std::endl;
+ return std::string(os.str());
+
+}
+
+std::string analog_filter_lp::to_pp_string()
+{
+ std::ostringstream os;
+ os << analog_filter_base::to_pp_string() <<
+ "\t\t[analog_filter_lp]" << std::endl <<
+ "\t\tcutoff: " << _cutoff << std::endl <<
+ "\t\trolloff: " << _rolloff << std::endl;
+ return std::string(os.str());
+}