aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-01-05 19:07:08 -0800
committerJosh Blum <josh@joshknows.com>2011-01-05 19:07:08 -0800
commit612c84beb6015d7cf0fee918aa01944e20de5472 (patch)
tree327617fcb92efcb6d059dee40ea1ad6e5b610734
parent94ce8759ca0093e39e9c9db0e4ca4e6f55c098a2 (diff)
downloaduhd-612c84beb6015d7cf0fee918aa01944e20de5472.tar.gz
uhd-612c84beb6015d7cf0fee918aa01944e20de5472.tar.bz2
uhd-612c84beb6015d7cf0fee918aa01944e20de5472.zip
uhd: added convenience factory functions for clock config (external/internal)
-rw-r--r--host/include/uhd/types/clock_config.hpp7
-rw-r--r--host/lib/types.cpp20
2 files changed, 24 insertions, 3 deletions
diff --git a/host/include/uhd/types/clock_config.hpp b/host/include/uhd/types/clock_config.hpp
index 5966dcf3a..a72eb63de 100644
--- a/host/include/uhd/types/clock_config.hpp
+++ b/host/include/uhd/types/clock_config.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -28,6 +28,11 @@ namespace uhd{
* The source and polarity for the PPS clock.
*/
struct UHD_API clock_config_t{
+ //------ simple usage --------//
+ static clock_config_t external(void);
+ static clock_config_t internal(void);
+
+ //------ advanced usage --------//
enum ref_source_t {
REF_AUTO = 'a', //automatic (device specific)
REF_INT = 'i', //internal reference
diff --git a/host/lib/types.cpp b/host/lib/types.cpp
index 8ccb664d5..dce8d0828 100644
--- a/host/lib/types.cpp
+++ b/host/lib/types.cpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010 Ettus Research LLC
+// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -78,10 +78,26 @@ std::string tune_result_t::to_pp_string(void) const{
/***********************************************************************
* clock config
**********************************************************************/
+clock_config_t clock_config_t::external(void){
+ clock_config_t clock_config;
+ clock_config.ref_source = clock_config_t::REF_SMA;
+ clock_config.pps_source = clock_config_t::PPS_SMA;
+ clock_config.pps_polarity = clock_config_t::PPS_POS;
+ return clock_config;
+}
+
+clock_config_t clock_config_t::internal(void){
+ clock_config_t clock_config;
+ clock_config.ref_source = clock_config_t::REF_INT;
+ clock_config.pps_source = clock_config_t::PPS_INT;
+ clock_config.pps_polarity = clock_config_t::PPS_POS;
+ return clock_config;
+}
+
clock_config_t::clock_config_t(void):
ref_source(REF_INT),
pps_source(PPS_INT),
- pps_polarity(PPS_NEG)
+ pps_polarity(PPS_POS)
{
/* NOP */
}