aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmaple/usb/usb.c15
-rw-r--r--libmaple/usb/usb.h1
2 files changed, 11 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
diff --git a/libmaple/usb/usb.h b/libmaple/usb/usb.h
index 5bc31e1..0ed02e5 100644
--- a/libmaple/usb/usb.h
+++ b/libmaple/usb/usb.h
@@ -73,6 +73,7 @@ void usb_lpIRQHandler(void);
void usbWaitReset(void);
/* blocking functions for send/receive */
+void usbBlockingSendByte(char ch);
uint32 usbSendBytes(uint8* sendBuf,uint32 len);
uint32 usbBytesAvailable(void);
uint32 usbReceiveBytes(uint8* recvBuf, uint32 len);