aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/usb/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/usb/usb.c')
-rw-r--r--libmaple/usb/usb.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c
index 448c4ff..4e86ed0 100644
--- a/libmaple/usb/usb.c
+++ b/libmaple/usb/usb.c
@@ -336,10 +336,15 @@ void usbWaitReset(void) {
*
*
*/
+void usbBlockingSendByte(char ch) {
+ while (countTx);
+ UserToPMABufferCopy(&ch,VCOM_TX_ADDR,1);
+ _SetEPTxCount(VCOM_TX_ENDP,1);
+ _SetEPTxValid(VCOM_TX_ENDP);
+ countTx = 1;
+ while (countTx);
+}
uint32 usbSendBytes(uint8* sendBuf, uint32 len) {
-
- uint16 loaded = 0;
-
/* any checks on connection (via dtr/rts) done upstream in wirish or by user */
/* last xmit hasnt finished, abort */
@@ -348,8 +353,8 @@ uint32 usbSendBytes(uint8* sendBuf, uint32 len) {
}
// We can only put VCOM_TX_EPSIZE bytes in the buffer
- if(len > VCOM_TX_EPSIZE) {
- len = VCOM_TX_EPSIZE;
+ if(len > VCOM_TX_EPSIZE/2) {
+ len = VCOM_TX_EPSIZE/2;
}
// Try to load some bytes if we can