[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 13/23: filter: adds a message input port to
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 13/23: filter: adds a message input port to frequency xlating FIR filter to update the frequency. |
Date: |
Thu, 26 Jun 2014 19:54:44 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit 9fe2a4a6b7756a5b58e72453970be783bebf3386
Author: Tom Rondeau <address@hidden>
Date: Thu Jun 26 13:59:19 2014 -0400
filter: adds a message input port to frequency xlating FIR filter to update
the frequency.
The FFT version does not have this message port since it's a hierarchical
block and there isn't an easy way to manage this.
---
.../grc/filter_freq_xlating_fir_filter_xxx.xml | 7 +++++
.../filter/freq_xlating_fir_filter_XXX.h.t | 11 +++++++-
.../lib/freq_xlating_fir_filter_XXX_impl.cc.t | 33 ++++++++++++++++++----
gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t | 6 ++--
4 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml
b/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml
index 178a42f..8c8e100 100644
--- a/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml
+++ b/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml
@@ -86,6 +86,13 @@
<name>in</name>
<type>$type.input</type>
</sink>
+
+ <sink>
+ <name>freq</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+
<source>
<name>out</name>
<type>$type.output</type>
diff --git a/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t
b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t
index 0174774..d8cb8f9 100644
--- a/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t
+++ b/gr-filter/include/gnuradio/filter/freq_xlating_fir_filter_XXX.h.t
@@ -21,7 +21,7 @@
*/
/*
- * WARNING: This file is automatically generated by cmake.
+ * WARNING: This file is automatically generated by cmake.
* Any changes made to this file will be overwritten.
*/
@@ -49,6 +49,15 @@ namespace gr {
*
* Uses a single input array to produce a single output array.
* Additional inputs and/or outputs are ignored.
+ *
+ * - freq (input):
+ * Receives a PMT pair: (intern("freq"), double(frequency).
+ * The block then sets its frequency translation value to
+ * the new frequency provided by the message. A tag is then
+ * produced when the new frequency is applied to let
+ * downstream blocks know when this has taken affect.
+ * Use the filter's group delay to determine when the
+ * transients after the change have settled down.
*/
class FILTER_API @BASE_NAME@ : virtual public sync_decimator
{
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
index 4d7e269..57fa47f 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t
@@ -21,7 +21,7 @@
*/
/*
- * WARNING: This file is automatically generated by cmake.
+ * WARNING: This file is automatically generated by cmake.
* Any changes made to this file will be overwritten.
*/
@@ -35,7 +35,7 @@
namespace gr {
namespace filter {
-
+
@BASE_NAME@::sptr
@BASE_NAME@::make(int decimation,
const std::vector<@TAP_TYPE@> &taps,
@@ -65,6 +65,11 @@ namespace gr {
set_history(d_proto_taps.size());
build_composite_fir();
+
+ message_port_register_in(pmt::mp("freq"));
+ set_msg_handler(pmt::mp("freq"),
+ boost::bind(&@IMPL_NAME@::handle_set_center_freq,
+ this, _1));
}
@IMPL_NAME@::address@hidden@()
@@ -81,8 +86,8 @@ namespace gr {
// x(t) -> (mult by -fwT0) -> LPF -> decim -> y(t)
// We switch things up here to:
// x(t) -> BPF -> decim -> (mult by fwT0*decim) -> y(t)
- // The BPF is the baseband filter (LPF) moved up to the
- // center frequency fwT0. We then apply a derotator
+ // The BPF is the baseband filter (LPF) moved up to the
+ // center frequency fwT0. We then apply a derotator
// with -fwT0 to downshift the signal to baseband.
float fwT0 = 2 * M_PI * d_center_freq / d_sampling_freq;
@@ -106,7 +111,7 @@ namespace gr {
{
return d_center_freq;
}
-
+
void
@IMPL_NAME@::set_taps(const std::vector<@TAP_TYPE@> &taps)
{
@@ -120,6 +125,18 @@ namespace gr {
return d_proto_taps;
}
+ void
+ @IMPL_NAME@::handle_set_center_freq(pmt::pmt_t msg)
+ {
+ if(pmt::is_pair(msg)) {
+ pmt::pmt_t x = pmt::cdr(msg);
+ if(pmt::is_real(x)) {
+ double freq = pmt::to_double(x);
+ set_center_freq(freq*d_sampling_freq);
+ }
+ }
+ }
+
int
@IMPL_NAME@::work(int noutput_items,
gr_vector_const_void_star &input_items,
@@ -133,6 +150,11 @@ namespace gr {
set_history(d_proto_taps.size());
build_composite_fir();
d_updated = false;
+
+ // Tell downstream items where the frequency change was applied
+ add_item_tag(0, nitems_written(0),
+ pmt::intern("freq"), pmt::from_double(d_center_freq),
+ alias_pmt());
return 0; // history requirements may have changed.
}
@@ -147,4 +169,3 @@ namespace gr {
} /* namespace filter */
} /* namespace gr */
-
diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
index 352593b..bd7aced 100644
--- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
+++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.h.t
@@ -21,7 +21,7 @@
*/
/*
- * WARNING: This file is automatically generated by cmake.
+ * WARNING: This file is automatically generated by cmake.
* Any changes made to this file will be overwritten.
*/
@@ -45,7 +45,7 @@ namespace gr {
double d_center_freq;
double d_sampling_freq;
bool d_updated;
-
+
virtual void build_composite_fir();
public:
@@ -61,6 +61,8 @@ namespace gr {
void set_taps(const std::vector<@TAP_TYPE@> &taps);
std::vector<@TAP_TYPE@> taps() const;
+ void handle_set_center_freq(pmt::pmt_t msg);
+
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
- [Commit-gnuradio] [gnuradio] branch master updated (ad9b547 -> 71a57cc), git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 07/23: qtgui: Mostly adds sunset and cool color schemes for waterfall/raster plots., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 10/23: qtgui: allows toggling rf frequencies on/off in GRC options box., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 12/23: qtgui: freq, waterfall, and sink blocks produce a frequency message when double-clicked. Also can take in a frequency message to adjust the x-axis., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 05/23: digital: adding a rotate_phase message for the constellation_receiver to adjust the phase of the constellation., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 01/23: volk: cmake: Rename GrBoost to VolkBoost to differentiate it from GR's GrBoost. Although they set the same BOOST variables internally, this change make it clear which cmake file to include., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 09/23: qtgui: minor mods, including putting min/max lines in FFT sink behind all other lines., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 04/23: blocks: adding a message port to the copy block to enable/disable copy., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 13/23: filter: adds a message input port to frequency xlating FIR filter to update the frequency.,
git <=
- [Commit-gnuradio] [gnuradio] 03/23: digital: expose set_constellation message port in GRC for constellation_receiver., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 08/23: qtgui: adds an alternative qss file., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 14/23: docs: adding docs for blocks::copy and digital::constellation_receiver to describe their message ports., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 15/23: qtgui: dynamically adjust min/max amplitude for qtgui freq and waterfall plots., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 16/23: Merge branch 'maint', git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 11/23: qtgui: for sink_x, waterfall_sink_x, and freq_sink_x, when the display is double-clicked, the center frequency is adjusted to the clicked frequency and a message is posted containing the new center frequency., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 17/23: replaced dynamic_ by static_cast; typechecking done before, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 02/23: cmake: Include GrBoost at the top level such that the correct default BOOST variables are set throughout the build. Because of the way CMake handles non-cached variables, each GR component (e.g., Volk) can change the BOOST variables for its particular needs without overriding these default values for other components., git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 06/23: blocks.head: added callback to GRC definition, git, 2014/06/26
- [Commit-gnuradio] [gnuradio] 18/23: crc32_async: fix memory leak; coverity 1215946, git, 2014/06/26