aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-07-22 20:33:53 -0400
committerbnewbold <bnewbold@robocracy.org>2010-07-22 20:33:53 -0400
commit31f9eb2364bbf2ef79a3bdc64c3b692cb218db81 (patch)
tree11167670cb329d85f3259fe625af7cc59f82f56c /wirish
parent99c251b8462e7bc304e9e4a52bfc378d22804291 (diff)
downloadlibrambutan-31f9eb2364bbf2ef79a3bdc64c3b692cb218db81.tar.gz
librambutan-31f9eb2364bbf2ef79a3bdc64c3b692cb218db81.zip
last usbserial change... please?
Diffstat (limited to 'wirish')
-rw-r--r--wirish/usb_serial.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp
index c066112..fafdf49 100644
--- a/wirish/usb_serial.cpp
+++ b/wirish/usb_serial.cpp
@@ -46,6 +46,9 @@ void USBSerial::end(void) {
}
void USBSerial::write(uint8 ch) {
+ if(!(usbIsConnected() && usbIsConfigured())) {
+ return;
+ }
uint16 status = 0;
uint32 start = millis();
while(status == 0 && (millis() - start <= USB_TIMEOUT)) {
@@ -54,6 +57,9 @@ void USBSerial::write(uint8 ch) {
}
void USBSerial::write(const char *str) {
+ if(!(usbIsConnected() && usbIsConfigured())) {
+ return;
+ }
uint32 len = strlen(str);
uint16 status = 0;
uint16 oldstatus = 0;
@@ -67,9 +73,12 @@ void USBSerial::write(const char *str) {
}
void USBSerial::write(void *buf, uint32 size) {
- if (!buf) {
- return;
- }
+ if(!(usbIsConnected() && usbIsConfigured())) {
+ return;
+ }
+ if (!buf) {
+ return;
+ }
uint16 status = 0;
uint16 oldstatus = 0;
uint32 start = millis();