Pretty funny that there are 2 Robert Berger’s with the same question!
But thanks a lot Mirko for the explanation. That may help my situation as we do have the opportunity to add some hardware.
I did find a way to do parallel writes to the GPIO by doing direct access of the GPIO registers instead of going the the /sysfs filesystem access. Unfortunately I could not find a way to do this with Ruby without creating a C extension. (I spent all day yesterday trying! Looks like the existing mmap gems for ruby are all obsolete and don’t work with Ruby 2.x and/or won’t map in /dev/mem)
A good description of the solution is at http://elinux.org/EBC_Exercise_11b_gpio_via_mmap
It has some C examples of how to do it natively and shows how you can use devmem2 to do it in the shell command line.
if you’re update rate was low, you could shell out to devmem2 to do parallel writes:
For instance to get the 32bit value (that’s how big the registers are) at 0x4804c13c
That would show you what the bits are for gpio1
To clear the bits in the pattern 0x01000000 in the GPIO_CLEARDATAOUT register
devmem2 0x4804c190 w 0x01000000
That would turn the USR3 LED off if it was on
To set the bit pattern in GPIO_SETDATAOUT (0x194) register
devmem2 0x4804c194 w 0x01000000
That would turn the USR3 LED on
To turn on USR1 and USR 3 at the same time:
devmem2 0x4804c194 w 0x01400000
You could do the same to a group of other gpio pins as long as they are all on the gpio 32 bit register
Turns out that devmem2 is not a Debian package (though it is an Ubuntu package) but you can get the source at http://www.lartmaker.nl/lartware/port/devmem2.c
and compile and install it with:
gcc devmem2.c -o devmem2
chmod a+x devmem2
mv devmem2 /usr/local/bin