Explorar o código

msp430 disconnect/connect

hathach %!s(int64=6) %!d(string=hai) anos
pai
achega
18d936b414
Modificáronse 1 ficheiros con 18 adicións e 3 borrados
  1. 18 3
      src/portable/ti/msp430x5xx/dcd_msp430x5xx.c

+ 18 - 3
src/portable/ti/msp430x5xx/dcd_msp430x5xx.c

@@ -134,9 +134,6 @@ void dcd_init (uint8_t rhport)
   // Enable reset and wait for it before continuing.
   USBIE |= RSTRIE;
 
-  // Enable pullup.
-  USBCNF |= PUR_EN;
-
   USBKEYPID = 0;
 }
 
@@ -207,6 +204,24 @@ void dcd_remote_wakeup(uint8_t rhport)
   (void) rhport;
 }
 
+void dcd_connect(uint8_t rhport)
+{
+  (void) rhport;
+
+  USBKEYPID = USBKEY;
+  USBCNF |= PUR_EN; // Enable pullup.
+  USBKEYPID = 0;
+}
+
+void dcd_disconnect(uint8_t rhport)
+{
+  (void) rhport;
+
+  USBKEYPID = USBKEY;
+  USBCNF &= ~PUR_EN; // Disable pullup.
+  USBKEYPID = 0;
+}
+
 /*------------------------------------------------------------------*/
 /* DCD Endpoint port
  *------------------------------------------------------------------*/