Procházet zdrojové kódy

samg implement dcd connect/disconnect

hathach před 6 roky
rodič
revize
36d4efa077
1 změnil soubory, kde provedl 17 přidání a 3 odebrání
  1. 17 3
      src/portable/microchip/samg/dcd_samg.c

+ 17 - 3
src/portable/microchip/samg/dcd_samg.c

@@ -138,9 +138,6 @@ void dcd_init (uint8_t rhport)
   (void) rhport;
 
   tu_memclr(_dcd_xfer, sizeof(_dcd_xfer));
-
-  // Enable pull-up, disable transceiver
-  UDP->UDP_TXVC = UDP_TXVC_PUON | UDP_TXVC_TXVDIS_Msk;
 }
 
 // Enable device interrupt
@@ -186,6 +183,23 @@ void dcd_remote_wakeup (uint8_t rhport)
   (void) rhport;
 }
 
+void dcd_connect(uint8_t rhport)
+{
+  (void) rhport;
+
+  // Enable pull-up, disable transceiver
+  UDP->UDP_TXVC = UDP_TXVC_PUON | UDP_TXVC_TXVDIS_Msk;
+}
+
+void dcd_disconnect(uint8_t rhport)
+{
+  (void) rhport;
+
+  // disable both pullup and transceiver
+  UDP->UDP_TXVC = UDP_TXVC_TXVDIS_Msk;
+}
+
+
 //--------------------------------------------------------------------+
 // Endpoint API
 //--------------------------------------------------------------------+