User guide

CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev. *B 61
MoBL-USB Development Kit Firmware Examples
sets EP1IN and EP1OUT as Interrupt endpoints for data transfers. The following table summarizes
the mapping of Push buttons on the MoBL-USB FX2LP18 development board to keyboard buttons.
The function TD_poll () in the firmware (periph.c) is where the periodic checking of a new push but-
ton event is done. Following is the code snippet of this function.
if( !(EP1INCS & bmEPBUSY) ) // Is the EP1INBUF
//available,
{
EZUSB_ReadI2C(BTN_ADDR,0x01,&buttons); // Read button states
buttons &= 0x0F;
if ((oldbuttons - buttons) != 0) //Change in button state
{
if (buttons & 1) //Shift
EP1INBUF[0] = 0;
else
EP1INBUF[0] = 2;
if (buttons & 2) //a
EP1INBUF[2] = 0;
else
EP1INBUF[2] = 4;
if (buttons & 4) //b
EP1INBUF[3] = 0;
else
EP1INBUF[3] = 5;
if (buttons & 8) //c
EP1INBUF[4] = 0;
else
EP1INBUF[4] = 6;
EP1INBUF[1] = 0;
EP1INBC = 5;
}
oldbuttons = buttons;
}
8.2.1 Building Firmware Example Code for MoBL-USB FX2LP18 Internal RAM and
External EEPROM.
Click on Build Target button at the top right corner of the IDE. Figure 8-2 of the Build window of
the Keil IDE shows the successful compilation of the entire project.
Table 8-2. Function Mapping of Development Board Buttons
MoBL-USB FX2LP18
Development Board Push Button
Function
f1 Shift
f2 Send ‘a’
f3 Send ‘b’
f4 Send ‘c’