Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

grextras: added time and sync properties to uhd_control_port

  • Loading branch information...
commit 341f351159961acc0bb6e46402e9ed28d618cd64 1 parent dcc0a53
@guruofquality authored
Showing with 71 additions and 0 deletions.
  1. +9 −0 include/grextras/uhd_control_port.hpp
  2. +62 −0 lib/uhd_control_port.cpp
View
9 include/grextras/uhd_control_port.hpp
@@ -37,6 +37,15 @@ namespace grextras
* - "tx_freq" of type uhd::tune_request
* - "rx_gain" of type double
* - "tx_gain" of type double
+ * - "time_source" of type string
+ * - "clock_source" of type string
+ * - "time_now" of type uhd::time_spec_t
+ * - "time_pps" of type uhd::time_spec_t
+ * (getting time pps gets the time at the last pps)
+ * (setting time pps sets the time at the next pps)
+ *
+ * Documentation for these properties can be found
+ * by inspecting the uhd/usrp/multi_usrp.hpp header.
*/
struct GREXTRAS_API UHDControlPort : virtual gras::Block
{
View
62 lib/uhd_control_port.cpp
@@ -49,6 +49,16 @@ struct UHDControlPortImpl : public UHDControlPort
this->register_setter("rx_freq", &UHDControlPortImpl::set_rx_freq);
this->register_getter("tx_freq", &UHDControlPortImpl::get_tx_freq);
this->register_setter("tx_freq", &UHDControlPortImpl::set_tx_freq);
+
+ this->register_getter("time_source", &UHDControlPortImpl::get_time_source);
+ this->register_setter("time_source", &UHDControlPortImpl::set_time_source);
+ this->register_getter("clock_source", &UHDControlPortImpl::get_clock_source);
+ this->register_setter("clock_source", &UHDControlPortImpl::set_clock_source);
+
+ this->register_getter("time_now", &UHDControlPortImpl::get_time_now);
+ this->register_setter("time_now", &UHDControlPortImpl::set_time_now);
+ this->register_getter("time_pps", &UHDControlPortImpl::get_time_pps);
+ this->register_setter("time_pps", &UHDControlPortImpl::set_time_pps);
}
void work(const InputItems &, const OutputItems &)
@@ -119,6 +129,58 @@ struct UHDControlPortImpl : public UHDControlPort
_usrp->set_command_time(time_spec);
}
+ /*******************************************************************
+ * time PPS
+ ******************************************************************/
+ uhd::time_spec_t get_time_pps(void)
+ {
+ return _usrp->get_time_last_pps(0);
+ }
+
+ void set_time_pps(const uhd::time_spec_t &time)
+ {
+ _usrp->set_time_next_pps(time, 0);
+ }
+
+ /*******************************************************************
+ * time NOW
+ ******************************************************************/
+ uhd::time_spec_t get_time_now(void)
+ {
+ return _usrp->get_time_now(0);
+ }
+
+ void set_time_now(const uhd::time_spec_t &time)
+ {
+ _usrp->set_time_now(time, 0);
+ }
+
+ /*******************************************************************
+ * time source
+ ******************************************************************/
+ std::string get_time_source(void)
+ {
+ return _usrp->get_time_source(0);
+ }
+
+ void set_time_source(const std::string &source)
+ {
+ _usrp->set_time_source(source, 0);
+ }
+
+ /*******************************************************************
+ * clock source
+ ******************************************************************/
+ std::string get_clock_source(void)
+ {
+ return _usrp->get_clock_source(0);
+ }
+
+ void set_clock_source(const std::string &source)
+ {
+ _usrp->set_clock_source(source, 0);
+ }
+
uhd::usrp::multi_usrp::sptr _usrp;
};
Please sign in to comment.
Something went wrong with that request. Please try again.