summaryrefslogtreecommitdiff
path: root/gr-digital/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/lib')
-rw-r--r--gr-digital/lib/digital_fll_band_edge_cc.cc72
-rw-r--r--gr-digital/lib/digital_fll_band_edge_cc.h48
2 files changed, 99 insertions, 21 deletions
diff --git a/gr-digital/lib/digital_fll_band_edge_cc.cc b/gr-digital/lib/digital_fll_band_edge_cc.cc
index 4c4f5fbf2..70cb54351 100644
--- a/gr-digital/lib/digital_fll_band_edge_cc.cc
+++ b/gr-digital/lib/digital_fll_band_edge_cc.cc
@@ -75,18 +75,12 @@ digital_fll_band_edge_cc::digital_fll_band_edge_cc (float samps_per_sym, float r
}
d_filter_size = filter_size;
- // Initialize loop bandwidth
- if(bandwidth < 0) {
- throw std::out_of_range ("digital_fll_band_edge_cc: invalid bandwidth. Must be >= 0.");
- }
- d_loop_bw = bandwidth;
-
// base this on the number of samples per symbol
d_max_freq = M_TWOPI * (2.0/samps_per_sym);
d_min_freq = -M_TWOPI * (2.0/samps_per_sym);
// Set the damping factor for a critically damped system
- d_damping = sqrt(2.0)/2.0;
+ d_damping = sqrtf(2.0f)/2.0f;
// Set the bandwidth, which will then call update_gains()
set_loop_bandwidth(bandwidth);
@@ -103,6 +97,12 @@ digital_fll_band_edge_cc::~digital_fll_band_edge_cc ()
{
}
+
+/*******************************************************************
+ SET FUNCTIONS
+*******************************************************************/
+
+
void
digital_fll_band_edge_cc::set_loop_bandwidth(float bw)
{
@@ -173,48 +173,92 @@ digital_fll_band_edge_cc::set_filter_size(int filter_size)
design_filter(d_sps, d_rolloff, d_filter_size);
}
+void
+digital_fll_band_edge_cc::set_frequency(float freq)
+{
+ if(freq > d_max_freq)
+ d_freq = d_min_freq;
+ else if(freq < d_min_freq)
+ d_freq = d_max_freq;
+ else
+ d_freq = freq;
+}
+
+void
+digital_fll_band_edge_cc::set_phase(float phase)
+{
+ d_phase = phase;
+ while(d_phase>M_TWOPI)
+ d_phase -= M_TWOPI;
+ while(d_phase<-M_TWOPI)
+ d_phase += M_TWOPI;
+}
+
+
+/*******************************************************************
+ GET FUNCTIONS
+*******************************************************************/
+
+
float
-digital_fll_band_edge_cc::get_loop_bandwidth()
+digital_fll_band_edge_cc::get_loop_bandwidth() const
{
return d_loop_bw;
}
float
-digital_fll_band_edge_cc::get_damping_factor()
+digital_fll_band_edge_cc::get_damping_factor() const
{
return d_damping;
}
float
-digital_fll_band_edge_cc::get_alpha()
+digital_fll_band_edge_cc::get_alpha() const
{
return d_alpha;
}
float
-digital_fll_band_edge_cc::get_beta()
+digital_fll_band_edge_cc::get_beta() const
{
return d_beta;
}
float
-digital_fll_band_edge_cc::get_samples_per_symbol()
+digital_fll_band_edge_cc::get_samples_per_symbol() const
{
return d_sps;
}
float
-digital_fll_band_edge_cc::get_rolloff()
+digital_fll_band_edge_cc::get_rolloff() const
{
return d_rolloff;
}
int
-digital_fll_band_edge_cc:: get_filter_size()
+digital_fll_band_edge_cc:: get_filter_size() const
{
return d_filter_size;
}
+float
+digital_fll_band_edge_cc::get_frequency() const
+{
+ return d_freq;
+}
+
+float
+digital_fll_band_edge_cc::get_phase() const
+{
+ return d_phase;
+}
+
+
+/*******************************************************************
+*******************************************************************/
+
+
void
digital_fll_band_edge_cc::update_gains()
{
diff --git a/gr-digital/lib/digital_fll_band_edge_cc.h b/gr-digital/lib/digital_fll_band_edge_cc.h
index f59b9becd..496289d90 100644
--- a/gr-digital/lib/digital_fll_band_edge_cc.h
+++ b/gr-digital/lib/digital_fll_band_edge_cc.h
@@ -236,6 +236,30 @@ public:
*/
void set_filter_size(int filter_size);
+ /*!
+ * \brief Set the FLL's frequency.
+ *
+ * Set's the FLL's frequency. While this is normally updated by the
+ * inner loop of the algorithm, it could be useful to manually initialize,
+ * set, or reset this under certain circumstances.
+ *
+ * \param freq (float) new frequency
+ *
+ */
+ void set_frequency(float freq);
+
+ /*!
+ * \brief Set the FLL's phase.
+ *
+ * Set's the FLL's phase. While this is normally updated by the
+ * inner loop of the algorithm, it could be useful to manually initialize,
+ * set, or reset this under certain circumstances.
+ *
+ * \param phase (float) new phase
+ *
+ */
+ void set_phase(float phase);
+
/*******************************************************************
GET FUNCTIONS
*******************************************************************/
@@ -243,37 +267,47 @@ public:
/*!
* \brief Returns the loop bandwidth
*/
- float get_loop_bandwidth();
+ float get_loop_bandwidth() const;
/*!
* \brief Returns the loop damping factor
*/
- float get_damping_factor();
+ float get_damping_factor() const;
/*!
* \brief Returns the loop gain alpha
*/
- float get_alpha();
+ float get_alpha() const;
/*!
* \brief Returns the loop gain beta
*/
- float get_beta();
+ float get_beta() const;
/*!
* \brief Returns the number of sampler per symbol used for the filter
*/
- float get_samples_per_symbol();
+ float get_samples_per_symbol() const;
/*!
* \brief Returns the rolloff factor used for the filter
*/
- float get_rolloff();
+ float get_rolloff() const;
/*!
* \brief Returns the number of taps of the filter
*/
- int get_filter_size();
+ int get_filter_size() const;
+
+ /*!
+ * \brief Get the FLL's frequency estimate
+ */
+ float get_frequency() const;
+
+ /*!
+ * \brief Get the FLL's phase estimate
+ */
+ float get_phase() const;
/*!
* Print the taps to screen.