//******************************************************************************************* void USBSerial::write(const uint8_t *buffer, size_t size) { if (size < kMaxUSBxmitPkt) { //* it will fit in one transmit packet cdcacm_print(buffer, size); } else { //* we can only transmit a maxium of 64 bytes at a time, break it up into 64 byte packets unsigned char usbBuffer[kMaxUSBxmitPkt + 2]; unsigned short ii; size_t packetSize; packetSize = 0; for (ii=0; ii<size; ii++) { usbBuffer[packetSize++] = buffer[ii]; if (packetSize >= kMaxUSBxmitPkt) { cdcacm_print(usbBuffer, packetSize); packetSize = 0; } } if (packetSize > 0) { cdcacm_print(usbBuffer, packetSize); } } }
//******************************************************************************************* void USBSerial::write(uint8_t theChar) { unsigned char usbBuf[4]; usbBuf[0] = theChar; cdcacm_print(usbBuf, 1); }
//******************************************************************************************* size_t USBSerial::write(uint8_t theChar) { unsigned char usbBuf[4]; usbBuf[0] = theChar; TXOn(); cdcacm_print(usbBuf, 1); TXOff(); return 1; }