summaryrefslogtreecommitdiff
path: root/src/portable/microchip
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-04-09 11:47:02 +0700
committerhathach <[email protected]>2020-04-09 11:47:02 +0700
commitc1f3fbbc03256d303d5ce355bd0cf87a0d3c4f4c (patch)
tree7a1bfee978e96857314144a726e20e83bd066903 /src/portable/microchip
parent11201f1a06396d4ab8302f2bb5ce579cb4ae7a6c (diff)
implement dcd connect/disconnect for samd and nrf
Diffstat (limited to 'src/portable/microchip')
-rw-r--r--src/portable/microchip/samd/dcd_samd.c15
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
*------------------------------------------------------------------*/