aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2
diff options
context:
space:
mode:
authorNick Foster <nick@ettus.com>2011-06-17 13:01:07 -0700
committerNick Foster <nick@ettus.com>2011-06-17 13:35:40 -0700
commit7af605b247ee9331c29c23229252a101b7d40352 (patch)
tree47d8472fc9954b5fdc56de7439523bcc07e06e01 /host/lib/usrp/usrp2
parente4e96f2bc406d94d981f5256c972f3d3c4b81fce (diff)
downloaduhd-7af605b247ee9331c29c23229252a101b7d40352.tar.gz
uhd-7af605b247ee9331c29c23229252a101b7d40352.tar.bz2
uhd-7af605b247ee9331c29c23229252a101b7d40352.zip
UHD: GPS work.
* Rewrote NMEA acquisition to be more general * Added GPS sensors instead of member fns for data access * GPS sensors added to mboard sensors to keep ABI compat * VITA time initialized to GPS time on init
Diffstat (limited to 'host/lib/usrp/usrp2')
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 6bf412a3e..3733915a2 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -174,6 +174,12 @@ usrp2_mboard_impl::usrp2_mboard_impl(
_iface->poke32(U2_REG_RX_CTRL_CLEAR(i), 1); //resets sequence
}
//------------------------------------------------------------------
+
+ //initialize VITA time to GPS time
+ if(_gps_ctrl.get() and _gps_ctrl->gps_detected()) {
+ UHD_MSG(status) << "Setting device time to GPS time...\n";
+ set_time_spec(time_spec_t(double(_gps_ctrl->get_sensor("gps_time").to_int()+1)), false);
+ }
}
usrp2_mboard_impl::~usrp2_mboard_impl(void){UHD_SAFE_CALL(
@@ -375,7 +381,10 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
case SUBDEV_PROP_SENSOR_NAMES:{
prop_names_t names = boost::assign::list_of("mimo_locked")("ref_locked");
- if (_gps_ctrl.get()) names.push_back("gps_time");
+ if (_gps_ctrl.get()) {
+ std::vector<std::string> gs = _gps_ctrl->get_sensors();
+ names.insert(names.end(), gs.begin(), gs.end());
+ }
val = names;
}
return;
@@ -389,8 +398,8 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
val = sensor_value_t("Ref", this->get_ref_locked(), "locked", "unlocked");
return;
}
- else if(key.name == "gps_time" and _gps_ctrl.get()) {
- val = sensor_value_t("GPS time", int(_gps_ctrl->get_epoch_time()), "seconds");
+ else if(uhd::has(_gps_ctrl->get_sensors(), key.name) and _gps_ctrl.get()) {
+ val = _gps_ctrl->get_sensor(key.name);
}
else {
UHD_THROW_PROP_GET_ERROR();