162
Checking Key Buffer Content
Checks if a key code or coordinates are in the buffer. If either is present, the key code or coordinates
will be returned. The buffer remains uncleared. Use the KEY_Read function to load the data.
However, the coordinates will not be returned if the coordinates input mode is set to “disable”.
SYNTAX
int KEY_Scan(unsigned int *Keycode, POSITION Position);
INPUT
Keycode = Pointer to the area in which the read key code is stored
Position = Pointer to the KDC_POSINFO structure in which the read coordinates
are stored
typedef struct{
int status; /*status
*0 : DOWN_STATUS
*1 : RUN_STATUS
*2 : UP_STATUS
*3 : CANSEL_STATUS
This status arises when the power is off after the down status is
acquired and before the up status is acquired.
*/
int xpos; /* X coordinate */
int ypos; /* Y coordinate */
}KDC_POSINFO;
OUTPUT
= KDC_NONE (0) No data
= KDC_KEYCODE (1) A key code is present.
= KDC_POSDATA (2) Coordinates are present.
EXAMPLE
#include "padlib.h"
unsigned int Keycode;
POSITION Position;
int retcode;
retcode = KEY_Scan(&Keycode,&Position);
Refer to “KEY_Read” also.