Created
August 29, 2015 21:25
-
-
Save blondie7575/87169d7bbbb4fded4446 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Pseudo-code. May not compile or work | |
| for (;;) | |
| { | |
| // Check for host data | |
| uint16_t byteCount = CDC_Device_BytesReceived(&EETool_CDC_Interface); | |
| byteCount = MIN(byteCount,BUFF_SIZE-1); | |
| if (byteCount>BUFF_SIZE) | |
| { | |
| FatalError(); | |
| } | |
| if (byteCount>0) | |
| { | |
| // Read all data from host | |
| int i; | |
| for (i=0; i<byteCount; i++) | |
| { | |
| int16_t value = CDC_Device_ReceiveByte(&EETool_CDC_Interface); | |
| if (value>=0) | |
| { | |
| gCommBuffer[i] = (uint8_t)value; | |
| } | |
| CDC_Device_SendData(&EETool_CDC_Interface, gCommBuffer, byteCount); | |
| } | |
| } | |
| CDC_Device_USBTask(&EETool_CDC_Interface); | |
| USB_USBTask(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment