Updated license from GPL version 2 or later to GPL version 3 or later.
[debian/gnuradio] / gnuradio-core / src / lib / io / microtune_eval_board.i
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2003 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 /*
24  * SWIG interface defs for Microtune 4937 and eval board with Eric's daughterboard
25  */
26
27 /*!
28  * \brief abstract class for controlling microtune 4937 tuner module
29  */
30 class microtune_4937 {
31 public:
32   microtune_4937 ();
33
34   virtual ~microtune_4937 ();
35
36   // returns actual freq or 0 if error (easier interface for SWIG)
37   double set_RF_freq (double freq);
38   
39   /*!
40    * \returns true iff PLL is locked
41    */
42   bool pll_locked_p ();
43   
44   /*!
45    * \returns the output frequency (IF center freq) of the tuner in Hz.
46    */
47   double get_output_freq ();
48
49
50  private:
51   //! \returns true iff successful
52   virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes) = 0;
53
54   //! \returns number of bytes read or -1 if error
55   virtual int i2c_read (int addr, unsigned char *buf, int max_bytes) = 0;
56
57   int   d_reference_divider;
58   bool  d_fast_tuning_p;        /* if set, higher charge pump current:
59                                    faster tuning, worse phase noise
60                                    for distance < 10kHz to the carrier */
61 };
62
63 /*!
64  * \brief concrete class for controlling microtune 4937 eval board attached to parallel port
65  */
66 class microtune_eval_board : public microtune_4937 {
67 public:
68   microtune_eval_board (int which_pp = 0);
69   ~microtune_eval_board ();
70
71   //! is the eval board present?
72   bool board_present_p ();
73
74   /*!
75    * \brief set RF and IF AGC control voltages ([0, 5] volts)
76    */
77   void set_RF_AGC_voltage (float volts);
78   void set_IF_AGC_voltage (float volts);
79
80   /*!
81    * \brief set RF and IF AGC levels together (scale [0, 1000])
82    *
83    * This provides a simple linear interface for adjusting both
84    * the RF and IF gain in consort.  This is the easy to use interface.
85    * 0 corresponds to minimum gain. 1000 corresponds to maximum gain.
86    */
87   void set_AGC (float value_0_1000);
88
89 private:
90   //! \returns true iff successful
91   virtual bool i2c_write (int addr, const unsigned char *buf, int nbytes);
92
93   //! \returns number of bytes read or -1 if error
94   virtual int i2c_read (int addr, unsigned char *buf, int max_bytes);
95 };