- added jay_add and jay_peak_detect
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@431 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -8,15 +8,21 @@
|
||||
projectFiles="true"
|
||||
root="../include/jay">
|
||||
<itemPath>../include/jay/CMakeLists.txt</itemPath>
|
||||
<itemPath>../include/jay/add.h</itemPath>
|
||||
<itemPath>../include/jay/api.h</itemPath>
|
||||
<itemPath>../include/jay/bit_packer.h</itemPath>
|
||||
<itemPath>../include/jay/bit_slicer.h</itemPath>
|
||||
<itemPath>../include/jay/peak_detect.h</itemPath>
|
||||
<itemPath>../include/jay/pocsag_decoder.h</itemPath>
|
||||
<itemPath>../include/jay/square2_ff.h</itemPath>
|
||||
<itemPath>../include/jay/square_ff.h</itemPath>
|
||||
</logicalFolder>
|
||||
<df root="../lib" name="1">
|
||||
<in>PocsagDecoder.cpp</in>
|
||||
<in>add_impl.cc</in>
|
||||
<in>bit_packer_impl.cc</in>
|
||||
<in>bit_slicer_impl.cc</in>
|
||||
<in>peak_detect_impl.cc</in>
|
||||
<in>pocsag_decoder_impl.cc</in>
|
||||
<in>qa_jay.cc</in>
|
||||
<in>square2_ff_impl.cc</in>
|
||||
@@ -27,9 +33,6 @@
|
||||
displayName="swig"
|
||||
projectFiles="true"
|
||||
root="../build/swig">
|
||||
<itemPath>../build/swig/_jay_swig_swig_tag.cpp</itemPath>
|
||||
<itemPath>../build/swig/jay_swigPYTHON_wrap.cxx</itemPath>
|
||||
<itemPath>../build/swig/jay_swig_swig_2d0df.cpp</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="ExternalFiles"
|
||||
displayName="Important Files"
|
||||
@@ -55,6 +58,7 @@
|
||||
<flagsDictionary>
|
||||
<element flagsID="0" commonFlags="-O3"/>
|
||||
<element flagsID="1" commonFlags="-O3 -fPIC"/>
|
||||
<element flagsID="2" commonFlags="-fPIC"/>
|
||||
</flagsDictionary>
|
||||
<codeAssistance>
|
||||
</codeAssistance>
|
||||
@@ -69,10 +73,8 @@
|
||||
<pElem>../lib</pElem>
|
||||
<pElem>../include</pElem>
|
||||
<pElem>../build/lib</pElem>
|
||||
<pElem>../build/include</pElem>
|
||||
</incDir>
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</makeTool>
|
||||
<preBuild>
|
||||
@@ -80,60 +82,40 @@
|
||||
<preBuildCommand></preBuildCommand>
|
||||
</preBuild>
|
||||
</makefileType>
|
||||
<item path="../build/swig/_jay_swig_swig_tag.cpp"
|
||||
ex="false"
|
||||
tool="1"
|
||||
flavor2="11">
|
||||
<ccTool flags="0">
|
||||
<incDir>
|
||||
<pElem>../build/include</pElem>
|
||||
<pElem>../build/swig</pElem>
|
||||
<pElem>../swig</pElem>
|
||||
<pElem>/usr/include/gnuradio/swig</pElem>
|
||||
<pElem>/usr/include/python2.7</pElem>
|
||||
</incDir>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../build/swig/jay_swigPYTHON_wrap.cxx"
|
||||
ex="false"
|
||||
tool="1"
|
||||
flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<incDir>
|
||||
<pElem>../build/include</pElem>
|
||||
<pElem>../build/swig</pElem>
|
||||
<pElem>../swig</pElem>
|
||||
<pElem>/usr/include/gnuradio/swig</pElem>
|
||||
<pElem>/usr/include/python2.7</pElem>
|
||||
</incDir>
|
||||
<preprocessorList>
|
||||
<Elem>_jay_swig_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../build/swig/jay_swig_swig_2d0df.cpp"
|
||||
ex="false"
|
||||
tool="1"
|
||||
flavor2="11">
|
||||
<ccTool flags="0">
|
||||
<incDir>
|
||||
<pElem>../build/include</pElem>
|
||||
<pElem>../build/swig</pElem>
|
||||
<pElem>../swig</pElem>
|
||||
<pElem>/usr/include/gnuradio/swig</pElem>
|
||||
<pElem>/usr/include/python2.7</pElem>
|
||||
</incDir>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/PocsagDecoder.cpp" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/bit_slicer_impl.cc" ex="false" tool="1" flavor2="0">
|
||||
<item path="../lib/add_impl.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/bit_packer_impl.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/bit_slicer_impl.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/peak_detect_impl.cc" ex="false" tool="1" flavor2="0">
|
||||
<ccTool flags="2">
|
||||
<preprocessorList>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
@@ -142,17 +124,22 @@
|
||||
<item path="../lib/pocsag_decoder_impl.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/qa_jay.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="0">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/square2_ff_impl.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
@@ -160,18 +147,25 @@
|
||||
<item path="../lib/square_ff_impl.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="1">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
<Elem>gnuradio_jay_EXPORTS</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<item path="../lib/test_jay.cc" ex="false" tool="1" flavor2="11">
|
||||
<ccTool flags="0">
|
||||
<preprocessorList>
|
||||
<Elem>NDEBUG</Elem>
|
||||
</preprocessorList>
|
||||
</ccTool>
|
||||
</item>
|
||||
<folder path="1">
|
||||
<folder path="swig">
|
||||
<ccTool>
|
||||
<incDir>
|
||||
<pElem>../build/include</pElem>
|
||||
<pElem>../build/swig</pElem>
|
||||
<pElem>../swig</pElem>
|
||||
<pElem>/usr/include/gnuradio/swig</pElem>
|
||||
<pElem>/usr/include/python2.7</pElem>
|
||||
</incDir>
|
||||
</ccTool>
|
||||
</folder>
|
||||
|
||||
@@ -1 +1 @@
|
||||
/home/jens/work/software/projects/GnuRadio/gr-jay/lib/bit_slicer_impl.cc=/home/jens/work/software/projects/GnuRadio/gr-jay/build/lib#-Dgnuradio_jay_EXPORTS -I/home/jens/work/software/projects/GnuRadio/gr-jay/lib -I/home/jens/work/software/projects/GnuRadio/gr-jay/include -I/home/jens/work/software/projects/GnuRadio/gr-jay/build/lib -I/home/jens/work/software/projects/GnuRadio/gr-jay/build/include -O3 -DNDEBUG -fPIC -fvisibility=hidden -o CMakeFiles/gnuradio-jay.dir/bit_slicer_impl.cc.o -c /home/jens/work/software/projects/GnuRadio/gr-jay/lib/bit_slicer_impl.cc
|
||||
/home/jens/work/software/projects/GnuRadio/gr-jay/lib/peak_detect_impl.cc=/home/jens/work/software/projects/GnuRadio/gr-jay/build/lib#-Dgnuradio_jay_EXPORTS -I/home/jens/work/software/projects/GnuRadio/gr-jay/lib -I/home/jens/work/software/projects/GnuRadio/gr-jay/include -I/home/jens/work/software/projects/GnuRadio/gr-jay/build/lib -I/home/jens/work/software/projects/GnuRadio/gr-jay/build/include -g -fPIC -fvisibility=hidden -o CMakeFiles/gnuradio-jay.dir/peak_detect_impl.cc.o -c /home/jens/work/software/projects/GnuRadio/gr-jay/lib/peak_detect_impl.cc
|
||||
|
||||
@@ -6,8 +6,14 @@
|
||||
<df root="../lib" name="1">
|
||||
<in>PocsagDecoder.cpp</in>
|
||||
<in>PocsagDecoder.hpp</in>
|
||||
<in>add_impl.cc</in>
|
||||
<in>add_impl.h</in>
|
||||
<in>bit_packer_impl.cc</in>
|
||||
<in>bit_packer_impl.h</in>
|
||||
<in>bit_slicer_impl.cc</in>
|
||||
<in>bit_slicer_impl.h</in>
|
||||
<in>peak_detect_impl.cc</in>
|
||||
<in>peak_detect_impl.h</in>
|
||||
<in>pocsag_decoder_impl.cc</in>
|
||||
<in>pocsag_decoder_impl.h</in>
|
||||
<in>qa_jay.cc</in>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<data xmlns="http://www.netbeans.org/ns/make-project/1">
|
||||
<name>gr-jay</name>
|
||||
<c-extensions/>
|
||||
<cpp-extensions>cc,cpp,cxx</cpp-extensions>
|
||||
<cpp-extensions>cc,cpp</cpp-extensions>
|
||||
<header-extensions>h,hpp</header-extensions>
|
||||
<sourceEncoding>UTF-8</sourceEncoding>
|
||||
<make-dep-projects/>
|
||||
|
||||
@@ -22,5 +22,7 @@ install(FILES
|
||||
jay_square2_ff.xml
|
||||
jay_bit_slicer.xml
|
||||
jay_pocsag_decoder.xml
|
||||
jay_bit_packer.xml DESTINATION share/gnuradio/grc/blocks
|
||||
jay_bit_packer.xml
|
||||
jay_add.xml
|
||||
jay_peak_detect.xml DESTINATION share/gnuradio/grc/blocks
|
||||
)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>add</name>
|
||||
<key>jay_add</key>
|
||||
<category>[jay]</category>
|
||||
<import>import jay</import>
|
||||
<make>jay.add()</make>
|
||||
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
|
||||
Sub-nodes:
|
||||
* name
|
||||
* key (makes the value accessible as $keyname, e.g. in the make node)
|
||||
* type -->
|
||||
<param>
|
||||
<name>...</name>
|
||||
<key>...</key>
|
||||
<type>...</type>
|
||||
</param>
|
||||
|
||||
<!-- Make one 'sink' node per input. Sub-nodes:
|
||||
* name (an identifier for the GUI)
|
||||
* type
|
||||
* vlen
|
||||
* optional (set to 1 for optional inputs) -->
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
|
||||
</sink>
|
||||
|
||||
<!-- Make one 'source' node per output. Sub-nodes:
|
||||
* name (an identifier for the GUI)
|
||||
* type
|
||||
* vlen
|
||||
* optional (set to 1 for optional inputs) -->
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
|
||||
</source>
|
||||
</block>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>peak_detect</name>
|
||||
<key>jay_peak_detect</key>
|
||||
<category>[jay]</category>
|
||||
<import>import jay</import>
|
||||
<make>jay.peak_detect($alpha_s, $alpha_m, $vlen)</make>
|
||||
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
|
||||
Sub-nodes:
|
||||
* name
|
||||
* key (makes the value accessible as $keyname, e.g. in the make node)
|
||||
* type -->
|
||||
<param>
|
||||
<name>Alpha short</name>
|
||||
<key>alpha_s</key>
|
||||
<type>float</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Alpha medium</name>
|
||||
<key>alpha_m</key>
|
||||
<type>float</type>
|
||||
</param>
|
||||
<param>
|
||||
<name>Vector length</name>
|
||||
<key>vlen</key>
|
||||
<type>int</type>
|
||||
</param>
|
||||
|
||||
<!-- Make one 'sink' node per input. Sub-nodes:
|
||||
* name (an identifier for the GUI)
|
||||
* type
|
||||
* vlen
|
||||
* optional (set to 1 for optional inputs) -->
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>float</type>
|
||||
<vlen>$vlen</vlen>
|
||||
</sink>
|
||||
|
||||
<!-- Make one 'source' node per output. Sub-nodes:
|
||||
* name (an identifier for the GUI)
|
||||
* type
|
||||
* vlen
|
||||
* optional (set to 1 for optional inputs) -->
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type>float</type>
|
||||
<vlen>$vlen</vlen>
|
||||
</source>
|
||||
</block>
|
||||
@@ -27,5 +27,7 @@ install(FILES
|
||||
square2_ff.h
|
||||
bit_slicer.h
|
||||
pocsag_decoder.h
|
||||
bit_packer.h DESTINATION include/jay
|
||||
bit_packer.h
|
||||
add.h
|
||||
peak_detect.h DESTINATION include/jay
|
||||
)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2019 Jay Arrowfield.
|
||||
*
|
||||
* This 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.
|
||||
*
|
||||
* This software 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 this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_JAY_ADD_H
|
||||
#define INCLUDED_JAY_ADD_H
|
||||
|
||||
#include <jay/api.h>
|
||||
#include <gnuradio/sync_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace jay {
|
||||
|
||||
/*!
|
||||
* \brief <+description of block+>
|
||||
* \ingroup jay
|
||||
*
|
||||
*/
|
||||
class JAY_API add : virtual public gr::sync_block
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<add> sptr;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of jay::add.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, jay::add's
|
||||
* constructor is in a private implementation
|
||||
* class. jay::add::make is the public interface for
|
||||
* creating new instances.
|
||||
*/
|
||||
static sptr make();
|
||||
};
|
||||
|
||||
} // namespace jay
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_JAY_ADD_H */
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2019 Jay Arrowfield.
|
||||
*
|
||||
* This 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.
|
||||
*
|
||||
* This software 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 this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCLUDED_JAY_PEAK_DETECT_H
|
||||
#define INCLUDED_JAY_PEAK_DETECT_H
|
||||
|
||||
#include <jay/api.h>
|
||||
#include <gnuradio/sync_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace jay {
|
||||
|
||||
/*!
|
||||
* \brief <+description of block+>
|
||||
* \ingroup jay
|
||||
*
|
||||
*/
|
||||
class JAY_API peak_detect : virtual public gr::sync_block
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<peak_detect> sptr;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of jay::peak_detect.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, jay::peak_detect's
|
||||
* constructor is in a private implementation
|
||||
* class. jay::peak_detect::make is the public interface for
|
||||
* creating new instances.
|
||||
*/
|
||||
static sptr make(float alpha_s, float alpha_l, int vlen);
|
||||
};
|
||||
|
||||
} // namespace jay
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_JAY_PEAK_DETECT_H */
|
||||
|
||||
@@ -31,7 +31,9 @@ list(APPEND jay_sources
|
||||
bit_slicer_impl.cc
|
||||
PocsagDecoder.cpp
|
||||
pocsag_decoder_impl.cc
|
||||
bit_packer_impl.cc )
|
||||
bit_packer_impl.cc
|
||||
add_impl.cc
|
||||
peak_detect_impl.cc )
|
||||
|
||||
set(jay_sources "${jay_sources}" PARENT_SCOPE)
|
||||
if(NOT jay_sources)
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2019 Jay Arrowfield.
|
||||
*
|
||||
* This 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.
|
||||
*
|
||||
* This software 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 this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include "add_impl.h"
|
||||
|
||||
namespace gr {
|
||||
namespace jay {
|
||||
|
||||
add::sptr
|
||||
add::make()
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new add_impl());
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
add_impl::add_impl()
|
||||
: gr::sync_block("add",
|
||||
gr::io_signature::make(1, 1, sizeof(float)),
|
||||
gr::io_signature::make(1, 1, sizeof(float)))
|
||||
{}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
add_impl::~add_impl()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
add_impl::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const float *in = (const float *) input_items[0];
|
||||
float *out = (float *) output_items[0];
|
||||
|
||||
// Do <+signal processing+>
|
||||
|
||||
// Tell runtime system how many output items we produced.
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
} /* namespace jay */
|
||||
} /* namespace gr */
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2019 Jay Arrowfield.
|
||||
*
|
||||
* This 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.
|
||||
*
|
||||
* This software 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 this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_JAY_ADD_IMPL_H
|
||||
#define INCLUDED_JAY_ADD_IMPL_H
|
||||
|
||||
#include <jay/add.h>
|
||||
|
||||
namespace gr {
|
||||
namespace jay {
|
||||
|
||||
class add_impl : public add
|
||||
{
|
||||
private:
|
||||
// Nothing to declare in this block.
|
||||
|
||||
public:
|
||||
add_impl();
|
||||
~add_impl();
|
||||
|
||||
// Where all the action really happens
|
||||
int work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
} // namespace jay
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_JAY_ADD_IMPL_H */
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2019 Jay Arrowfield.
|
||||
*
|
||||
* This 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.
|
||||
*
|
||||
* This software 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 this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include "peak_detect_impl.h"
|
||||
|
||||
namespace gr {
|
||||
namespace jay {
|
||||
|
||||
peak_detect::sptr
|
||||
peak_detect::make(float alpha_s, float alpha_m, int vlen)
|
||||
{
|
||||
return gnuradio::get_initial_sptr
|
||||
(new peak_detect_impl(alpha_s, alpha_m, vlen));
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
peak_detect_impl::peak_detect_impl(float alpha_s, float alpha_m, int vlen)
|
||||
: gr::sync_block("peak_detect"
|
||||
, gr::io_signature::make(1, 1, vlen*sizeof(float))
|
||||
, gr::io_signature::make(1, 1, vlen*sizeof(float)))
|
||||
, m_alpha_s (alpha_s)
|
||||
, m_alpha_m(alpha_m)
|
||||
, m_vlen(vlen)
|
||||
{
|
||||
m_pPeakCount = new int[vlen];
|
||||
m_pXs = new float[vlen];
|
||||
m_pXm = new float[vlen];
|
||||
|
||||
memset(m_pPeakCount, 0, vlen*sizeof(int));
|
||||
memset(m_pXs, 0, vlen*sizeof(float));
|
||||
memset(m_pXm, 0, vlen*sizeof(float));
|
||||
}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
peak_detect_impl::~peak_detect_impl()
|
||||
{
|
||||
delete [] m_pXm;
|
||||
delete [] m_pXs;
|
||||
delete [] m_pPeakCount;
|
||||
}
|
||||
|
||||
int
|
||||
peak_detect_impl::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
int k=0;
|
||||
fprintf(stderr, "Peak at");
|
||||
for(int i = 0; i < (noutput_items * m_vlen); i++)
|
||||
{
|
||||
float x = ((float*)input_items[k])[i];
|
||||
m_pXs[i] = (1.f-m_alpha_s)*m_pXs[i] + m_alpha_s*x;
|
||||
int gate = (int)(m_pXs[i] > (10+m_pXm[i]));
|
||||
m_pPeakCount[i] = gate*m_pPeakCount[i] + gate;
|
||||
float peak = (float)(m_pPeakCount[i] > 1);
|
||||
|
||||
m_pXm[i] = (1.f-peak)*((1.f-m_alpha_m)*m_pXm[i] + m_alpha_m*x) + peak*m_pXm[i];
|
||||
|
||||
((float*)output_items[k])[i] = m_pXm[i];
|
||||
|
||||
if (peak > 0.5)
|
||||
{
|
||||
fprintf(stderr, " %d", i);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
// Tell runtime system how many output items we produced.
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
} /* namespace jay */
|
||||
} /* namespace gr */
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2019 Jay Arrowfield.
|
||||
*
|
||||
* This 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.
|
||||
*
|
||||
* This software 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 this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_JAY_PEAK_DETECT_IMPL_H
|
||||
#define INCLUDED_JAY_PEAK_DETECT_IMPL_H
|
||||
|
||||
#include <jay/peak_detect.h>
|
||||
|
||||
namespace gr {
|
||||
namespace jay {
|
||||
|
||||
class peak_detect_impl : public peak_detect
|
||||
{
|
||||
private:
|
||||
// Nothing to declare in this block.
|
||||
float m_alpha_s;
|
||||
float m_alpha_m;
|
||||
int m_vlen;
|
||||
int *m_pPeakCount;
|
||||
float *m_pXs;
|
||||
float *m_pXm;
|
||||
|
||||
public:
|
||||
peak_detect_impl(float alpha_s, float alpha_m, int vlen);
|
||||
~peak_detect_impl();
|
||||
|
||||
// Where all the action really happens
|
||||
int work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
} // namespace jay
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_JAY_PEAK_DETECT_IMPL_H */
|
||||
|
||||
@@ -47,3 +47,5 @@ GR_ADD_TEST(qa_square2_ff ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_sq
|
||||
GR_ADD_TEST(qa_bit_slicer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_bit_slicer.py)
|
||||
GR_ADD_TEST(qa_pocsag_decoder ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_pocsag_decoder.py)
|
||||
GR_ADD_TEST(qa_bit_packer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_bit_packer.py)
|
||||
GR_ADD_TEST(qa_add ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_add.py)
|
||||
GR_ADD_TEST(qa_peak_detect ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_peak_detect.py)
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2019 Jay Arrowfield.
|
||||
#
|
||||
# This 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.
|
||||
#
|
||||
# This software 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 this software; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
from gnuradio import gr, gr_unittest
|
||||
from gnuradio import blocks
|
||||
import jay_swig as jay
|
||||
|
||||
class qa_add (gr_unittest.TestCase):
|
||||
|
||||
def setUp (self):
|
||||
self.tb = gr.top_block ()
|
||||
|
||||
def tearDown (self):
|
||||
self.tb = None
|
||||
|
||||
def test_001_t (self):
|
||||
# set up fg
|
||||
self.tb.run ()
|
||||
# check data
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
gr_unittest.run(qa_add, "qa_add.xml")
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2019 Jay Arrowfield.
|
||||
#
|
||||
# This 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.
|
||||
#
|
||||
# This software 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 this software; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
from gnuradio import gr, gr_unittest
|
||||
from gnuradio import blocks
|
||||
import jay_swig as jay
|
||||
|
||||
class qa_peak_detect (gr_unittest.TestCase):
|
||||
|
||||
def setUp (self):
|
||||
self.tb = gr.top_block ()
|
||||
|
||||
def tearDown (self):
|
||||
self.tb = None
|
||||
|
||||
def test_001_t (self):
|
||||
# set up fg
|
||||
self.tb.run ()
|
||||
# check data
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
gr_unittest.run(qa_peak_detect, "qa_peak_detect.xml")
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "jay/bit_slicer.h"
|
||||
#include "jay/pocsag_decoder.h"
|
||||
#include "jay/bit_packer.h"
|
||||
#include "jay/add.h"
|
||||
#include "jay/peak_detect.h"
|
||||
%}
|
||||
|
||||
|
||||
@@ -27,3 +29,7 @@ GR_SWIG_BLOCK_MAGIC2(jay, bit_slicer);
|
||||
GR_SWIG_BLOCK_MAGIC2(jay, pocsag_decoder);
|
||||
%include "jay/bit_packer.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(jay, bit_packer);
|
||||
%include "jay/add.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(jay, add);
|
||||
%include "jay/peak_detect.h"
|
||||
GR_SWIG_BLOCK_MAGIC2(jay, peak_detect);
|
||||
|
||||
Reference in New Issue
Block a user