summaryrefslogtreecommitdiff
path: root/gr-digital/python/bpsk.py
diff options
context:
space:
mode:
authorJosh Blum2011-08-17 11:56:33 -0700
committerJosh Blum2011-08-17 11:56:33 -0700
commite6ed4fa7bb0d253adbf0cf2ae4da7c301b3c971f (patch)
tree09f43f64f581af7b5159debaf7489365b0a1259d /gr-digital/python/bpsk.py
parent40a9071074b2ec0f6daf74e50e131b89b9f66226 (diff)
parented564be6c78a3e22b3c98862834192f8b20bc551 (diff)
downloadgnuradio-e6ed4fa7bb0d253adbf0cf2ae4da7c301b3c971f.tar.gz
gnuradio-e6ed4fa7bb0d253adbf0cf2ae4da7c301b3c971f.tar.bz2
gnuradio-e6ed4fa7bb0d253adbf0cf2ae4da7c301b3c971f.zip
Merge branch 'digital' of https://github.com/trondeau/gnuradio into digital
Conflicts: gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h gnuradio-core/src/lib/general/gr_fll_band_edge_cc.h gnuradio-core/src/lib/general/gr_pll_refout_cc.h gr-digital/lib/digital_constellation_receiver_cb.cc gr-digital/lib/digital_constellation_receiver_cb.h gr-digital/lib/digital_costas_loop_cc.h
Diffstat (limited to 'gr-digital/python/bpsk.py')
-rw-r--r--gr-digital/python/bpsk.py81
1 files changed, 75 insertions, 6 deletions
diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py
index 51de3ce08..58a8289a5 100644
--- a/gr-digital/python/bpsk.py
+++ b/gr-digital/python/bpsk.py
@@ -34,7 +34,7 @@ import modulation_utils2
# Default number of points in constellation.
_def_constellation_points = 2
# Whether differential coding is used.
-_def_differential = True
+_def_differential = False
# /////////////////////////////////////////////////////////////////////////////
# BPSK constellation
@@ -52,7 +52,7 @@ def bpsk_constellation(m=_def_constellation_points):
class bpsk_mod(generic_mod):
def __init__(self, constellation_points=_def_constellation_points,
- *args, **kwargs):
+ differential=False, *args, **kwargs):
"""
Hierarchical block for RRC-filtered BPSK modulation.
@@ -67,8 +67,9 @@ class bpsk_mod(generic_mod):
constellation = digital_swig.constellation_bpsk()
if constellation_points != 2:
raise ValueError('Number of constellation points must be 2 for BPSK.')
- super(bpsk_mod, self).__init__(constellation, *args, **kwargs)
-
+ super(bpsk_mod, self).__init__(constellation=constellation,
+ differential=differential, *args, **kwargs)
+
# /////////////////////////////////////////////////////////////////////////////
# BPSK demodulator
#
@@ -77,7 +78,7 @@ class bpsk_mod(generic_mod):
class bpsk_demod(generic_demod):
def __init__(self, constellation_points=_def_constellation_points,
- *args, **kwargs):
+ differential=False, *args, **kwargs):
"""
Hierarchical block for RRC-filtered BPSK modulation.
@@ -92,7 +93,72 @@ class bpsk_demod(generic_demod):
constellation = digital_swig.constellation_bpsk()
if constellation_points != 2:
raise ValueError('Number of constellation points must be 2 for BPSK.')
- super(bpsk_demod, self).__init__(constellation, *args, **kwargs)
+ super(bpsk_demod, self).__init__(constellation=constellation,
+ differential=differential, *args, **kwargs)
+
+
+
+# /////////////////////////////////////////////////////////////////////////////
+# DBPSK constellation
+# /////////////////////////////////////////////////////////////////////////////
+
+def dbpsk_constellation(m=_def_constellation_points):
+ if m != _def_constellation_points:
+ raise ValueError("DBPSK can only have 2 constellation points.")
+ return digital_swig.constellation_dbpsk()
+
+# /////////////////////////////////////////////////////////////////////////////
+# DBPSK modulator
+# /////////////////////////////////////////////////////////////////////////////
+
+class dbpsk_mod(generic_mod):
+
+ def __init__(self, constellation_points=_def_constellation_points,
+ differential=True, *args, **kwargs):
+
+ """
+ Hierarchical block for RRC-filtered DBPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ See generic_mod block for list of parameters.
+ """
+
+ constellation_points = _def_constellation_points
+ constellation = digital_swig.constellation_bpsk()
+ if constellation_points != 2:
+ raise ValueError('Number of constellation points must be 2 for DBPSK.')
+ super(dbpsk_mod, self).__init__(constellation=constellation,
+ differential=True,
+ *args, **kwargs)
+
+# /////////////////////////////////////////////////////////////////////////////
+# DBPSK demodulator
+#
+# /////////////////////////////////////////////////////////////////////////////
+
+class dbpsk_demod(generic_demod):
+
+ def __init__(self, constellation_points=_def_constellation_points,
+ differential=True, *args, **kwargs):
+
+ """
+ Hierarchical block for RRC-filtered DBPSK modulation.
+
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
+
+ See generic_demod block for list of parameters.
+ """
+
+ constellation_points = _def_constellation_points
+ constellation = digital_swig.constellation_bpsk()
+ if constellation_points != 2:
+ raise ValueError('Number of constellation points must be 2 for DBPSK.')
+ super(dbpsk_demod, self).__init__(constellation=constellation,
+ differential=True,
+ *args, **kwargs)
#
# Add these to the mod/demod registry
@@ -100,3 +166,6 @@ class bpsk_demod(generic_demod):
modulation_utils2.add_type_1_mod('bpsk', bpsk_mod)
modulation_utils2.add_type_1_demod('bpsk', bpsk_demod)
modulation_utils2.add_type_1_constellation('bpsk', bpsk_constellation)
+modulation_utils2.add_type_1_mod('dbpsk', dbpsk_mod)
+modulation_utils2.add_type_1_demod('dbpsk', dbpsk_demod)
+modulation_utils2.add_type_1_constellation('dbpsk', dbpsk_constellation)