USB device stack; Added getter method for terminal_connected;
Fork of USBDevice by
Example of use:
#include "mbed.h" #include "USBSerial.h" USBSerial pc; DigitalOut blue_led(P0_20); int main() { blue_led = 1; while(!pc.getTerminal_connected()); //Wait for serial terminal to connect... while(1) { blue_led = 0; wait(0.2); blue_led = 1; wait(0.2); } }
Revision 64:fe3884917848, committed 2016-10-01
- Comitter:
- diego_be
- Date:
- Sat Oct 01 04:43:09 2016 +0000
- Parent:
- 63:01321bd6ff89
- Commit message:
- Added getter method for terminal_connected
Changed in this revision
USBSerial/USBCDC.cpp | Show annotated file Show diff for this revision Revisions of this file |
USBSerial/USBCDC.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 01321bd6ff89 -r fe3884917848 USBSerial/USBCDC.cpp --- a/USBSerial/USBCDC.cpp Tue May 03 00:16:32 2016 +0100 +++ b/USBSerial/USBCDC.cpp Sat Oct 01 04:43:09 2016 +0000 @@ -284,3 +284,7 @@ }; return configDescriptor; } + +bool USBCDC::getTerminal_connected(){ + return terminal_connected; +}
diff -r 01321bd6ff89 -r fe3884917848 USBSerial/USBCDC.h --- a/USBSerial/USBCDC.h Tue May 03 00:16:32 2016 +0100 +++ b/USBSerial/USBCDC.h Sat Oct 01 04:43:09 2016 +0000 @@ -38,7 +38,7 @@ * @param connect_blocking define if the connection must be blocked if USB not plugged in */ USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking); - + bool getTerminal_connected(); protected: /* @@ -117,7 +117,7 @@ virtual void USBCallback_requestCompleted(uint8_t *buf, uint32_t length); virtual bool USBCallback_setConfiguration(uint8_t configuration); volatile bool terminal_connected; - + }; #endif