lets talk about gpio events.
bcm2835 arm peripherals document explains that, there as some registers for detecting events. page 97-99
GPIO Rising Edge Detect Enable Registers (GPRENn)
GPIO Falling Edge Detect Enable Registers (GPRENn)
GPIO High Detect Enable Registers (GPHENn)
GPIO Low Detect Enable Registers (GPLENn)
GPIO Asynchronous Falling Edge Detect Enable Registers (GPAFENn)
GPIO Asynchronous rising Edge Detect Enable Registers (GPARENn)
these above registers are used to set which pin you want to detect.enable pin bit 1,disable for pin bit 0.
at the end, when an event occurs, you can get it from below register related pin. if it is 1 than you got the event. writing 1 to the related pin clears event.
GPIO Event Detect Status Registers (GPEDSn)
Note: default raspian kernels have gpio driver enabled, and this gpio driver catch’s interrupts.when event occurs also it generates interrupts, before you can see event from register, interrupt handler reads event and clears register. if you want to detect event, you must disable interrupts, or driver.
you can use my compiled kernel. kernel.img.tar.gz
prepare your circuit as below
and here is the code event_pull.c
have a nice day.
next article we will talk about raspberry pi mini uart