[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 05/23: digital: adding a rotate_phase messa
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 05/23: digital: adding a rotate_phase message for the constellation_receiver to adjust the phase of the constellation. |
Date: |
Thu, 26 Jun 2014 19:54:43 +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 0b5f9ebf537ea1d40aac5355fd0f8c4089632610
Author: Tom Rondeau <address@hidden>
Date: Wed Jun 25 17:42:05 2014 -0400
digital: adding a rotate_phase message for the constellation_receiver to
adjust the phase of the constellation.
Addresses Issue #599.
---
.../grc/digital_constellation_receiver_cb.xml | 6 ++++++
gr-digital/lib/constellation_receiver_cb_impl.cc | 24 ++++++++++++++++++----
gr-digital/lib/constellation_receiver_cb_impl.h | 13 ++++++++++++
3 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/gr-digital/grc/digital_constellation_receiver_cb.xml
b/gr-digital/grc/digital_constellation_receiver_cb.xml
index e6a1461..134e027 100644
--- a/gr-digital/grc/digital_constellation_receiver_cb.xml
+++ b/gr-digital/grc/digital_constellation_receiver_cb.xml
@@ -40,6 +40,12 @@
<optional>1</optional>
</sink>
+ <sink>
+ <name>rotate_phase</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+
<source>
<name>out</name>
<type>byte</type>
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.cc
b/gr-digital/lib/constellation_receiver_cb_impl.cc
index c4fe1e0..01a9201 100644
--- a/gr-digital/lib/constellation_receiver_cb_impl.cc
+++ b/gr-digital/lib/constellation_receiver_cb_impl.cc
@@ -60,11 +60,17 @@ namespace gr {
{
if(d_constellation->dimensionality() != 1)
throw std::runtime_error("This receiver only works with constellations
of dimension 1.");
+
message_port_register_in(pmt::mp("set_constellation"));
set_msg_handler(
pmt::mp("set_constellation"),
boost::bind(&constellation_receiver_cb_impl::handle_set_constellation,
this, _1));
+
+ message_port_register_in(pmt::mp("rotate_phase"));
+ set_msg_handler(pmt::mp("rotate_phase"),
+
boost::bind(&constellation_receiver_cb_impl::handle_rotate_phase,
+ this, _1));
}
constellation_receiver_cb_impl::~constellation_receiver_cb_impl()
@@ -96,12 +102,22 @@ namespace gr {
void
constellation_receiver_cb_impl::handle_set_constellation(pmt::pmt_t
constellation_pmt)
{
- boost::any constellation_any = pmt::any_ref(constellation_pmt);
- constellation_sptr constellation = boost::any_cast<constellation_sptr>(
- constellation_any);
- set_constellation(constellation);
+ if(pmt::is_any(constellation_pmt)) {
+ boost::any constellation_any = pmt::any_ref(constellation_pmt);
+ constellation_sptr constellation = boost::any_cast<constellation_sptr>(
+ constellation_any);
+ set_constellation(constellation);
+ }
}
+ void
+ constellation_receiver_cb_impl::handle_rotate_phase(pmt::pmt_t rotation)
+ {
+ if(pmt::is_real(rotation)) {
+ double phase = pmt::to_double(rotation);
+ d_phase += phase;
+ }
+ }
void
constellation_receiver_cb_impl::set_constellation(constellation_sptr
constellation)
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.h
b/gr-digital/lib/constellation_receiver_cb_impl.h
index 6247deb..90482e2 100644
--- a/gr-digital/lib/constellation_receiver_cb_impl.h
+++ b/gr-digital/lib/constellation_receiver_cb_impl.h
@@ -58,8 +58,21 @@ namespace gr {
//! Typically used when we receive a tag with values for these.
void set_phase_freq(float phase, float freq);
+ /*!
+ * Message handler port to receiver a new constellation.
+ * constellation_pmt is a pmt_any; constellation objects have
+ * an as_pmt function that can be used for this purpose.
+ */
void handle_set_constellation(pmt::pmt_t constellation_pmt);
+ /*!
+ * Message handler port to update the phase of the rotator. The
+ * phase should be a real number (float or double) that is added
+ * to the current phase. So we can rotate the constellation by
+ * 90 degress by passing a value of pmt::from_double(M_PI/2).
+ */
+ void handle_rotate_phase(pmt::pmt_t rotation);
+
//! Set the constellation used.
//! Typically used when we receive a tag with a value for this.
void set_constellation(constellation_sptr constellation);
- [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 <=
- [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, 2014/06/26
- [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