summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2014-06-24 18:35:48 -0400
committerTom Rondeau <tom@trondeau.com>2014-06-24 18:35:48 -0400
commit9289583ea51b278d3b27ce5aab6384798ac3e02d (patch)
treeef53b0f21c260925f46fbec5d711d189730990f9
parentad9b5476be6e9a27638dfb9b3dbe5ca2c6a65fee (diff)
digital: expose set_constellation message port in GRC for constellation_receiver.
Also cleans up white spaces.
-rw-r--r--gr-digital/grc/digital_constellation_receiver_cb.xml7
-rw-r--r--gr-digital/lib/constellation_receiver_cb_impl.cc25
-rw-r--r--gr-digital/lib/constellation_receiver_cb_impl.h6
3 files changed, 22 insertions, 16 deletions
diff --git a/gr-digital/grc/digital_constellation_receiver_cb.xml b/gr-digital/grc/digital_constellation_receiver_cb.xml
index ffda8b85bb..e6a1461c38 100644
--- a/gr-digital/grc/digital_constellation_receiver_cb.xml
+++ b/gr-digital/grc/digital_constellation_receiver_cb.xml
@@ -33,6 +33,13 @@
<name>in</name>
<type>complex</type>
</sink>
+
+ <sink>
+ <name>set_constellation</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 927df2c748..c4fe1e08bd 100644
--- a/gr-digital/lib/constellation_receiver_cb_impl.cc
+++ b/gr-digital/lib/constellation_receiver_cb_impl.cc
@@ -38,7 +38,7 @@ namespace gr {
#define VERBOSE_MM 0 // Used for debugging symbol timing loop
#define VERBOSE_COSTAS 0 // Used for debugging phase and frequency tracking
- constellation_receiver_cb::sptr
+ constellation_receiver_cb::sptr
constellation_receiver_cb::make(constellation_sptr constell,
float loop_bw, float fmin, float fmax)
{
@@ -49,7 +49,7 @@ namespace gr {
static int ios[] = {sizeof(char), sizeof(float), sizeof(float), sizeof(float), sizeof(gr_complex)};
static std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int));
- constellation_receiver_cb_impl::constellation_receiver_cb_impl(constellation_sptr constellation,
+ constellation_receiver_cb_impl::constellation_receiver_cb_impl(constellation_sptr constellation,
float loop_bw, float fmin, float fmax)
: block("constellation_receiver_cb",
io_signature::make(1, 1, sizeof(gr_complex)),
@@ -77,10 +77,10 @@ namespace gr {
advance_loop(phase_error);
phase_wrap();
frequency_limit();
-
+
#if VERBOSE_COSTAS
printf("cl: phase_error: %f phase: %f freq: %f sample: %f+j%f constellation: %f+j%f\n",
- phase_error, d_phase, d_freq, sample.real(), sample.imag(),
+ phase_error, d_phase, d_freq, sample.real(), sample.imag(),
d_constellation->points()[d_current_const_point].real(),
d_constellation->points()[d_current_const_point].imag());
#endif
@@ -102,7 +102,7 @@ namespace gr {
set_constellation(constellation);
}
-
+
void
constellation_receiver_cb_impl::set_constellation(constellation_sptr constellation)
{
@@ -145,16 +145,16 @@ namespace gr {
tag_t tag = tags_now[j];
dispatch_msg(tag.key, tag.value);
}
-
+
sample = in[i];
nco = gr_expj(d_phase); // get the NCO value for derotating the current sample
sample = nco*sample; // get the downconverted symbol
-
+
sym_value = d_constellation->decision_maker_pe(&sample, &phase_error);
phase_error_tracking(phase_error); // corrects phase and frequency offsets
-
+
out[i] = sym_value;
-
+
if(output_items.size() == 5) {
out_err[i] = phase_error;
out_phase[i] = d_phase;
@@ -162,7 +162,7 @@ namespace gr {
out_symbol[i] = sample;
}
i++;
-
+
}
consume_each(i);
@@ -197,7 +197,7 @@ namespace gr {
pmt::mp(0.0f), pmt::mp(2.0f), pmt::mp(0.0f),
"", "Loop bandwidth", RPC_PRIVLVL_MIN,
DISPTIME | DISPOPTSTRIP)));
-
+
// Setters
add_rpc_variable(
rpcbasic_sptr(new rpcbasic_register_set<control_loop, float>(
@@ -208,8 +208,7 @@ namespace gr {
RPC_PRIVLVL_MIN, DISPNULL)));
#endif /* GR_CTRLPORT */
}
-
+
} /* namespace digital */
} /* namespace gr */
-
diff --git a/gr-digital/lib/constellation_receiver_cb_impl.h b/gr-digital/lib/constellation_receiver_cb_impl.h
index ccbbf83657..6247deb801 100644
--- a/gr-digital/lib/constellation_receiver_cb_impl.h
+++ b/gr-digital/lib/constellation_receiver_cb_impl.h
@@ -35,7 +35,7 @@ namespace gr {
: public constellation_receiver_cb, blocks::control_loop
{
public:
- constellation_receiver_cb_impl(constellation_sptr constell,
+ constellation_receiver_cb_impl(constellation_sptr constell,
float loop_bw, float fmin, float fmax);
~constellation_receiver_cb_impl();
@@ -66,10 +66,10 @@ namespace gr {
//! delay line length.
static const unsigned int DLLEN = 8;
-
+
//! delay line plus some length for overflow protection
__GR_ATTR_ALIGNED(8) gr_complex d_dl[2*DLLEN];
-
+
//! index to delay line
unsigned int d_dl_idx;
};