
Chapter 4 Software Development
page 4-15
Receive Only Skeleton
char buf_rx[BUF_SIZE];
void bulk_rx(uchar *buf, uint size)
{
/* Called after receiving each packet, this function manages buffer overflow for the application
layer. */
if(Receive buffer threatens to overflow){
usb_rx_start(buf_rx, EP_RX);
/* Reinitialize pointer to start of buffer */
}
}
void main(void)
{
/* Initialize microcontroller and peripherals, etc. */
:
usb_init();
/* Initialize USB control vaiables */
usb_set_callback(EP_RX,rx_callback);
/* Specify receive callback function */
usb_rx_start(buf_rx, EP_RX);
/* Specify receive data buffer and start */
:
while(1){
/* Main loop */ ;
}
}
Transmit Only Skeleton
char buf_tx[BUF_SIZE];
void bulk_tx(uchar *buf, uint size)
{
/* This function is called after transmitting each packet. */
usb_tx_start(buf_tx, EP_TX);
/* Reinitialize pointer to start of buffer */
}
void main(void)
{
/* Initialize microcontroller and peripherals, etc. */
:
usb_init();
/* Initialize USB control variables */
usb_set_callback(EP_TX, bulk_tx);
/* Specify transmit callback function */
usb_tx_start(buf_tx, EP_TX);
/* Specify transmit data buffer and start */
:
while(1){
/* Main loop */ ;
}
}
Содержание JOB60851
Страница 2: ......
Страница 7: ...1 Introduction...
Страница 14: ...2 Putting Board through Its Paces...
Страница 23: ...3 System Specifications...
Страница 27: ...Chapter 3 System Specifications page 3 5 3 2 2 Circuit Diagram Figure 3 2 2 Circuit Diagram 1 2...
Страница 36: ...4 Software Development...