Santos, I could not follow this. Here's what I think you want:
- USRP Source => Other Blocks - Your GPIO Block is on the side In C++, pass a reference of the USRP source into your block. There, use get_device() to return a multi_usrp::sptr. With that, you can do whatever you want. M On 06/08/2016 11:06 AM, Santos Campos wrote: > Ah sorry, I meant to mention I'm writing it in c++ not python. > Yes, I saw that get_device() returns a sptr. I think I had a poor choice > of words. > I was unclear on how to even pass the existing usrp into my oot module, > BUT I think I have a better idea now. > > Would something this work?: > std::string args = ""; > ... > uhd::usrp::multi_usrp::sptr dummy_usrp = > uhd::usrp::multi_usrp::make(args); //okay to pass an empty string address? > uhd::device::sptr usrp = dummy_usrp->get_device(); //creates a > shared pointer to a usrp device created in an earlier block (usrp > source, etc..) > //reference usrp like normal > This DID compile, but it'd be great to have reassurance from the gurus. > I'm about to try it out as well. > Although I'm a bit confused as to why I don't have to define > get_device() since it's a virtual function. Did the layers of wrappers > take care of it? (hopefully it's not embarrassingly obvious. My c++ fu > is a little rusty) > > Y'all are awesome :), > -Santos > > On Wed, Jun 8, 2016 at 12:12 PM, Martin Braun <[email protected] > <mailto:[email protected]>> wrote: > > get_device() returns a shared pointer. Note this function is not exposed > in Python -- you need to pass the object into another C++ object, and > there call get_device(). > > M > > On 06/08/2016 06:38 AM, Santos Campos wrote: > > Hi, Martin! > > I tried taking a peek at how the usrp sink might handle a preceding usrp > > source (for inspiration). > > Does it (and the way you described) declare a usrp device and do some > > kind of shallow copy with the get_device() method? > > > > On Mon, Jun 6, 2016 at 5:54 PM, Martin Braun <[email protected] > <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>>> wrote: > > > > Nah, you can just pass in the existing one into your module and > grab a > > reference to the multi_usrp from there. > > > > M > > > > On 06/03/2016 12:57 PM, Santos Campos wrote: > > > Hello again again! > > > So I'm trying to write an OOT module to control the gpio from GRC. > > > Would I have to create a usrp device in the module's code if I am > using > > > a usrp source? > > > My gut says to probably not re-declare it since it's already in > use, but > > > I'm not sure how I could bring it into scope if I don't have to > > > re-declare it. > > > I tried poking around for the usrp sink code to see what it did > but > > > couldn't find it. > > > > > > On Wed, Jun 1, 2016 at 11:45 AM, Santos Campos > <[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > > <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>> wrote: > > > > > > Worked like a charm! Thanks for the helpful comments! > > > Like I said originally, I'm trying to use the gpio to remotely > > > switch between 2 antennas. > > > Currently trying to familiarize myself with boost and the uhd > api. > > > Will undoubtedly be back to the listserv with questions on > those. > > > > > > > > > On Wed, Jun 1, 2016 at 11:23 AM, Marcus D. Leech > <[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > > <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>> wrote: > > > > > > On 06/01/2016 10:23 AM, Santos Campos wrote: > > >> Hello again, all! I've finally come back to this after a > while. > > >> I'm trying to get the example code to compile but having > some > > >> trouble. Does anyone have any experience with using the > uhd > > >> gpio api? > > >> I tried using this to compile: > > >> > > >> $ gcc -I/usr/include/boost > > >> -I/home/santosec/uhd/host/include/uhd gpio.cpp -o gpio > > >> > > >> but I got a whole mess of compiler errors. > > >> > > >> > > > And, to follow-up with details: > > > > > > http://files.ettus.com/manual/page_build_guide.html > > > > > > Also: > > > > > > AN-445 and AN-204 from here: > > > > > > https://kb.ettus.com/Application_Notes > > > > > > > > >> On Wed, May 4, 2016 at 11:25 AM, Marcus D. Leech > > >> <[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > <mailto:[email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>>>> wrote: > > >> > > >> On 05/04/2016 11:18 AM, Santos Campos wrote: > > >>> Hello! I am curious if it is possible to use a pin > or > > >>> something on either the B200 or B200 mini to send a > > >>> control signal. > > >>> > > >>> We were hoping to be able to switch between 2 > antennas if > > >>> the board received some signal. It looks like there > could > > >>> be some available pins, but we were unsure if they > would > > >>> be able to fulfill our purpose. If not, any ideas > around > > >>> this issue would be welcome! > > >>> > > >>> Any help would be much appreciated! > > >>> > > >>> > > >>> _______________________________________________ > > >>> Discuss-gnuradio mailing list > > >>> [email protected] > <mailto:[email protected]> > > <mailto:[email protected] > <mailto:[email protected]>> <mailto:[email protected] > <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>>> > > >>> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > >> The API for the B2xx GPIO is the same as for X3xx. > > >> > > >> There's example code: > > >> > > >> .../uhd/examples/gpio.cpp > > >> > > >> > > >> > > >> _______________________________________________ > > >> Discuss-gnuradio mailing list > > >> [email protected] > <mailto:[email protected]> > > <mailto:[email protected] > <mailto:[email protected]>> <mailto:[email protected] > <mailto:[email protected]> > > <mailto:[email protected] > <mailto:[email protected]>>> > > >> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > >> > > >> > > > > > > > > > > > > > > > > > > _______________________________________________ > > > Discuss-gnuradio mailing list > > > [email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > > > > > > > _______________________________________________ > > Discuss-gnuradio mailing list > > [email protected] <mailto:[email protected]> > <mailto:[email protected] <mailto:[email protected]>> > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > > > > > _______________________________________________ > Discuss-gnuradio mailing list > [email protected] <mailto:[email protected]> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > _______________________________________________ Discuss-gnuradio mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
