I'm pretty sure that you can just always read the "value" inside the GPIO 
tree using a file read command.
So for example if you try to set the pin a certain way and it didn't change 
(strong pull or short) the value read still reflects the actual state.

So just write a C program using fopen and fread to read the value from the 
"file".
http://www.cplusplus.com/reference/cstdio/fread/

Put the read function in its own separate thread in a loop with a task 
delay resolution to match the baud rate.

Then you are done, assuming the output pin read does actually work that way.
If not you can try setting input mode, read the value, then set output mode 
right after you are done reading.

Bill

On Friday, October 12, 2018 at 11:06:36 AM UTC-5, Sergey Manucharian wrote:
>
> What's the best way to detect a change in value on a GPIO configured as 
> OUT?
> It may sound really weird why one may need that. I have a custom cape and 
> cannot make changes to its hardware, but I need to improve certain 
> functionality.
> poll(2) on /sys/class/gpio/gpioXY/value exits with timeout.
>
> To avoid any XY-problem I'll explain the actual situation:
> The BBB's native RS-485 mode works fine with omap_serial driver, however, 
> I cannot use actual hardware pins for RTS (RE/DE) because the above 
> mentioned cape consumes all possibilities.
> So, I assigned an unconnected GPIO to be the RTS and want to detect its 
> state changes in a timing-critical application (tcdrain() takes too long).
>
> Thanks for advises!
> Sergey
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/a2cbb2e7-0193-4a1f-b985-6b2679b809c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to