@ -117,6 +117,10 @@ EVENT_HANDLER(USB_Disconnect)
Scheduler_SetTaskMode ( CDC_Task , TASK_STOP ) ;
Scheduler_SetTaskMode ( USB_USBTask , TASK_STOP ) ;
/* Reset Tx and Rx buffers, device disconnected */
Buffer_Initialize ( & Rx_Buffer ) ;
Buffer_Initialize ( & Tx_Buffer ) ;
/* Indicate USB not ready */
UpdateStatus ( Status_USBNotReady ) ;
}
@ -321,10 +325,14 @@ ISR(USART1_TX_vect, ISR_BLOCK)
* character into the Tx_Buffer circular buffer for later transmission to the host .
*/
ISR ( USART1_RX_vect , ISR_BLOCK )
{
/* Only store received characters if the USB interface is connected */
if ( USB_IsConnected )
{
/* Character received, store it into the buffer */
Buffer_StoreElement ( & Tx_Buffer , UDR1 ) ;
}
}
/** Function to manage status updates to the user. This is done via LEDs on the given board, if available, but may be changed to
* log to a serial port , or anything else that is suitable for status updates .