0

I am writing application over linux embedded. I have two leds that I can turn on and off using two different GPIO's pins.

I would like to sync them, by setting both GPIO pins at the same time. This is doable since the GPIO HW has one register for output value, and each bit represent one pin.

But I did not manage to find a way to do so without bypassing the kernel driver and writing into that register. This is not a healthy way to do this, and I want to do the same using the user space API.

Is there a way to export a number of pins and "bind" them somehow?

Arnon Charas
  • 108
  • 8
  • 1
    You should write your own driver to do so... BTW it seems an [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem): what is the delay in setting 2 GPIOs using a simple file system exported file? – LPs Jan 23 '17 at 16:11

1 Answers1

0

You can write a shell script to sync the GPIOs.. Here's an example of how I toggle a GPIO (say #13) from shell:-

echo 13 > export
root@apq8017:/sys/devices/virtual/gpio/gpio13# ls
active_low  direction    power       subsystem   uevent      value
root@apq8017:/sys/devices/virtual/gpio/gpio13# cat direction value
out
1
root@apq8017:/sys/devices/virtual/gpio/gpio13# echo out > direction
root@apq8017:/sys/devices/virtual/gpio/gpio13# echo 0 > value
root@apq8017:/sys/devices/virtual/gpio/gpio13# cat direction value
out
0
root@apq8017:/sys/devices/virtual/gpio/gpio13#
Zakir
  • 2,222
  • 21
  • 31