User`s manual

UC-7420/7410 User’s Manual Programmer’s Guide
5-11
KeyPad
The device node is
/dev/keypad
. The key value is defined in moxadevice.h.
int ioctl(fd, IOCTL_KEYPAD_HAS_PRESS, int *flag);
Checks how many keys have been pressed. Argument 3 returns the number of pressed keys. 0
means no keys were pressed.
int ioctl(fd, IOCTL_KEYPAD_GET_KEY, int *key);
Gets the value of the last key that was pressed. This functions only reads one key value for each
function call. The value of the key value is returned in argument 3.
Special Note
1. UC-7420/7410’s kernel will store the “pressed key history” in a buffer. The maximum buffer
size is 31 keys. If the buffer overflows, the first key of the 31 that was pressed will be dropped,
without sounding the buzzer.
2. Currently, UC-7420/7410 does NOT support pressing more than 1 key at the same time.
Make File Example
The following Makefile file example codes are copied from the Hello example on
UC-7420/7410’s CD-ROM.
CC = /usr/local/mxscaleb/mxscaleb-gcc
CPP = /usr/local/mxscaleb/mxscaleb-gcc
SOURCES = hello.c
OBJS = $(SOURCES:.c=.o)
all: hello
hello: $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
clean:
rm -f $(OBJS) hello core *.gdb