HP (Hewlett-Packard) EZ-KIT Switch User Manual


 
Example 7: Source Files
6-10 Getting Started with ADSP-BF548 EZ-KIT Lite
while (running){
unsigned int r;
keycoords_t keypress;
/* get next keypress */
r = VDK_SyncRead(
keypad_dd, /* device descriptor for keypad */
(char*)&keypress, /* where to put next keypress */
1, /* number required (ignored) */
0); /* no timeout - wait forever */
if (r == 0) {
/* pack row/col info into type word to avoid needing */
/* a payload */
int type = ((keypress.row << 8) | keypress.col);
VDK_MessageID msg = VDK_CreateMessage(
type, /* type is row/col packed in int */
0, /* no payload, size is zero */
NULL); /* no payload, address is NULL */
/* check that message was created OK */
r = (msg == UINT_MAX);
if (r == 0) {
/* post message to LED display thread */
VDK_PostMessage(
LEDthread, /* destination thread instance */
msg, /* the message’s ID */
VDK_kMsgChannel1); /* queue to use in dest thread */
}
}
/* terminate loop if any errors detected */
running = (r == 0);
}
VDK_CloseDevice(keypad_dd);