I looked at the example code for doing I/O using the GPIO pins, but — I need to be able to count impulses (between 0.01 and 250Hz), which isn't really doable with GPIO polling on a multitasking OS.
Are the GPIO pins capable of generating interrupts?
I looked at the example code for doing I/O using the GPIO pins, but — I need to be able to count impulses (between 0.01 and 250Hz), which isn't really doable with GPIO polling on a multitasking OS.
Are the GPIO pins capable of generating interrupts?
I'm not positive about this but as I understand the way the file descriptor logic works if a fd is signalled because of an interrupt, until you clear that status (by reading from the file descriptor) you'll still get notification that it happened. What you may lose is the number of interrupts that occurred. This is where the gpio-event code that's kicking around comes in - it will record and timestamp interrupts down at the linux kernel level, and then report those up to the user code.
if you're using threads it's still possible you will miss interrupts, particularly if you are doing something I/O intensive in the other thread.
Sorry - but which "gpio-event code that's kicking around" are you referring to?
This one, from the gumstix folks:
http://wiki.gumstix.org/index.php?title=GPIO_Event_Driver
It will compile on the raspbian kernel, but I was getting kernel crashes with my first tests. I have not had a chance to debug it further.