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_LPC17.cpp
- Revision:
- 3:6d85e04fb59f
- Parent:
- 1:80ab0d068708
- Child:
- 8:335f2506f422
diff -r 34856a6adb5b -r 6d85e04fb59f USBDevice/USBHAL_LPC17.cpp --- a/USBDevice/USBHAL_LPC17.cpp Tue Jul 17 14:35:40 2012 +0000 +++ b/USBDevice/USBHAL_LPC17.cpp Sun Oct 14 12:38:56 2012 +0000 @@ -371,7 +371,6 @@ // Attach IRQ instance = this; NVIC_SetVector(USB_IRQn, (uint32_t)&_usbisr); - NVIC_EnableIRQ(USB_IRQn); // Enable interrupts for device events and EP0 LPC_USB->USBDevIntEn = EP_SLOW | DEV_STAT | FRAME; @@ -388,11 +387,13 @@ } void USBHAL::connect(void) { + NVIC_EnableIRQ(USB_IRQn); // Connect USB device SIEconnect(); } void USBHAL::disconnect(void) { + NVIC_DisableIRQ(USB_IRQn); // Disconnect USB device SIEdisconnect(); }