diff options
author | Josh Blum | 2011-07-28 17:02:58 -0700 |
---|---|---|
committer | Josh Blum | 2011-07-28 17:02:58 -0700 |
commit | 8bc1c4dc5a8d31594e8768a10e05b4b0172e733e (patch) | |
tree | fcb957028a108ca719a6cb879e7d62713b35ba1c /gr-digital/python/qpsk.py | |
parent | 8c824bf2e3e6758aff05ee4b5f4d3f106a13c672 (diff) | |
parent | 8b3c4ccf922c602ae77dad7f3911b16bdd0112d3 (diff) | |
download | gnuradio-8bc1c4dc5a8d31594e8768a10e05b4b0172e733e.tar.gz gnuradio-8bc1c4dc5a8d31594e8768a10e05b4b0172e733e.tar.bz2 gnuradio-8bc1c4dc5a8d31594e8768a10e05b4b0172e733e.zip |
Merge branch 'digital' of https://github.com/trondeau/gnuradio into digital
Conflicts:
gnuradio-core/src/lib/filter/gr_cma_equalizer_cc.h
gnuradio-core/src/lib/general/gr_constellation_decoder_cb.h
gnuradio-core/src/lib/general/gr_costas_loop_cc.h
gnuradio-core/src/lib/general/gr_lms_dfe_cc.h
gnuradio-core/src/lib/general/gr_lms_dfe_ff.h
gr-digital/lib/Makefile.am
gr-digital/lib/digital_binary_slicer_fb.h
gr-digital/lib/digital_clock_recovery_mm_cc.h
gr-digital/lib/digital_clock_recovery_mm_ff.h
gr-digital/lib/digital_correlate_access_code_bb.h
gr-digital/lib/digital_crc32.h
gr-digital/lib/digital_mpsk_receiver_cc.h
gr-digital/python/Makefile.am
gr-digital/python/__init__.py
gr-digital/python/generic_mod_demod.py
gr-digital/python/pkt.py
gr-digital/python/psk2.py
gr-digital/python/qam.py
Diffstat (limited to 'gr-digital/python/qpsk.py')
-rw-r--r-- | gr-digital/python/qpsk.py | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py index ea1724424..91e8b196f 100644 --- a/gr-digital/python/qpsk.py +++ b/gr-digital/python/qpsk.py @@ -26,9 +26,10 @@ Demodulation is not included since the generic_mod_demod doesn't work for non-differential encodings. """ -from gnuradio import gr, modulation_utils2 -from gnuradio.digital.generic_mod_demod import generic_mod - +from gnuradio import gr +from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod +import digital_swig +import modulation_utils2 # Default number of points in constellation. _def_constellation_points = 4 @@ -43,7 +44,7 @@ _def_gray_coded = True def qpsk_constellation(m=_def_constellation_points): if m != _def_constellation_points: raise ValueError("QPSK can only have 4 constellation points.") - return gr.constellation_qpsk() + return digital_swig.constellation_qpsk() # ///////////////////////////////////////////////////////////////////////////// # QPSK modulator @@ -65,15 +66,45 @@ class qpsk_mod(generic_mod): See generic_mod block for list of parameters. """ - constellation = gr.constellation_qpsk() + constellation_points = _def_constellation_points + constellation = digital_swig.constellation_qpsk() if constellation_points != 4: raise ValueError("QPSK can only have 4 constellation points.") if differential or not gray_coded: raise ValueError("This QPSK mod/demod works only for gray-coded, non-differential.") super(qpsk_mod, self).__init__(constellation, differential, gray_coded, *args, **kwargs) + +# ///////////////////////////////////////////////////////////////////////////// +# QPSK demodulator +# +# ///////////////////////////////////////////////////////////////////////////// + +class qpsk_demod(generic_demod): + + def __init__(self, constellation_points=_def_constellation_points, + *args, **kwargs): + + """ + Hierarchical block for RRC-filtered QPSK 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_qpsk() + if constellation_points != 4: + raise ValueError('Number of constellation points must be 4 for QPSK.') + super(qpsk_demod, self).__init__(constellation, *args, **kwargs) + + # # Add these to the mod/demod registry # modulation_utils2.add_type_1_mod('qpsk', qpsk_mod) +modulation_utils2.add_type_1_demod('qpsk', qpsk_demod) modulation_utils2.add_type_1_constellation('qpsk', qpsk_constellation) + |