Editing GRAndWalkthroughUSRP

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 47: Line 47:
 
         // Create the seekBar to move update the amplitude
 
         // Create the seekBar to move update the amplitude
 
         SeekBar ampSeekBar = (SeekBar) findViewById(R.id.seekBar);
 
         SeekBar ampSeekBar = (SeekBar) findViewById(R.id.seekBar);
         ampSeekBar.setMax(100);      // max value -> 1.0
+
         ampSeekBar.setMax(100);      // max value -> 1.0
 
         ampSeekBar.setProgress(50);  // match 0.5 starting value
 
         ampSeekBar.setProgress(50);  // match 0.5 starting value
 
         ampSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
 
         ampSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
Line 56: Line 56:
 
                         new RPCConnection.KnobInfo(mult_knob_name, amp,
 
                         new RPCConnection.KnobInfo(mult_knob_name, amp,
 
                                 BaseTypes.DOUBLE);
 
                                 BaseTypes.DOUBLE);
                 HashMap _map = new HashMap<>();
+
                 HashMap _map = new HashMap&lt;&gt;();
 
                 _map.put(mult_knob_name, _k);
 
                 _map.put(mult_knob_name, _k);
 
                 postSetKnobMessage(_map);
 
                 postSetKnobMessage(_map);
Line 203: Line 203:
 
         final String[] paths = deviceName.split("/");
 
         final String[] paths = deviceName.split("/");
 
         final StringBuilder sb = new StringBuilder();
 
         final StringBuilder sb = new StringBuilder();
         for (int i = 0; i < paths.length - 2; i++)
+
         for (int i = 0; i &lt; paths.length - 2; i++)
 
             if (i == 0)
 
             if (i == 0)
 
                 sb.append(paths[i]);
 
                 sb.append(paths[i]);
Line 259: Line 259:
 
....
 
....
  
   const char *usbfs_path = env->GetStringUTFChars(devname, NULL);
+
   const char *usbfs_path = env-&gt;GetStringUTFChars(devname, NULL);
 
   std::stringstream args;
 
   std::stringstream args;
   args << "uhd,fd=" << fd << ",usbfs_path=" << usbfs_path;
+
   args &lt;&lt; "uhd,fd=" &lt;&lt; fd &lt;&lt; ",usbfs_path=" &lt;&lt; usbfs_path;
 
   GR_INFO("fg", boost::str(boost::format("Using UHD args=%1%") % args.str()));
 
   GR_INFO("fg", boost::str(boost::format("Using UHD args=%1%") % args.str()));
  
Line 276: Line 276:
 
   src = gr::uhd::usrp_source::make(args.str(), stream_args);
 
   src = gr::uhd::usrp_source::make(args.str(), stream_args);
  
   src->set_samp_rate(200e3);
+
   src-&gt;set_samp_rate(200e3);
   src->set_center_freq(101.1e6);
+
   src-&gt;set_center_freq(101.1e6);
   src->set_gain(20); // adjust as needed</syntaxhighlight>
+
   src-&gt;set_gain(20); // adjust as needed</syntaxhighlight>
 
The '''src''' is now a complex source. So what I'll do is create a simple flowgraph that looks like:
 
The '''src''' is now a complex source. So what I'll do is create a simple flowgraph that looks like:
  
<syntaxhighlight lang="Java">usrp_source -> complex_to_real -> multiply_const_ff -> opensl_sink</syntaxhighlight>
+
<syntaxhighlight lang="Java">usrp_source -&gt; complex_to_real -&gt; multiply_const_ff -&gt; opensl_sink</syntaxhighlight>
 
The full flowgraph '''FgInit''' looks like this
 
The full flowgraph '''FgInit''' looks like this
  
Line 304: Line 304:
 
   GR_INFO("fg", "FgInit Called");
 
   GR_INFO("fg", "FgInit Called");
  
   const char *usbfs_path = env->GetStringUTFChars(devname, NULL);
+
   const char *usbfs_path = env-&gt;GetStringUTFChars(devname, NULL);
 
   std::stringstream args;
 
   std::stringstream args;
   args << "uhd,fd=" << fd << ",usbfs_path=" << usbfs_path;
+
   args &lt;&lt; "uhd,fd=" &lt;&lt; fd &lt;&lt; ",usbfs_path=" &lt;&lt; usbfs_path;
 
   GR_INFO("fg", boost::str(boost::format("Using UHD args=%1%") % args.str()));
 
   GR_INFO("fg", boost::str(boost::format("Using UHD args=%1%") % args.str()));
  
Line 328: Line 328:
 
   snk = gr::grand::opensl_sink::make(int(samp_rate));
 
   snk = gr::grand::opensl_sink::make(int(samp_rate));
  
   src->set_samp_rate(200e3);
+
   src-&gt;set_samp_rate(200e3);
   src->set_center_freq(101.1e6);
+
   src-&gt;set_center_freq(101.1e6);
   src->set_gain(20); // adjust as needed
+
   src-&gt;set_gain(20); // adjust as needed
  
 
   // Connect up the flowgraph
 
   // Connect up the flowgraph
   tb->connect(src, 0, c2r, 0);
+
   tb-&gt;connect(src, 0, c2r, 0);
   tb->connect(c2r, 0, mult, 0);
+
   tb-&gt;connect(c2r, 0, mult, 0);
   tb->connect(mult, 0, snk, 0);
+
   tb-&gt;connect(mult, 0, snk, 0);
 
}
 
}
  

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)