Tomas Cerskus / USBDevice

Fork of USBDevice by Tomas Cerskus

Files at this revision

API Documentation at this revision

Comitter:
tolaipner
Date:
Sun Mar 30 07:30:18 2014 +0000
Parent:
23:ee5d634d099e
Commit message:
Added Nucleo F401RE support

Changed in this revision

USBDevice/USBHAL_STM32F4.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ee5d634d099e -r 4ed3e25c3edc USBDevice/USBHAL_STM32F4.cpp
--- a/USBDevice/USBHAL_STM32F4.cpp	Sun Mar 30 07:24:27 2014 +0000
+++ b/USBDevice/USBHAL_STM32F4.cpp	Sun Mar 30 07:30:18 2014 +0000
@@ -62,6 +62,14 @@
     pin_function(PA_10, STM_PIN_DATA(2, 10));
     pin_function(PA_11, STM_PIN_DATA(2, 10));
     pin_function(PA_12, STM_PIN_DATA(2, 10));
+    
+    // Set ID pin to open drain with pull-up resistor
+    pin_mode(PA_10, OpenDrain);
+    GPIOA->PUPDR &= ~(0x3 << 20);
+    GPIOA->PUPDR |= 1 << 20;
+
+    // Set VBUS pin to open drain
+    pin_mode(PA_9, OpenDrain);
 #endif
 
     RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;