/* Stop running CDC and USB management tasks */\r
Scheduler_SetTaskMode(CDC_Task, TASK_STOP);\r
Scheduler_SetTaskMode(USB_USBTask, TASK_STOP);\r
+ \r
+ /* Reset Tx and Rx buffers, device disconnected */\r
+ Buffer_Initialize(&Rx_Buffer);\r
+ Buffer_Initialize(&Tx_Buffer);\r
\r
/* Indicate USB not ready */\r
UpdateStatus(Status_USBNotReady);\r
*/\r
ISR(USART1_RX_vect, ISR_BLOCK)\r
{\r
- /* Character received, store it into the buffer */\r
- Buffer_StoreElement(&Tx_Buffer, UDR1);\r
+ /* Only store received characters if the USB interface is connected */\r
+ if (USB_IsConnected)\r
+ {\r
+ /* Character received, store it into the buffer */\r
+ Buffer_StoreElement(&Tx_Buffer, UDR1);\r
+ }\r
}\r
\r
/** Function to manage status updates to the user. This is done via LEDs on the given board, if available, but may be changed to\r