Something like SIGIO is what I was trying to do. I was trying signal(SIGINT, IRQHandler), but something is not right. How do I attach it, and why do Linux enthusiasts not recommend this?
On Sun, Feb 23, 2014 at 1:40 PM, <halhe...@gmail.com> wrote: > Dorian, > > I haven't tried any of these myself but I see no reason why they shouldn't > work. > > - you could use a fork to create a child process. In this child > process use the poll()/select() calls to detect a change in the edge file. > When this happens a variable could be incremented and piped back to the > parent process. > - You could use threads...i.e. a thread calls poll()/select() to > detect a change in the edge file and then updates a counts > variables.....with threads all threads share the variables so this will be > easier. but could be more convoluted..... > - You could try monitoring the edge file with GDK/GTK libs monitoring > I/O calls https://developer.gnome.org/gtk-tutorial/2.90/x1770.html. Qt > has a QIODevice class that does the same thing. > - You could also attach the SIGIO signal to the file descriptor for > the edge file and write a signal handler that increments a > variable...though Linux purists do not recommend this > > Hussam > > > > On Saturday, February 22, 2014 1:41:02 PM UTC-5, Dorian Levy wrote: >> >> I want to use a hall effect motor encoder to determine the number of >> revolutions of a wheel. Using the BB-KEYS I am able to set >> up /dev/inputs/event1 that captures the event and records the number of >> interrupts in /proc/interrupts. I believe setting >> /sys/class/gpio/gpioxx/edge will do pretty much the same. I haven't been >> able to figure out how to count them in a C/C++ code. Is it bes to set up >> an interrupt and count or try to read the /proc/interrupt file? Polling is >> not an option because there are two wheel that need to be counted. I would >> prefer to have and ISR that counts each time it is triggered, but I have >> not been able to figure out how to set it up. Any help would be greatly >> appreciated since I have spent the last few days trying to research this >> without much luck. >> >> Thanks, >> Dorian >> > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to a topic in the > Google Groups "BeagleBoard" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/beagleboard/RhSCj3GgAj8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > beagleboard+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.