Hi Will,

hui is right. If you want any pins to be high, then mask & value must be
non-zero. Is it possible that you assume that the value only applies to the
mask bits? Because they don't. In you example, this line:

usrp->set_gpio_attr("FP0", "OUT", 1, (1<<1));

will not do anything because 1 & (1<<1) == 0. This would do the trick:

usrp->set_gpio_attr("FP0", "OUT", 1<<1, (1<<1));

Manual page:
https://uhd.readthedocs.io/en/latest/classuhd_1_1usrp_1_1multi__usrp.html#a57f25d118d20311aca261e6dd252625e

--M

On Thu, Nov 21, 2024 at 8:29 AM hui cj <cjh416593...@gmail.com> wrote:

> If you want to set both pin 0 and pin 1 to high, the third parameter
> should be 0x0003.
>
> In this case:
> If your last parameter is 0xFFFF, both pin 0 and pin 1 will be set to
> high, while all other pins will be set to low.
> However, if your last parameter is 0x0003, only pin 0 and pin 1 will
> change to high, and the values of the other pins will remain unchanged.
>
>
> hui cj <cjh416593...@gmail.com> 于2024年11月21日周四 15:24写道:
>
>> In your last example, it should be
>> usrp->set_gpio_attr("FP0", "OUT",  0xFFF  , 0xFFF);
>> The third parameter should also be a mask.
>>
>>
>> Will Haftel via USRP-users <usrp-users@lists.ettus.com> 于2024年11月21日周四
>> 05:38写道:
>>
>>> This doesn’t quite work for me - in the last example I gave, I try using
>>> 1 mask to set all of the bits high but still only pin 0 is set. I am able
>>> to control all of the pins using ATR, but am not sure why the manual api
>>> isn’t giving me the same results.
>>> _______________________________________________
>>> USRP-users mailing list -- usrp-users@lists.ettus.com
>>> To unsubscribe send an email to usrp-users-le...@lists.ettus.com
>>>
>> _______________________________________________
> USRP-users mailing list -- usrp-users@lists.ettus.com
> To unsubscribe send an email to usrp-users-le...@lists.ettus.com
>
_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to