From f968b36d4ed2b194111585605f9a1b5367638fb3 Mon Sep 17 00:00:00 2001 From: Martin Braun <martin.braun@kit.edu> Date: Fri, 15 Mar 2013 02:12:20 -0700 Subject: Squash/rebased martin/ofdm-master onto trial merge branch Conflicts: gr-blocks/include/blocks/CMakeLists.txt --- gr-analog/include/analog/CMakeLists.txt | 3 +- gr-analog/include/analog/plateau_detector_fb.h | 71 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 gr-analog/include/analog/plateau_detector_fb.h (limited to 'gr-analog/include') diff --git a/gr-analog/include/analog/CMakeLists.txt b/gr-analog/include/analog/CMakeLists.txt index b113dacc44..a44f119d36 100644 --- a/gr-analog/include/analog/CMakeLists.txt +++ b/gr-analog/include/analog/CMakeLists.txt @@ -105,8 +105,7 @@ install(FILES rail_ff.h rotator.h sig_source_waveform.h - simple_squelch_cc.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog + simple_squelch_cc.h plateau_detector_fb.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog COMPONENT "analog_devel" ) diff --git a/gr-analog/include/analog/plateau_detector_fb.h b/gr-analog/include/analog/plateau_detector_fb.h new file mode 100644 index 0000000000..33629bd18b --- /dev/null +++ b/gr-analog/include/analog/plateau_detector_fb.h @@ -0,0 +1,71 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H +#define INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H + +#include <analog/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace analog { + + /*! + * \brief Detects a plateau and marks the middle. + * + * Detect a plateau of a-priori known height. Input is a stream of floats, + * the output is a stream of bytes. Whenever a plateau is detected, the + * middle of that plateau is marked with a '1' on the output stream (all + * other samples are left at zero). + * + * You can use this in a Schmidl & Cox synchronisation algorithm to interpret + * the output of the normalized correlator. Just pass the length of the cyclic + * prefix (in samples) as the max_len parameter). + * + * Unlike the peak detectors, you must the now the absolute height of the plateau. + * Whenever the amplitude exceeds the given threshold, it starts assuming the + * presence of a plateau. + * + * An implicit hysteresis is provided by the fact that after detecting one plateau, + * it waits at least max_len samples before the next plateau can be detected. + * + * \ingroup analog + * + */ + class ANALOG_API plateau_detector_fb : virtual public gr_sync_block + { + public: + typedef boost::shared_ptr<plateau_detector_fb> sptr; + + /*! + * \param max_len Maximum length of the plateau + * \param threshold Anything above this value is considered a plateau + */ + static sptr make(int max_len, float threshold=0.9); + }; + + } // namespace analog +} // namespace gr + +#endif /* INCLUDED_ANALOG_PLATEAU_DETECTOR_FB_H */ + -- cgit v1.2.3 From 928a9ada1c7caa739ee57f49da4446a04d301b12 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan <johnathan@corganlabs.com> Date: Fri, 15 Mar 2013 03:15:21 -0700 Subject: analog: minor cleanup for added block --- gr-analog/include/analog/CMakeLists.txt | 4 +++- gr-analog/lib/CMakeLists.txt | 3 ++- gr-analog/python/CMakeLists.txt | 2 +- gr-analog/swig/analog_swig.i | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'gr-analog/include') diff --git a/gr-analog/include/analog/CMakeLists.txt b/gr-analog/include/analog/CMakeLists.txt index a44f119d36..f46960c984 100644 --- a/gr-analog/include/analog/CMakeLists.txt +++ b/gr-analog/include/analog/CMakeLists.txt @@ -93,6 +93,7 @@ install(FILES fmdet_cf.h frequency_modulator_fc.h phase_modulator_fc.h + plateau_detector_fb.h pll_carriertracking_cc.h pll_freqdet_cf.h pll_refout_cc.h @@ -105,7 +106,8 @@ install(FILES rail_ff.h rotator.h sig_source_waveform.h - simple_squelch_cc.h plateau_detector_fb.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog + simple_squelch_cc.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/analog COMPONENT "analog_devel" ) diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index ecc459cd3a..396ff04654 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -121,6 +121,7 @@ list(APPEND analog_sources fmdet_cf_impl.cc frequency_modulator_fc_impl.cc phase_modulator_fc_impl.cc + plateau_detector_fb_impl.cc pll_carriertracking_cc_impl.cc pll_freqdet_cf_impl.cc pll_refout_cc_impl.cc @@ -157,7 +158,7 @@ list(APPEND analog_libs ${Boost_LIBRARIES} ) -add_library(gnuradio-analog SHARED ${analog_sources} plateau_detector_fb_impl.cc) +add_library(gnuradio-analog SHARED ${analog_sources}) target_link_libraries(gnuradio-analog ${analog_libs}) GR_LIBRARY_FOO(gnuradio-analog RUNTIME_COMPONENT "analog_runtime" DEVEL_COMPONENT "analog_devel") add_dependencies(gnuradio-analog analog_generated_includes analog_generated_swigs gnuradio-filter) diff --git a/gr-analog/python/CMakeLists.txt b/gr-analog/python/CMakeLists.txt index 5fabe75ca2..af4ed578f3 100644 --- a/gr-analog/python/CMakeLists.txt +++ b/gr-analog/python/CMakeLists.txt @@ -49,4 +49,4 @@ foreach(py_qa_test_file ${py_qa_test_files}) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) -GR_ADD_TEST(qa_plateau_detector_fb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_plateau_detector_fb.py) + diff --git a/gr-analog/swig/analog_swig.i b/gr-analog/swig/analog_swig.i index ca9220f4c6..96f4e23a8c 100644 --- a/gr-analog/swig/analog_swig.i +++ b/gr-analog/swig/analog_swig.i @@ -46,6 +46,7 @@ #include "analog/noise_source_f.h" #include "analog/noise_source_c.h" #include "analog/phase_modulator_fc.h" +#include "analog/plateau_detector_fb.h" #include "analog/pll_carriertracking_cc.h" #include "analog/pll_freqdet_cf.h" #include "analog/pll_refout_cc.h" @@ -65,7 +66,6 @@ #include "analog/simple_squelch_cc.h" #include "analog/squelch_base_cc.h" #include "analog/squelch_base_ff.h" -#include "analog/plateau_detector_fb.h" %} %include "analog/cpm.h" @@ -86,6 +86,7 @@ %include "analog/noise_source_f.h" %include "analog/noise_source_c.h" %include "analog/phase_modulator_fc.h" +%include "analog/plateau_detector_fb.h" %include "analog/pll_carriertracking_cc.h" %include "analog/pll_freqdet_cf.h" %include "analog/pll_refout_cc.h" @@ -121,6 +122,7 @@ GR_SWIG_BLOCK_MAGIC2(analog, noise_source_i); GR_SWIG_BLOCK_MAGIC2(analog, noise_source_f); GR_SWIG_BLOCK_MAGIC2(analog, noise_source_c); GR_SWIG_BLOCK_MAGIC2(analog, phase_modulator_fc); +GR_SWIG_BLOCK_MAGIC2(analog, plateau_detector_fb); GR_SWIG_BLOCK_MAGIC2(analog, pll_carriertracking_cc); GR_SWIG_BLOCK_MAGIC2(analog, pll_freqdet_cf); GR_SWIG_BLOCK_MAGIC2(analog, pll_refout_cc); @@ -136,5 +138,3 @@ GR_SWIG_BLOCK_MAGIC2(analog, sig_source_i); GR_SWIG_BLOCK_MAGIC2(analog, sig_source_f); GR_SWIG_BLOCK_MAGIC2(analog, sig_source_c); GR_SWIG_BLOCK_MAGIC2(analog, simple_squelch_cc); -%include "analog/plateau_detector_fb.h" -GR_SWIG_BLOCK_MAGIC2(analog, plateau_detector_fb); -- cgit v1.2.3