Specifications

V850E2/MN4 USB CDC (Communication Device Class) Driver
R01AN0010EJ0101 Rev.1.01 Page 107 of 117
Feb 01, 2012
7.2 Customization
This section describes the sections you should rewrite when using the sample driver.
7.2.1 Application Section
The section indicated below in the file main.c codes some simple processing as an example of using the sample driver.
Declare and code the processing actually required for the application in this section of the program. The initialization
functions preceding this section and the data send/receive functions in the application can be used without modification.
When using these, verify by checking section 4.3, Function Specifications, and section 7.3 Function Usage.
/******************************************************************************
* Function Name : main
* Description : main routine.
* Arguments : none
* Return Value : none
******************************************************************************/
void main(void)
{
INT32 rcv_ret = 0;
INT32 snd_ret = 0;
cpu_init();
usbf850_init(); /* initial setting of the USB Function */
__EI();
while (1)
{
if (usbf850_get_bufinit_flg() != DEV_ERROR)
{
if (snd_ret >= 0)
{
rcv_ret = usbf850_recv_buf(&UserBuf[0], USERBUF_SIZE);
}
if (rcv_ret >= 0)
{
snd_ret = usbf850_send_buf(&UserBuf[0], rcv_ret);
}
}
else
{
snd_ret = 0;
rcv_ret = 0;
}
if (usbf850_rsuspd_flg == SUSPEND)
{
__DI();
__halt();
usbf850_rsuspd_flg = RESUME;
__EI();
}
}
}
Figure 7.1 Sample Application Code