GNU Radio's FUNCUBE Package
fcd.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 dl1ksv.
4  *
5  * SPDX-License-Identifier: GPL-3.0-or-later
6  */
7 
8 #ifndef INCLUDED_FUNCUBE_FCD_H
9 #define INCLUDED_FUNCUBE_FCD_H
10 
11 #include <gnuradio/hier_block2.h>
12 #include <funcube/api.h>
13 
14 namespace gr {
15 namespace funcube {
16 
17 /*!
18  * \brief Funcube Dongle source block.
19  * \ingroup funcube
20  *
21  * \details
22  * This class provides a Funcube Dongle source block by wrapping
23  * the USB audio interface and the USB HID control interface of
24  * the Funcube Dongle into one convenient source block.
25  *
26  * The Funcube Dongle needs to have firmware 18f or later for the
27  * control interface to work properly. As of early 2011, FCDs
28  * still come with firmware 18b. You can use qthid 2.2 (not 3) to
29  * upgrade the firmware: http://qthid.sf.net
30  */
31 class FUNCUBE_API fcd : virtual public gr::hier_block2
32 {
33 public:
34  typedef std::shared_ptr<fcd> sptr;
35 
36  /*!
37  * \brief Return a shared_ptr to a new instance of funcube::fcd.
38  *
39  * To avoid accidental use of raw pointers, funcube::fcd's
40  * constructor is in a private implementation
41  * class. funcube::fcd::make is the public interface for
42  * creating new instances.
43  */
44  static sptr make(const std::string device_name = "");
45  /*! \brief Set frequency with Hz resolution.
46  * \param freq The frequency in Hz
47  *
48  * This is a convenience function that uses float parameter in
49  * order to allow using engineering notation in GRC.
50  *
51  */
52  virtual void set_freq(float freq) = 0;
53 
54 
55  /*! \brief Set LNA gain.
56  * \param gain The new gain in dB.
57  *
58  * Set the LNA gain in the FCD. Valid range is -5 to
59  * 30. Although the LNA gain in the FCD takes enumerated values
60  * corresponding to 2.5 dB steps, you can can call this method
61  * with any float value and it will be rounded to the nearest
62  * valid value.
63  *
64  * By default the LNA gain is set to 20 dB and this is a good value for
65  * most cases. In noisy areas you may try to reduce the gain.
66  */
67  virtual void set_lna_gain(float gain) = 0;
68 
69  /*! \brief Set mixer gain.
70  * \param gain The new gain in dB.
71  *
72  * Set the mixer gain in the FCD. Valid values are +4 and +12 dB.
73  *
74  * By default the mixer gain is set to +12 dB and this is a good
75  * value for most cases. In noisy areas you may try to reduce
76  * the gain.
77  */
78  virtual void set_mixer_gain(float gain) = 0;
79 
80  /*! \brief Set new frequency correction.
81  * \param ppm The new frequency correction in parts per million
82  *
83  * Version 1.1 FCDs (S/N 810 or later) need a correction of -12
84  * ppm. Earlier FCDs need roughly -120 ppm (default for
85  * gr-fcd).
86  *
87  * Ref: http://www.funcubedongle.com/?p=617
88  */
89  virtual void set_freq_corr(int ppm) = 0;
90 
91  /*! \brief Set DC offset correction.
92  * \param _dci DC correction for I component (-1.0 to 1.0)
93  * \param _dcq DC correction for Q component (-1.0 to 1.0)
94  *
95  * Set DC offset correction in the device. Default is 0.0.
96  */
97  virtual void set_dc_corr(double _dci, double _dcq) = 0;
98 
99  /*! \brief Set IQ phase and gain balance.
100  * \param _gain The gain correction (-1.0 to 1.0)
101  * \param _phase The phase correction (-1.0 to 1.0)
102  *
103  * Set IQ phase and gain balance in the device. The default values
104  * are 0.0 for phase and 1.0 for gain.
105  */
106  virtual void set_iq_corr(double _gain, double _phase) = 0;
107 };
108 
109 } // namespace funcube
110 } // namespace gr
111 
112 #endif /* INCLUDED_FUNCUBE_FCD_H */
#define FUNCUBE_API
Definition: api.h:19
Funcube Dongle source block.
Definition: fcd.h:32
static sptr make(const std::string device_name="")
Return a shared_ptr to a new instance of funcube::fcd.
std::shared_ptr< fcd > sptr
Definition: fcd.h:34
virtual void set_iq_corr(double _gain, double _phase)=0
Set IQ phase and gain balance.
virtual void set_freq(float freq)=0
Set frequency with Hz resolution.
virtual void set_lna_gain(float gain)=0
Set LNA gain.
virtual void set_mixer_gain(float gain)=0
Set mixer gain.
virtual void set_dc_corr(double _dci, double _dcq)=0
Set DC offset correction.
virtual void set_freq_corr(int ppm)=0
Set new frequency correction.
Definition: fcd.h:14