diff options
| author | Ha Thach <[email protected]> | 2020-04-10 16:11:04 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-04-10 16:11:04 +0700 |
| commit | bbb0e1088dad9f22b3447cc932270cbc0d84a453 (patch) | |
| tree | fab371cfc4936b9212dc72403267959704f00994 /src/portable/microchip | |
| parent | 36b33ee775a02e1263f61bc4a82e58d8e8559734 (diff) | |
| parent | d6578823bb405cacbda13a044b66ba0a4f16a3d4 (diff) | |
Merge pull request #330 from hathach/dcd-disconnect-connect
Dcd disconnect connect for samd and nrf
Diffstat (limited to 'src/portable/microchip')
| -rw-r--r-- | src/portable/microchip/samd/dcd_samd.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/portable/microchip/samd/dcd_samd.c b/src/portable/microchip/samd/dcd_samd.c index 148995520..c3d2985d4 100644 --- a/src/portable/microchip/samd/dcd_samd.c +++ b/src/portable/microchip/samd/dcd_samd.c @@ -154,10 +154,23 @@ void dcd_set_config (uint8_t rhport, uint8_t config_num) void dcd_remote_wakeup(uint8_t rhport) { (void) rhport; - USB->DEVICE.CTRLB.bit.UPRSM = 1; } +// disconnect by disabling internal pull-up resistor on D+/D- +void dcd_disconnect(uint8_t rhport) +{ + (void) rhport; + USB->DEVICE.CTRLB.reg |= USB_DEVICE_CTRLB_DETACH; +} + +// connect by enabling internal pull-up resistor on D+/D- +void dcd_connect(uint8_t rhport) +{ + (void) rhport; + USB->DEVICE.CTRLB.reg &= ~USB_DEVICE_CTRLB_DETACH; +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ |
