Modified USBDevice mainly for debug of serial port communications. It is unfinished and should not be used - use the main branch.
Fork of USBDevice by
Diff: USBSerial/USBSerial.cpp
- Revision:
- 11:04aaad10c94e
- Parent:
- 6:d0945750af57
--- a/USBSerial/USBSerial.cpp Fri Mar 01 13:10:29 2013 +0000 +++ b/USBSerial/USBSerial.cpp Sun Sep 01 23:34:33 2013 +0000 @@ -26,6 +26,17 @@ return 1; } +int USBSerial::_putcNB(int c) { + if (!terminal_connected) + return 0; + if (!sendNB((uint8_t *)&c, 1)) { + return 0; + } + else { + return 1; + } +} + int USBSerial::_getc() { uint8_t c; while (buf.isEmpty()); @@ -64,6 +75,15 @@ return true; } +bool USBSerial::deviceAttached(void) { + if (terminal_connected) { + return true; + } + else { + return false; + } +} + uint8_t USBSerial::available() { return buf.available(); }