USBSerial: reduce number of packets sent when puts() is invoked
authorMichael Moon <triffid.hunter@gmail.com>
Wed, 26 Dec 2012 06:55:36 +0000 (17:55 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Wed, 2 Jan 2013 00:45:29 +0000 (11:45 +1100)
src/libs/USBDevice/USBSerial/USBSerial.cpp

index 6520196..a999696 100644 (file)
@@ -71,10 +71,12 @@ int USBSerial::puts(const char *str)
     int i = 0;\r
     while (*str)\r
     {\r
-        _putc(*str);\r
+        if ((*str != '\r') && txbuf.free())\r
+            txbuf.queue(*str);\r
         i++;\r
         str++;\r
     }\r
+    usb->endpointSetInterrupt(CDC_BulkIn.bEndpointAddress, true);\r
     return i;\r
 }\r
 \r