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); } }
Diff: USBDevice/USBHAL_LPC11U.cpp
- Revision:
- 57:7a8dce0a3c84
- Parent:
- 30:4408411999c8
diff -r 151ba33713ff -r 7a8dce0a3c84 USBDevice/USBHAL_LPC11U.cpp --- a/USBDevice/USBHAL_LPC11U.cpp Mon Jun 08 08:15:25 2015 +0100 +++ b/USBDevice/USBHAL_LPC11U.cpp Mon Jun 15 07:15:54 2015 +0100 @@ -668,8 +668,10 @@ if (LPC_USB->DEVCMDSTAT & DSUS_C) { // Suspend status changed LPC_USB->DEVCMDSTAT = devCmdStat | DSUS_C; - if((LPC_USB->DEVCMDSTAT & DSUS) != 0) { + if (LPC_USB->DEVCMDSTAT & DSUS) { suspendStateChanged(1); + } else { + suspendStateChanged(0); } } @@ -677,8 +679,6 @@ // Bus reset LPC_USB->DEVCMDSTAT = devCmdStat | DRES_C; - suspendStateChanged(0); - // Disable endpoints > 0 disableEndpoints();