added dcd disconnect/connect to lpc17/40

This commit is contained in:
hathach
2020-04-16 15:52:45 +07:00
parent aa5ab50e86
commit 969121df4f
2 changed files with 14 additions and 6 deletions

View File

@@ -181,9 +181,7 @@ void dcd_init(uint8_t rhport)
LPC_USB->UDCAH = (uint32_t) _dcd.udca;
LPC_USB->DMAIntEn = (DMA_INT_END_OF_XFER_MASK /*| DMA_INT_NEW_DD_REQUEST_MASK*/ | DMA_INT_ERROR_MASK);
sie_write(SIE_CMDCODE_DEVICE_STATUS, 1, 1); // connect
// USB IRQ priority should be set by application previously
// Clear pending IRQ
NVIC_ClearPendingIRQ(USB_IRQn);
}
@@ -219,6 +217,16 @@ void dcd_remote_wakeup(uint8_t rhport)
(void) rhport;
}
void dcd_connect(uint8_t rhport)
{
sie_write(SIE_CMDCODE_DEVICE_STATUS, 1, SIE_DEV_STATUS_CONNECT_STATUS_MASK);
}
void dcd_disconnect(uint8_t rhport)
{
sie_write(SIE_CMDCODE_DEVICE_STATUS, 1, 0);
}
//--------------------------------------------------------------------+
// CONTROL HELPER
//--------------------------------------------------------------------+