diff options
Diffstat (limited to 'Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c')
-rw-r--r-- | Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c index cc8f92ccd..53d7ce9fc 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c @@ -101,12 +101,12 @@ int main(void) CheckJoystickMovement(); /* Discard all received data on the first CDC interface */ - while (CDC_Device_BytesReceived(&VirtualSerial1_CDC_Interface)) - CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); + CDC_Device_ReceiveByte(&VirtualSerial1_CDC_Interface); /* Echo all received data on the second CDC interface */ - while (CDC_Device_BytesReceived(&VirtualSerial2_CDC_Interface)) - CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface)); + int16_t ReceivedByte; = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface); + if (!(ReceivedByte < 0)) + CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)ReceivedByte); CDC_Device_USBTask(&VirtualSerial1_CDC_Interface); CDC_Device_USBTask(&VirtualSerial2_CDC_Interface); |