Fix USBtoSerial device demos -- ensure the UDR1 register contents is read in under all circumstances which fire the ISR, so that the receive complete interrupt is cleared correctly to prevent freezes.

This commit is contained in:
Dean Camera 2009-08-16 10:57:47 +00:00
parent b71ff7c8cd
commit 3a85962f94
2 changed files with 6 additions and 2 deletions

View file

@ -147,8 +147,10 @@ void EVENT_USB_Device_UnhandledControlPacket(void)
*/
ISR(USART1_RX_vect, ISR_BLOCK)
{
uint8_t ReceivedByte = UDR1;
if (USB_DeviceState == DEVICE_STATE_Configured)
Buffer_StoreElement(&Tx_Buffer, UDR1);
Buffer_StoreElement(&Tx_Buffer, ReceivedByte);
}
/** Event handler for the CDC Class driver Line Encoding Changed event.