Mike,
Question. There may be a better way to do this, but here goes. I am using your library and I have a program that polls a switch every 3 seconds to check if it has been pressed, at which point I run the Linux shutdown command. The reason I need this is because I am running the pi headless, and I want to be able to reboot in case I get myself in a situation where for instance the wifi signal is lost, or there is a system lockup, etc, etc, because I have no keyboard or monitor attached. I would like to have that program run continuously, so I will set it up in the init scripts. Now, I want to run a second program to do all the input/output GPIO interaction I need as part of the project I am working on, and this would use different GPIO pins. Is it possible to run two programs at the same time to access the GPIO ports? If so, do I perform a single !bcm2835_init() in just one program? What about bcm2835_close() or setting ports as inputs and outputs, or other commands? Ideally, I would like to do all this in a single program, but I suspect interrupts of some sort would be required.
Thanks,
PJC123
It seems to me that it would be doable running multiple programs accessing GPIO pins simultaneously.
You can have a bcm2835_init / bcm2835_close for each program.
When your programs are accessing the same GPIO pins, you could work with semaphores.
Regards, Arjan
Thanks to everyone. I will give it a try when I get the chance.