From 98c703b3282b47ae2e0deaf317468f789cc9176e Mon Sep 17 00:00:00 2001
From: Dimitri Stolnikov
Date: Sun, 1 Apr 2012 16:35:30 -0700
Subject: fcd: adds setter function to configure mixer gain
---
gr-fcd/grc/fcd_source_c.xml | 15 ++++++++++++++-
gr-fcd/include/fcd/fcd_source_c.h | 14 ++++++++++++--
gr-fcd/lib/fcd_source_c_impl.cc | 16 ++++++++++++++++
gr-fcd/lib/fcd_source_c_impl.h | 1 +
gr-fcd/swig/fcd_source_c.i | 1 +
5 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/gr-fcd/grc/fcd_source_c.xml b/gr-fcd/grc/fcd_source_c.xml
index 8572e6da1..7c55239aa 100644
--- a/gr-fcd/grc/fcd_source_c.xml
+++ b/gr-fcd/grc/fcd_source_c.xml
@@ -9,6 +9,9 @@
#if $lna() != 20.0
self.$(id).set_lna_gain($lna)
#end if
+#if $mixer() != +12.0
+self.$(id).set_mixer_gain($mixer)
+#end if
#if $ppm() != 115
self.$(id).set_freq_corr($ppm)
#end if
@@ -22,6 +25,7 @@ self.$(id).set_freq($freq)
set_freq($freq)
set_lna_gain($lna)
+ set_mixer_gain($mixer)
set_freq_corr($ppm)
set_dc_corr($dci,$dcq)
set_iq_corr($iq_gain,$iq_phase)
@@ -44,6 +48,12 @@ self.$(id).set_freq($freq)
20.0
real
+
+ Mixer Gain (dB)
+ mixer
+ +12
+ real
+
Frequency corr. (ppm)
ppm
@@ -94,7 +104,10 @@ To find the device name on Linux type:
The LNA gain is a set of discrete values between -5 to 30 dB with 2.5 dB step, but you can \
use any float value and it will be rounded to the nearest valid value.
-
+
+The Mixer gain can be set either to +4 or +12 dB, but you can use any float value \
+and it will be rounded to the nearest valid value.
+
The FCD block can autmatically apply frequency correction:
- For FCD v1.0 you can leave at -120 ppm
- For FCD v1.1 with serial number 810 or greater use -12 ppm
diff --git a/gr-fcd/include/fcd/fcd_source_c.h b/gr-fcd/include/fcd/fcd_source_c.h
index 31393418f..988925c2e 100644
--- a/gr-fcd/include/fcd/fcd_source_c.h
+++ b/gr-fcd/include/fcd/fcd_source_c.h
@@ -88,11 +88,21 @@ public:
* 2.5 dB steps, you can can call this method with any float value
* and it will be rounded to the nearest valid value.
*
- * By default the FCD is set to 20 dB and this is a good value for most
- * cases. In noisy areas you may try to reduce the gain.
+ * By default the LNA gain is set to 20 dB and this is a good value for
+ * most cases. In noisy areas you may try to reduce the gain.
*/
virtual void set_lna_gain(float gain) = 0;
+ /*! \brief Set mixer gain.
+ * \param gain The new gain in dB.
+ *
+ * Set the mixer gain in the FCD. Valid values are +4 and +12 dB.
+ *
+ * By default the mixer gain is set to +12 dB and this is a good value for
+ * most cases. In noisy areas you may try to reduce the gain.
+ */
+ virtual void set_mixer_gain(float gain) = 0;
+
/*! \brief Set new frequency correction.
* \param ppm The new frequency correction in parts per million
*
diff --git a/gr-fcd/lib/fcd_source_c_impl.cc b/gr-fcd/lib/fcd_source_c_impl.cc
index a67d5bdbb..9543f16eb 100644
--- a/gr-fcd/lib/fcd_source_c_impl.cc
+++ b/gr-fcd/lib/fcd_source_c_impl.cc
@@ -173,6 +173,22 @@ void fcd_source_c_impl::set_lna_gain(float gain)
/* TODO: check fme */
}
+// Set mixer gain
+void fcd_source_c_impl::set_mixer_gain(float gain)
+{
+ FCD_MODE_ENUM fme;
+ unsigned char g;
+
+ if ( gain > 4.0 ) {
+ g = TMGE_P12_0DB;
+ } else {
+ g = TMGE_P4_0DB;
+ }
+
+ fme = fcdAppSetParam(FCD_CMD_APP_SET_MIXER_GAIN, &g, 1);
+ /* TODO: check fme */
+}
+
// Set new frequency correction
void fcd_source_c_impl::set_freq_corr(int ppm)
{
diff --git a/gr-fcd/lib/fcd_source_c_impl.h b/gr-fcd/lib/fcd_source_c_impl.h
index e4a7467c5..d082ecc1e 100644
--- a/gr-fcd/lib/fcd_source_c_impl.h
+++ b/gr-fcd/lib/fcd_source_c_impl.h
@@ -32,6 +32,7 @@ public:
void set_freq(float freq);
void set_freq_khz(int freq);
void set_lna_gain(float gain);
+ void set_mixer_gain(float gain);
void set_freq_corr(int ppm);
void set_dc_corr(double _dci, double _dcq);
void set_iq_corr(double _gain, double _phase);
diff --git a/gr-fcd/swig/fcd_source_c.i b/gr-fcd/swig/fcd_source_c.i
index 3438ab74d..77fcf8a42 100644
--- a/gr-fcd/swig/fcd_source_c.i
+++ b/gr-fcd/swig/fcd_source_c.i
@@ -15,6 +15,7 @@ public:
void set_freq(float freq);
void set_freq_khz(int freq);
void set_lna_gain(float gain);
+ void set_mixer_gain(float gain);
void set_freq_corr(int ppm);
void set_dc_corr(double dci, double dcq);
void set_iq_corr(double gain, double phase);
--
cgit