diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-04-03 19:25:00 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-04-03 19:25:00 +0200 |
commit | 08296d249c3b0dffa4a0abe5ee1d55e0d576c14a (patch) | |
tree | 6cdf7135e6ad984d0c02f1f854947548255f9209 /usbserial.h | |
parent | f228e3268b1cfa28bdaec86d0d3bf22edcdef661 (diff) |
Reading ITG-3200 to USB.
Diffstat (limited to 'usbserial.h')
-rw-r--r-- | usbserial.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/usbserial.h b/usbserial.h index 4eaed81..c312821 100644 --- a/usbserial.h +++ b/usbserial.h @@ -21,10 +21,16 @@ class USBSerial { } inline msg_t putc(uint8_t data, systime_t timeout = TIME_INFINITE) { + if(USBD1.state != USB_ACTIVE) { + return 0; + } return chOQPutTimeout(&susbdriver.oqueue, data, timeout); } inline size_t write(uint8_t* buf, size_t len, systime_t timeout = TIME_INFINITE) { + if(USBD1.state != USB_ACTIVE) { + return 0; + } return chOQWriteTimeout(&susbdriver.oqueue, buf, len, timeout); } }; |