My goal is to rework DBPSK module, so that it is possible to easily implement SDPSK module.
DBPSK goes like this: differential_encoding > ordinary BPSK, so there is no actual constellation rotation. All rotation part is done by diff.encoder. But this can be done only when shifting between 2 states. SDPSK shifts between 4 states (1 = +90', 0 = -90'). So my intention was to make a class which would do something like the following: state = 1+0j #initial phase if (chunk&0x01==1) state = state * p_change; else state = state * n_change; for DBPSK p_change=1+0j (no change in phase if bit = 1) n_change=-1+0j (reverse phase if bit = 0) for SDPSK p_change =0+1j (+90' turn if bit = 1) n_change =0-1j (-90' turn if bit = 0) It can't be implemented as a function because it has to store current state somewhere. So I should probably write a class, where state would be initialized at constructor. So I have read this "How to write a signal processing block" guide. Also have written howto_diffconst.h file: #ifndef INCLUDED_HOWTO_DIFFCONST_BC_H #define INCLUDED_HOWTO_DIFFCONST_BC_H #include <gr_block.h> class howto_diffconst_bc; typedef boost::shared_ptr<howto_diffconst_bc> howto_diffconst_bc_sptr; howto_diffconst_bc_sptr howto_make_diffconst_bc (); class howto_diffconst_bc : public gr_block { private: friend howto_diffconst_bc_sptr howto_make_diffconst_bc (); howto_diffconst_bc (); public: ~howto_diffconst_bc (); int general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; #endif and stopped at howto_diffconst.cc file: #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <howto_diffconst_bc.h> #include <gr_io_signature.h> howto_diffconst_bc_sptr howto_make_diffconst_bc () {return howto_diffconst_bc_sptr (new howto_diffconst_bc ());} howto_diffconst_bc::howto_diffconst_bc (): gr_block ("diffconst_bc", gr_make_io_signature (1, 1, 1), gr_make_io_signature (1, 1, 8)) {} howto_diffconst_bc::~howto_diffconst_bc () {} int howto_diffconst_bc::general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { //const float *in = (const float *) input_items[0]; //float *out = (float *) output_items[0]; //out[0] = in[0] * in[0]; consume_each (noutput_items); return noutput_items; } Now, finally about what bothers me. First - signatures. Input should be a single chunk, output - signle complex. So I wrote input signature: gr_make_io_signature(1,1,1), output signature: gr_make_io_signature(1,1,8) Would that be correct? Next - variables. Thing is I have no idea what type of variables to use for chunk and complex. My guess - int for chunk, and complex class (complex<float>) from standart c++ library ( http://cplusplus.com/reference/std/complex/complex/ std/complex ) for complex. But would that be compatible with gnu-radio complex? Third - initialization. Do I set initial phase howto_diffconst_bc::howto_diffconst_bc (): gr_block ("diffconst_bc", gr_make_io_signature (1, 1, 1), gr_make_io_signature (1, 1, 8)) {here?} Please help! Any suggestions accepted. -- View this message in context: http://old.nabble.com/DBPSK-rework-%28SDPSK-implementation%29-tp29249098p29249098.html Sent from the GnuRadio mailing list archive at Nabble.com. _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio