discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Scheduling a block even with no input items RE: F


From: Activecat
Subject: Re: [Discuss-gnuradio] Scheduling a block even with no input items RE: Flow graph blocking when doing 2x1 transmission
Date: Mon, 9 Jun 2014 16:50:00 +0800



On Tue, Jun 3, 2014 at 11:08 PM, Activecat <address@hidden> wrote:

Create a general block with two inputs and two outputs.
The two outputs connect to the USRP UHD sink. The first input connects to the constantly transmitting source while the second input connects to the non-consistent source.

In your forecast function:

   ninput_items_required[0] = noutput_items;
   ninput_items_required[1] = 0;


Then in your general_work function:

  const gr_complex *in0 = (const gr_complex*) input_items[0];
  const gr_complex *in1 = (const gr_complex*) input_items[1];
  gr_complex *out0 = (gr_complex*) output_items[0];
  gr_complex *out1 = (gr_complex*) output_items[1];

  for (int i=0; i < noutput_items; i++)
      out0[i] = in0[i];

  for (int i=0; i < ninput_items[1]; i++)
      out1[i] = in1[i]

  for (int i=ninput_items[1]; i < noutput_items; i++)
      out1[i] = 0.0;     // here you fill in the zeros, but won't over-filled.

  consume( 0, noutput_items);
  consume( 1, ninput_items[1]);  

  return noutput_items;



I've tested out above idea, it works.
Its implementation source file is at https://github.com/activecat/gr-test2/blob/master/lib/streamer1_impl.cc
To test it out, just run the flowgraph of https://github.com/activecat/gr-test2/blob/master/examples/flowgraph_09.grc

https://github.com/activecat/gr-test2

reply via email to

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