Minor cleanups to DualCDC ClassDriver device demo for clarity.

This commit is contained in:
Dean Camera 2009-07-30 14:12:00 +00:00
parent 41babf1cb7
commit ec079c71d8
2 changed files with 3 additions and 4 deletions

View File

@ -92,6 +92,7 @@ int main(void)
{
CheckJoystickMovement();
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
while (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface))
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);

View File

@ -99,13 +99,11 @@ int main(void)
CheckJoystickMovement();
/* Discard all received data on the first CDC interface */
uint16_t BytesToDiscard = CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface);
while (BytesToDiscard--)
while (CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface))
CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface);
/* Echo all received data on the second CDC interface */
uint16_t BytesToEcho = CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface);
while (BytesToEcho--)
while (CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface))
CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface));
CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);