diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-26 16:54:17 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-26 16:54:17 -0700 |
commit | 06e1859d47c9b5be19ae680ba463a8fa72df9ebd (patch) | |
tree | e839d8d394d19fd3a4a94e173313cd5300b9ff18 /host | |
parent | 6f1bdcb58608e3a7c2625841e3a8f1c6297bb544 (diff) | |
download | uhd-06e1859d47c9b5be19ae680ba463a8fa72df9ebd.tar.gz uhd-06e1859d47c9b5be19ae680ba463a8fa72df9ebd.tar.bz2 uhd-06e1859d47c9b5be19ae680ba463a8fa72df9ebd.zip |
Added RSSI readback to XCVR2450.
also fixed spi readback typo in u2 iface
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/dboard/db_xcvr2450.cpp | 17 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dboard_iface.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 2 |
3 files changed, 18 insertions, 7 deletions
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index f1510da10..efe7687c2 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -134,6 +134,19 @@ private: bool get_locked(void){ return (this->get_iface()->read_gpio(dboard_iface::UNIT_RX) & LOCKDET_RXIO) != 0; } + + /*! + * Read the RSSI from the aux adc + * \return the rssi in dB + */ + float get_rssi(void){ + //constants for the rssi calculation + static const float min_v = float(0.5), max_v = float(2.5); + static const float rssi_dyn_range = 60; + //calculate the rssi from the voltage + float voltage = this->get_iface()->read_aux_adc(dboard_iface::UNIT_RX, 1); + return rssi_dyn_range*(voltage - min_v)/(max_v - min_v); + } }; /*********************************************************************** @@ -488,6 +501,10 @@ void xcvr2450::rx_get(const wax::obj &key_, wax::obj &val){ val = this->get_locked(); return; + case SUBDEV_PROP_RSSI: + val = this->get_rssi(); + return; + default: UHD_THROW_PROP_GET_ERROR(); } } diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 9503c329b..74d80163c 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.cpp @@ -275,10 +275,4 @@ float usrp2_dboard_iface::read_aux_adc(unit_t unit, int which){ //convert to voltage and return return float(3.3*ad7922_regs.result/4095); - - - - - - } diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index 5bca2c95b..e43b9678e 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -88,7 +88,7 @@ public: usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); UHD_ASSERT_THROW(htonl(in_data.id) == USRP2_CTRL_ID_OMG_TRANSACTED_SPI_DUDE); - return ntohl(out_data.data.spi_args.data); + return ntohl(in_data.data.spi_args.data); } /*********************************************************************** |