summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2018-02-08 13:50:27 -0500
committerMartin Braun <martin.braun@ettus.com>2018-02-14 21:04:55 -0800
commitea468b8d1ff4283c8659487bcf4689e98d00d79e (patch)
tree14ae0783c2a18ebac4e1d2527c21c7ce264574ac
parent573d4c89f9ef4151b76eec8487c71adf4bbeebb0 (diff)
digital: add threshold set and get to Schmidl & Cox OFDM sync
Also add the callback to the GRC block.
-rw-r--r--gr-digital/grc/digital_ofdm_sync_sc_cfb.xml11
-rw-r--r--gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h7
-rw-r--r--gr-digital/lib/ofdm_sync_sc_cfb_impl.cc23
-rw-r--r--gr-digital/lib/ofdm_sync_sc_cfb_impl.h10
4 files changed, 42 insertions, 9 deletions
diff --git a/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml b/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml
index 4238df761c..e49677df3f 100644
--- a/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml
+++ b/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml
@@ -3,7 +3,8 @@
<name>Schmidl &amp; Cox OFDM synch.</name>
<key>digital_ofdm_sync_sc_cfb</key>
<import>from gnuradio import digital</import>
- <make>digital.ofdm_sync_sc_cfb($fft_len, $cp_len, $use_even_carriers)</make>
+ <make>digital.ofdm_sync_sc_cfb($fft_len, $cp_len, $use_even_carriers, $threshold)</make>
+ <callback>set_threshold($threshold)</callback>
<param>
<name>FFT length</name>
<key>fft_len</key>
@@ -29,6 +30,14 @@
<key>True</key>
</option>
</param>
+ <param>
+ <name>Threshold</name>
+ <key>threshold</key>
+ <value>0.9</value>
+ <type>real</type>
+ </param>
+ <check>$fft_len &gt; 0</check>
+ <check>$cp_len &gt;= 0</check>
<sink>
<name>in</name>
<type>complex</type>
diff --git a/gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h b/gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h
index d0dcfde7d9..701874037b 100644
--- a/gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h
+++ b/gr-digital/include/gnuradio/digital/ofdm_sync_sc_cfb.h
@@ -71,8 +71,13 @@ namespace gr {
* \param use_even_carriers If true, the carriers in the sync preamble are occupied such
* that the even carriers are used (0, 2, 4, ...). If you use all
* carriers, that would include the DC carrier, so be careful.
+ * \param threshold detection threshold. Default is 0.9.
*/
- static sptr make(int fft_len, int cp_len, bool use_even_carriers=false);
+ static sptr make(int fft_len, int cp_len, bool use_even_carriers=false,
+ float threshold=0.9);
+
+ virtual void set_threshold(float threshold) = 0;
+ virtual float threshold() const = 0;
};
} // namespace digital
diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
index 9b3e9687bc..2ebdef5413 100644
--- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
+++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.cc
@@ -27,7 +27,6 @@
#include <gnuradio/io_signature.h>
#include "ofdm_sync_sc_cfb_impl.h"
-#include <gnuradio/blocks/plateau_detector_fb.h>
#include <gnuradio/blocks/complex_to_arg.h>
#include <gnuradio/blocks/complex_to_mag_squared.h>
#include <gnuradio/blocks/conjugate_cc.h>
@@ -43,12 +42,12 @@ namespace gr {
namespace digital {
ofdm_sync_sc_cfb::sptr
- ofdm_sync_sc_cfb::make(int fft_len, int cp_len, bool use_even_carriers)
+ ofdm_sync_sc_cfb::make(int fft_len, int cp_len, bool use_even_carriers, float threshold)
{
- return gnuradio::get_initial_sptr (new ofdm_sync_sc_cfb_impl(fft_len, cp_len, use_even_carriers));
+ return gnuradio::get_initial_sptr (new ofdm_sync_sc_cfb_impl(fft_len, cp_len, use_even_carriers, threshold));
}
- ofdm_sync_sc_cfb_impl::ofdm_sync_sc_cfb_impl(int fft_len, int cp_len, bool use_even_carriers)
+ ofdm_sync_sc_cfb_impl::ofdm_sync_sc_cfb_impl(int fft_len, int cp_len, bool use_even_carriers, float threshold)
: hier_block2 ("ofdm_sync_sc_cfb",
io_signature::make(1, 1, sizeof (gr_complex)),
#ifndef SYNC_ADD_DEBUG_OUTPUT
@@ -72,7 +71,10 @@ namespace gr {
gr::blocks::complex_to_arg::sptr peak_to_angle(gr::blocks::complex_to_arg::make());
gr::blocks::sample_and_hold_ff::sptr sample_and_hold(gr::blocks::sample_and_hold_ff::make());
- gr::blocks::plateau_detector_fb::sptr plateau_detector(gr::blocks::plateau_detector_fb::make(cp_len));
+ gr::blocks::plateau_detector_fb::sptr plateau_detector(gr::blocks::plateau_detector_fb::make(cp_len, threshold));
+
+ // store plateau detector for use in callback setting threshold
+ d_plateau_detector = plateau_detector;
// Delay Path
connect(self(), 0, delay, 0);
@@ -106,6 +108,15 @@ namespace gr {
{
}
+ void ofdm_sync_sc_cfb_impl::set_threshold(float threshold)
+ {
+ d_plateau_detector->set_threshold(threshold);
+ }
+
+ float ofdm_sync_sc_cfb_impl::threshold() const
+ {
+ return d_plateau_detector->threshold();
+ }
+
} /* namespace digital */
} /* namespace gr */
-
diff --git a/gr-digital/lib/ofdm_sync_sc_cfb_impl.h b/gr-digital/lib/ofdm_sync_sc_cfb_impl.h
index af767e2a2b..aad805e028 100644
--- a/gr-digital/lib/ofdm_sync_sc_cfb_impl.h
+++ b/gr-digital/lib/ofdm_sync_sc_cfb_impl.h
@@ -24,6 +24,7 @@
#define INCLUDED_DIGITAL_OFDM_SYNC_SC_CFB_IMPL_H
#include <gnuradio/digital/ofdm_sync_sc_cfb.h>
+#include <gnuradio/blocks/plateau_detector_fb.h>
namespace gr {
namespace digital {
@@ -31,8 +32,15 @@ namespace gr {
class ofdm_sync_sc_cfb_impl : public ofdm_sync_sc_cfb
{
public:
- ofdm_sync_sc_cfb_impl(int fft_len, int cp_len, bool use_even_carriers);
+ ofdm_sync_sc_cfb_impl(int fft_len, int cp_len, bool use_even_carriers, float threshold);
~ofdm_sync_sc_cfb_impl();
+
+ virtual void set_threshold(float threshold);
+ virtual float threshold() const;
+
+ private:
+ gr::blocks::plateau_detector_fb::sptr d_plateau_detector;
+
};
} // namespace digital