GNU Radio 3.4.2 C++ API
db_wbxng.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 //
00003 // Copyright 2009 Free Software Foundation, Inc.
00004 //
00005 // This file is part of GNU Radio
00006 //
00007 // GNU Radio is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either asversion 3, or (at your option)
00010 // any later version.
00011 //
00012 // GNU Radio is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with GNU Radio; see the file COPYING.  If not, write to
00019 // the Free Software Foundation, Inc., 51 Franklin Street,
00020 // Boston, MA 02110-1301, USA.
00021 
00022 #ifndef INCLUDED_DB_WBXNG_H
00023 #define INCLUDED_DB_WBXNG_H
00024 
00025 #include <usrp/db_base.h>
00026 #include <cmath>
00027 
00028 class adf4350;
00029 
00030 class wbxng_base : public db_base
00031 {
00032 public:
00033   wbxng_base(usrp_basic_sptr usrp, int which);
00034   ~wbxng_base();
00035 
00036   struct freq_result_t set_freq(double freq);
00037 
00038   bool  is_quadrature();
00039   double freq_min();
00040   double freq_max();
00041 
00042 protected:
00043   void _write_spi(std::string data);
00044   int _refclk_divisor();
00045   bool _get_locked();
00046   bool _set_pga(float pga_gain);
00047 
00048   bool d_first;
00049   int  d_spi_format;
00050   int  d_spi_enable;
00051   int  d_power_on;
00052   int  d_PD;
00053 
00054   boost::shared_ptr<adf4350> d_common;
00055 };
00056 
00057 // ----------------------------------------------------------------
00058 
00059 class db_wbxng_tx : public wbxng_base
00060 {
00061 protected:
00062   void shutdown();
00063 
00064 public:
00065   db_wbxng_tx(usrp_basic_sptr usrp, int which);
00066   ~db_wbxng_tx();
00067 
00068   float gain_min();
00069   float gain_max();
00070   float gain_db_per_step();
00071 
00072   bool set_auto_tr(bool on);
00073   bool set_enable(bool on);
00074   bool set_gain(float gain);
00075 };
00076 
00077 class db_wbxng_rx : public wbxng_base
00078 {
00079 protected:
00080   void shutdown();
00081   bool _set_attn(float attn);
00082 
00083 public:
00084   db_wbxng_rx(usrp_basic_sptr usrp, int which);
00085   ~db_wbxng_rx();
00086 
00087   bool set_auto_tr(bool on);
00088   bool select_rx_antenna(int which_antenna);
00089   bool select_rx_antenna(const std::string &which_antenna);
00090   bool set_gain(float gain);
00091 
00092   float gain_min();
00093   float gain_max();
00094   float gain_db_per_step();
00095   bool i_and_q_swapped();
00096 };
00097 
00098 #endif /* INCLUDED_DB_WBXNG_H */