I want to know how to implement a RISING edge KBI interrupt using the Beestack state machine. I understand how it works but I could not get it working. I think I need to change just a few things in the macro SwitchPortGet and of course setup the register KBISC for rising edge. I tried some things but with no success. And finally, just a suggestion for Freescale: change the code and add an item in Beekit to configure the KBI interrupts for rising edges. Thanks in advance!
PS: I want just the switch SW3 to generate interrupts for rising edges. The rest os the switches will be falling edges.
You can set the rising edges/high levels for SW3 only from code (change KBISC register, for SW3 generate interrupts for rising edges, set KBISC=0x12 ). You can't do this change using BeeKit.
KBI port bits 3 through 0 can detect falling edges-only or falling edges and low levels. KBI port bits 7 through 4 can be configured to detect either: • Rising edges-only or rising edges and high levels (KBEDGn = 1) • Falling edges-only or falling edges and low levels (KBEDGn = 0)
Thanks for your answer, let me try to explain a little better what is my real problem. I know that I need to change KBISC register (=0x12) but the problem is that Beestack state machine for KBI interrupts doesn't recognize it. See in function KeyScan (keyboard.c). When the function KeySwitchPortGet() is called, it returns a value that indicate that no key was pressed, even mantaining pin PTA4 (the pin for SW3) in high level. This is because when you configure PTA4 to generate RISING edges interrupts, the pull-down resistor is enabled and when you aply high level in PTA4, it appears that the Beestack state machine for KBI recognize PTA4 in an "depressed" state, like the others switches (all will be at high level). So, it appears that KBI state machine really doesn't recognize that the pin is active when you configure to rising edges. The interrupt is generated but is treated like a "bounce" in a pin, even with the pin being continuous "pressed". As I said, I think I need to modify some thing in macro SwitchPortGet, but I don't know what. It's a little hard to explain, but I tried. Thank you very much!