diff options
author | Julian Arnold <julian.arnold@ettus.com> | 2014-12-10 12:08:40 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2015-01-20 19:33:05 +0100 |
commit | 81f08ddff55fb5b181fb2575bd418eee2ac95937 (patch) | |
tree | 5de7307608606c6a508324f32b25c64f08696738 | |
parent | 93bd61a0fec4ea7e81ba78f62fb998116266ac96 (diff) | |
download | uhd-81f08ddff55fb5b181fb2575bd418eee2ac95937.tar.gz uhd-81f08ddff55fb5b181fb2575bd418eee2ac95937.tar.bz2 uhd-81f08ddff55fb5b181fb2575bd418eee2ac95937.zip |
e200: Expose temperature sensor through property tree (sensors/temp)
-rw-r--r-- | host/lib/usrp/e300/e300_impl.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_network.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_remote_codec_ctrl.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/e300/e300_remote_codec_ctrl.hpp | 2 |
4 files changed, 17 insertions, 1 deletions
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 3f1b4fea4..9b98e6f8b 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -1044,6 +1044,8 @@ void e300_impl::_setup_radio(const size_t dspno) _tree->create<int>(rf_fe_path / "sensors"); //empty TODO _tree->create<sensor_value_t>(rf_fe_path / "sensors" / "lo_locked") .publish(boost::bind(&e300_impl::_get_fe_pll_lock, this, direction == "tx")); + _tree->create<sensor_value_t>(rf_fe_path / "sensors" / "temp") + .publish(boost::bind(&ad9361_ctrl::get_temperature, _codec_ctrl)); BOOST_FOREACH(const std::string &name, ad9361_ctrl::get_gain_names(key)) { _tree->create<meta_range_t>(rf_fe_path / "gains" / name / "range") diff --git a/host/lib/usrp/e300/e300_network.cpp b/host/lib/usrp/e300/e300_network.cpp index 189dba838..1ebb8a2ad 100644 --- a/host/lib/usrp/e300/e300_network.cpp +++ b/host/lib/usrp/e300/e300_network.cpp @@ -226,6 +226,8 @@ static void e300_codec_ctrl_tunnel( break; case codec_xact_t::ACTION_GET_RSSI: out->rssi = _codec_ctrl->get_rssi(which_str).to_real(); + case codec_xact_t::ACTION_GET_TEMPERATURE: + out->temp = _codec_ctrl->get_temperature().to_real(); break; default: UHD_MSG(status) << "Got unknown request?!" << std::endl; diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp index ed8131e2f..0ea837a85 100644 --- a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp +++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp @@ -116,10 +116,20 @@ public: _args.bits = uhd::htonx<boost::uint32_t>(0); _transact(); - return sensor_value_t("RSSI", _retval.rssi, "dB"); } + sensor_value_t get_temperature() + { + _clear(); + _args.action = uhd::htonx<boost::uint32_t>(transaction_t::ACTION_GET_TEMPERATURE); + _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_NONE); /*Unused*/ + _args.bits = uhd::htonx<boost::uint32_t>(0); + + _transact(); + return sensor_value_t("temp", _retval.temp, "C"); + } + private: void _transact() { { diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp index cbc4b52d2..d92e9bd58 100644 --- a/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp +++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp @@ -34,6 +34,7 @@ public: double gain; double freq; double rssi; + double temp; boost::uint64_t bits; }; @@ -44,6 +45,7 @@ public: static const boost::uint32_t ACTION_TUNE = 13; static const boost::uint32_t ACTION_SET_LOOPBACK = 14; static const boost::uint32_t ACTION_GET_RSSI = 15; + static const boost::uint32_t ACTION_GET_TEMPERATURE = 16; //Values for "which" static const boost::uint32_t CHAIN_NONE = 0; |