DA-660-8/16-LXUser’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 function only reads one key value for each
function call. The value of the key value is returned in argument 3.
Special Note
1.
The DA-660’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 keys that was pressed will be
dropped, without sounding the buzzer.
2.
Currently, the DA-660 does NOT support pressing more than 1 key at the same time.
Makefile Example
The following Makefile file example codes are copied from the Hello example on the DA-660’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