USB device stack
Fork of USBDevice by
Diff: USBDevice/USBHAL_LPC40.cpp
- Revision:
- 25:7c72828865f3
- Parent:
- 12:6030a12b6c62
diff -r 33920e3786aa -r 7c72828865f3 USBDevice/USBHAL_LPC40.cpp --- a/USBDevice/USBHAL_LPC40.cpp Fri May 16 09:00:39 2014 +0100 +++ b/USBDevice/USBHAL_LPC40.cpp Tue Jun 03 11:30:32 2014 +0100 @@ -280,7 +280,7 @@ SIEselectEndpoint(endpoint); SIEclearBuffer(); } - + return size; } @@ -328,7 +328,7 @@ USBHAL::USBHAL(void) { // Disable IRQ NVIC_DisableIRQ(USB_IRQn); - + // fill in callback array epCallback[0] = &USBHAL::EP1_OUT_callback; epCallback[1] = &USBHAL::EP1_IN_callback; @@ -367,7 +367,7 @@ // Enable USB clocks LPC_USB->USBClkCtrl |= DEV_CLK_EN | AHB_CLK_EN | PORT_CLK_EN; while ((LPC_USB->USBClkSt & (DEV_CLK_EN | AHB_CLK_EN | PORT_CLK_EN)) != (DEV_CLK_ON | AHB_CLK_ON | PORT_CLK_EN)); - + // Select port USB2 LPC_USB->StCtrl |= 3; @@ -375,13 +375,13 @@ // Configure pin P0.31 to be USB2 LPC_IOCON->P0_31 &= ~0x07; LPC_IOCON->P0_31 |= 0x01; - + // Disconnect USB device SIEdisconnect(); // Configure pin P0.14 to be Connect LPC_IOCON->P0_14 &= ~0x07; - LPC_IOCON->P0_14 |= 0x03; + LPC_IOCON->P0_14 |= 0x03; // Connect must be low for at least 2.5uS wait(0.3); @@ -471,7 +471,7 @@ if (!(epComplete & EP(endpoint))) return EP_PENDING; } - + *bytesRead = endpointReadcore(endpoint, buffer); epComplete &= ~EP(endpoint); return EP_COMPLETED; @@ -611,7 +611,7 @@ LPC_USB->DevIntClr = EP_SLOW; EP0in(); } - + for (uint8_t num = 2; num < 16*2; num++) { if (LPC_USB->EpIntSt & EP(num)) { selectEndpointClearInterrupt(num);