+void AVRISP_Task(void)\r
+{\r
+ Endpoint_SelectEndpoint(AVRISP_DATA_EPNUM);\r
+ \r
+ /* Check to see if a V2 Protocol command has been received */\r
+ if (Endpoint_IsOUTReceived())\r
+ {\r
+ LEDs_SetAllLEDs(LEDMASK_BUSY);\r
+\r
+ /* Pass off processing of the V2 Protocol command to the V2 Protocol handler */\r
+ V2Protocol_ProcessCommand();\r
+\r
+ LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+ }\r
+}\r
+\r
+void USARTBridge_Task(void)\r
+{\r
+ /* Read bytes from the USB OUT endpoint into the UART transmit buffer */\r
+ for (uint8_t DataBytesRem = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface); DataBytesRem != 0; DataBytesRem--)\r
+ {\r
+ if (!(BUFF_STATICSIZE - USBtoUART_Buffer.Elements))\r
+ break;\r
+ \r
+ Buffer_StoreElement(&USBtoUART_Buffer, CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface));\r
+ }\r
+ \r
+ /* Read bytes from the UART receive buffer into the USB IN endpoint */\r
+ if (UARTtoUSB_Buffer.Elements)\r
+ CDC_Device_SendByte(&VirtualSerial_CDC_Interface, Buffer_GetElement(&UARTtoUSB_Buffer));\r
+ \r
+ /* Load bytes from the UART transmit buffer into the UART */\r
+ if ((USBtoUART_Buffer.Elements) && SoftUART_IsReady())\r
+ SoftUART_TxByte(Buffer_GetElement(&USBtoUART_Buffer));\r
+ \r
+ /* Load bytes from the UART into the UART receive buffer */\r
+ if(SoftUART_IsReceived())\r
+ Buffer_StoreElement(&UARTtoUSB_Buffer, SoftUART_RxByte());\r
+\r
+ CDC_Device_USBTask(&VirtualSerial_CDC_Interface);\r
+}\r
+\r