diff options
author | Tom Rondeau | 2013-02-24 14:15:05 -0500 |
---|---|---|
committer | Tom Rondeau | 2013-02-24 14:15:05 -0500 |
commit | ffcaa3436cc8e608cb51bad78ca669b90bd110f2 (patch) | |
tree | 2d5735e89e81c36568c1f5699ff80c5213d7ada9 /gr-blocks/include/blocks | |
parent | 96583a9009478242c51ecfd7bb4321ed3d90e3b8 (diff) | |
download | gnuradio-ffcaa3436cc8e608cb51bad78ca669b90bd110f2.tar.gz gnuradio-ffcaa3436cc8e608cb51bad78ca669b90bd110f2.tar.bz2 gnuradio-ffcaa3436cc8e608cb51bad78ca669b90bd110f2.zip |
blocks: converted peak_detector2 and regenerate to v3.7.
Diffstat (limited to 'gr-blocks/include/blocks')
-rw-r--r-- | gr-blocks/include/blocks/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gr-blocks/include/blocks/peak_detector2_fb.h | 91 | ||||
-rw-r--r-- | gr-blocks/include/blocks/regenerate_bb.h | 80 |
3 files changed, 173 insertions, 0 deletions
diff --git a/gr-blocks/include/blocks/CMakeLists.txt b/gr-blocks/include/blocks/CMakeLists.txt index a6608696a..cd2fea672 100644 --- a/gr-blocks/include/blocks/CMakeLists.txt +++ b/gr-blocks/include/blocks/CMakeLists.txt @@ -126,6 +126,8 @@ install(FILES multiply_const_ff.h nlog10_ff.h patterned_interleaver.h + peak_detector2_fb.h + regenerate_bb.h repeat.h rms_cf.h rms_ff.h diff --git a/gr-blocks/include/blocks/peak_detector2_fb.h b/gr-blocks/include/blocks/peak_detector2_fb.h new file mode 100644 index 000000000..71afc3287 --- /dev/null +++ b/gr-blocks/include/blocks/peak_detector2_fb.h @@ -0,0 +1,91 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2013 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_GR_PEAK_DETECTOR2_FB_H +#define INCLUDED_GR_PEAK_DETECTOR2_FB_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Detect the peak of a signal + * \ingroup level_blk + * + * If a peak is detected, this block outputs a 1, or it outputs + * 0's. A separate debug output may be connected, to view the + * internal EWMA described below. + * + * \param threshold_factor_rise The threshold factor determins + * when a peak is present. An EWMA average of the signal is + * calculated and when the value of the signal goes over + * threshold_factor_rise*average, we call the peak. + * \param look_ahead The look-ahead value is used when the + * threshold is found to locate the peak within this range. + * \param alpha The gain value of a single-pole moving average filter. + */ + class BLOCKS_API peak_detector2_fb : virtual public gr_sync_block + { + public: + // gr::blocks::peak_detector2_fb::sptr + typedef boost::shared_ptr<peak_detector2_fb> sptr; + + static sptr make(float threshold_factor_rise=7, + int look_ahead=1000, float alpha=0.001); + + /*! \brief Set the threshold factor value for the rise time + * \param thr new threshold factor + */ + virtual void set_threshold_factor_rise(float thr) = 0; + + /*! \brief Set the look-ahead factor + * \param look new look-ahead factor + */ + virtual void set_look_ahead(int look) = 0; + + /*! \brief Set the running average alpha + * \param alpha new alpha for running average + */ + virtual void set_alpha(int alpha) = 0; + + /*! \brief Get the threshold factor value for the rise time + * \return threshold factor + */ + virtual float threshold_factor_rise() = 0; + + /*! \brief Get the look-ahead factor value + * \return look-ahead factor + */ + virtual int look_ahead() = 0; + + /*! \brief Get the alpha value of the running average + * \return alpha + */ + virtual float alpha() = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_PEAK_DETECTOR2_FB_H */ diff --git a/gr-blocks/include/blocks/regenerate_bb.h b/gr-blocks/include/blocks/regenerate_bb.h new file mode 100644 index 000000000..3063e70a7 --- /dev/null +++ b/gr-blocks/include/blocks/regenerate_bb.h @@ -0,0 +1,80 @@ +/* -*- c++ -*- */ +/* + * Copyright 2007,2013 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_GR_REGENERATE_BB_H +#define INCLUDED_GR_REGENERATE_BB_H + +#include <blocks/api.h> +#include <gr_sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief Detect the peak of a signal and repeat every period samples + * \ingroup level_blk + * + * If a peak is detected, this block outputs a 1 repeated every + * period samples until reset by detection of another 1 on the + * input or stopped after max_regen regenerations have occurred. + * + * Note that if max_regen=(-1)/ULONG_MAX then the regeneration + * will run forever. + */ + class BLOCKS_API regenerate_bb : virtual public gr_sync_block + { + public: + // gr::blocks::regenerate_bb::sptr + typedef boost::shared_ptr<regenerate_bb> sptr; + + /*! + * \brief Make a regenerate block + * \param period The number of samples between regenerations + * \param max_regen The maximum number of regenerations to + * perform; if set to ULONG_MAX, it will regenerate + * continuously. + */ + static sptr make(int period, unsigned int max_regen=500); + + /*! \brief Reset the maximum regeneration count; this will reset + the current regen. + */ + virtual void set_max_regen(unsigned int regen) = 0; + + /*! \brief Reset the period of regenerations; this will reset + the current regen. + */ + virtual void set_period(int period) = 0; + + /*! \brief return the maximum regeneration count. + */ + virtual unsigned int max_regen() const = 0; + + /*! \brief return the regeneration period. + */ + virtual int period() const = 0; + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_REGENERATE_BB_H */ |