From 634a331f1b460087e28fd1ac230ca58d45d80c59 Mon Sep 17 00:00:00 2001 From: Jason Abele Date: Sun, 24 Oct 2010 06:53:53 -0700 Subject: Adjusting rx_get and rx_set for newer keys --- host/lib/usrp/dboard/db_dbsrx2.cpp | 46 +++++++++++++------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index 8b069a3e8..b223206da 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -314,8 +314,8 @@ static float gain_to_gc1_rfvga_dac(float &gain){ void dbsrx2::set_gain(float gain, const std::string &name){ assert_has(dbsrx2_gain_ranges.keys(), name, "dbsrx2 gain name"); if (name == "BBG"){ - //_max2112_write_regs.bbg = gain_to_bbg_vga_reg(gain); - //send_reg(0x9, 0x9); + _max2112_write_regs.bbg = gain_to_bbg_vga_reg(gain); + send_reg(0x9, 0x9); } else if(name == "GC1"){ //write the new voltage to the aux dac @@ -347,8 +347,7 @@ void dbsrx2::set_bandwidth(float bandwidth){ * RX Get and Set **********************************************************************/ void dbsrx2::rx_get(const wax::obj &key_, wax::obj &val){ - wax::obj key; std::string name; - boost::tie(key, name) = extract_named_prop(key_); + named_prop_t key = named_prop_t::extract(key_); //handle the get request conditioned on the key switch(key.as()){ @@ -361,13 +360,13 @@ void dbsrx2::rx_get(const wax::obj &key_, wax::obj &val){ return; case SUBDEV_PROP_GAIN: - assert_has(_gains.keys(), name, "dbsrx2 gain name"); - val = _gains[name]; + assert_has(_gains.keys(), key.name, "dbsrx2 gain name"); + val = _gains[key.name]; return; case SUBDEV_PROP_GAIN_RANGE: - assert_has(dbsrx2_gain_ranges.keys(), name, "dbsrx2 gain name"); - val = dbsrx2_gain_ranges[name]; + assert_has(dbsrx2_gain_ranges.keys(), key.name, "dbsrx2 gain name"); + val = dbsrx2_gain_ranges[key.name]; return; case SUBDEV_PROP_GAIN_NAMES: @@ -390,23 +389,14 @@ void dbsrx2::rx_get(const wax::obj &key_, wax::obj &val){ val = dbsrx2_antennas; return; -/* - case SUBDEV_PROP_QUADRATURE: - val = true; - return; - - case SUBDEV_PROP_IQ_SWAPPED: - val = true; - return; - - case SUBDEV_PROP_SPECTRUM_INVERTED: - val = false; - return; -*/ case SUBDEV_PROP_CONNECTION: val = SUBDEV_CONN_COMPLEX_QI; return; + case SUBDEV_PROP_ENABLED: + val = true; //always enabled + return; + case SUBDEV_PROP_USE_LO_OFFSET: val = false; return; @@ -415,12 +405,6 @@ void dbsrx2::rx_get(const wax::obj &key_, wax::obj &val){ val = this->get_locked(); return; -/* - case SUBDEV_PROP_RSSI: - val = this->get_rssi(); - return; -*/ - case SUBDEV_PROP_BANDWIDTH: val = _bandwidth; return; @@ -430,8 +414,7 @@ void dbsrx2::rx_get(const wax::obj &key_, wax::obj &val){ } void dbsrx2::rx_set(const wax::obj &key_, const wax::obj &val){ - wax::obj key; std::string name; - boost::tie(key, name) = extract_named_prop(key_); + named_prop_t key = named_prop_t::extract(key_); //handle the get request conditioned on the key switch(key.as()){ @@ -441,9 +424,12 @@ void dbsrx2::rx_set(const wax::obj &key_, const wax::obj &val){ return; case SUBDEV_PROP_GAIN: - this->set_gain(val.as(), name); + this->set_gain(val.as(), key.name); return; + case SUBDEV_PROP_ENABLED: + return; //always enabled + case SUBDEV_PROP_BANDWIDTH: this->set_bandwidth(val.as()); return; -- cgit v1.2.3