X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/99c447c754e0b238aca99ac772b5dabb78fc8b48..3ffa7543a05761a0c69144c9b66196b08d8f1249:/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c diff --git a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c index 141a45276..92449a67d 100644 --- a/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c +++ b/Demos/Device/LowLevel/USBtoSerial/USBtoSerial.c @@ -296,9 +296,11 @@ void CDC_Task(void) */ ISR(USART1_RX_vect, ISR_BLOCK) { + uint8_t ReceivedByte = UDR1; + /* Only store received characters if the USB interface is connected */ - if ((USB_DeviceState != DEVICE_STATE_Configured) && LineEncoding.BaudRateBPS) - Buffer_StoreElement(&Tx_Buffer, UDR1); + if ((USB_DeviceState == DEVICE_STATE_Configured) && LineEncoding.BaudRateBPS) + Buffer_StoreElement(&Tx_Buffer, ReceivedByte); } /** Reconfigures the USART to match the current serial port settings issued by the host as closely as possible. */