486
Platforms
©2000-2008 Tibbo Technology Inc.
first set all scan lines to HIGH. This is necessary for correct keypad operation.
Before doing so, however, the kp object will memorize the state of each scan line.
This state will be restored after the scanning is complete. To your eye, this will
look like that LED connected to the scan line was on all the time (of course, it it
was on in the first place).
To build a functioning keypad you will need to have at least one return line. A
sensible count of scan lines, however, starts from two! Having a single scan line is
like having no scan lines whatsoever -- you might just as well ground this single
scan line of the keypad, i.e. keep it active permanently. This arrangement is shown
on the drawing below.
Preparing the Keypad for Operation
topic explains how to setup the kp. object
properly for the keypad hardware you are using.
8.3.14.2
Key States and Transitions
Each key on your keypad can be in five different states, as defined by the
pl_kp_event_codes constant. Here are those states:
0- PL_KP_EVENT_LONGRELEASED: The key has been released "for a while".
1- PL_KP_EVENT_RELEASED: The key has been released (just now).
2- PL_KP_EVENT_PRESSED: The key has been pressed (just now).
3- PL_KP_EVENT_LONGPRESSED: The key has been pressed "for a while".
4- PL_KP_EVENT_REPEATPRESSED: Auto-repeat for the key.
The diagram below shows all key states and possible state transitions.
487