User`s manual
PK2200 Software Reference s 61
void kpInit(int (*changeFn)())
Initializes the kp module. This function should be called before other
functions of this module are called.
PARAMETER1: This is a pointer to a function that will be called when
the driver detects a change (when kpScanState is called). Two
arguments are passed to the call-back function. The first argument is a
pointer to an array that indicates the current state of the keypad. The
second pointer is a pointer to an array that indicates what keypad
positions are changed and detected by kpScanState. The byte offset
in the array represents the line pulled high (row number), and the bits in
a byte represents the positions (column number) read back.
RETURN VALUE: None
int kpScanState()
Scans the keypad and detect any changes to the keypad status. Returns
non-zero if there is any change. If kpInit is called with a non-NULL
function pointer, that function will be called with the state of the
keypad. This function should be called periodically to scan for keypad
activities.
RETURN VALUE: 0 if there is no change to the keypad, non-zero if
there is any change to the keypad.
int kpDefStChgFn(char *curState, char *changed)
This is the default state change function for the default get key function
kpDefGetKey. This function is called back by kpScanState when
there is a change in the keypad state. If the current key is not read by
kpDefGetKey, the new key pressed will not be registered.
PARAMETER1: Points to an array that reflects the current state of the
keypad (bitmapped, 1 indicates key is not currently pressed).
PARAMETER2: Points to an array that reflects the CHANGE of
keypad state from the previous scan. (bitmapped, 1 indicates there was
a change).
RETURN VALUE: -1 if no key is pressed. Otherwise it returns the
normalized key number. The normalized key number is
8*row+col+edge*256. Edge is 1 if the key is released, and 0 if the key
is pressed.