discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Trouble with block output


From: Thunder87
Subject: Re: [Discuss-gnuradio] Trouble with block output
Date: Sun, 25 Jul 2010 17:52:18 -0700 (PDT)

Reworked it to derive from gr_sync_block. Seems to work. Now I only have to
test it somehow, and write a hier.block something like:
packed_to_unpacked->diff_const->rrc_filter, and probably SDPSK should work.

Thank you Eric !

.h

#ifndef INCLUDED_HOWTO_DIFFCONST_BC_H
#define INCLUDED_HOWTO_DIFFCONST_BC_H

#include <gr_sync_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_sync_block
{
  private:
    friend howto_diffconst_bc_sptr howto_make_diffconst_bc ();
    howto_diffconst_bc ();
    gr_complex d_phase;

  public:
    int work (int noutput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};

#endif



.cc

#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_sync_block ("diffconst_bc",
                                           gr_make_io_signature (1, 1,
sizeof (unsigned char)),
                                           gr_make_io_signature (1, 1,
sizeof (gr_complex)))    {d_phase=gr_complex(1.0,0.0);}

int howto_diffconst_bc::work (int noutput_items,
                    gr_vector_const_void_star &input_items,
                    gr_vector_void_star &output_items)

{
   const unsigned char *in  = (const unsigned char *) input_items [0];
   gr_complex          *out = (gr_complex          *) output_items[0];
   in += 1; //???

   for (int i = 0; i < noutput_items; i++)
   {

      if   (in[i]%2==1) d_phase*=gr_complex(0.0, 1.0);
      else              d_phase*=gr_complex(0.0,-1.0);

      out[i]=d_phase;
   }

   return noutput_items;
}




-- 
View this message in context: 
http://old.nabble.com/Trouble-with-block-output-tp29261420p29262685.html
Sent from the GnuRadio mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]