diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-07 23:54:57 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-07 23:54:57 +0000 |
commit | 181bfb6db2a089442e5b3d38d68b1236b8aa0eb0 (patch) | |
tree | 810f2a7553671410eda586941f898d10b93103e6 /stmhal/usbd_conf.c | |
parent | c223df5113a486288c3d9651e2e7b7bd67f37c0a (diff) | |
download | micropython-181bfb6db2a089442e5b3d38d68b1236b8aa0eb0.tar.gz micropython-181bfb6db2a089442e5b3d38d68b1236b8aa0eb0.zip |
stmhal: Add MICROPY_HW_USB_VBUS_DETECT_PIN option, for boards without it
Since all currently supported boards use pin A9 for this function, the
value of the macro MICROPY_HW_USB_VBUS_DETECT_PIN is not actually used,
just the fact that it is defined.
Addresses issue #1048.
Diffstat (limited to 'stmhal/usbd_conf.c')
-rw-r--r-- | stmhal/usbd_conf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/stmhal/usbd_conf.c b/stmhal/usbd_conf.c index 1ffee3fe90..2ff31c9892 100644 --- a/stmhal/usbd_conf.c +++ b/stmhal/usbd_conf.c @@ -71,10 +71,13 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* Configure VBUS Pin */
+#if defined(MICROPY_HW_USB_VBUS_DETECT_PIN)
+ // USB VBUS detect pin is always A9
GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+#endif
#if USE_USB_OTG_ID
GPIO_InitStruct.Pin = GPIO_PIN_10;
@@ -340,8 +343,8 @@ USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev) hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.Sof_enable = 0;
hpcd.Init.speed = PCD_SPEED_FULL;
-#if defined(HYDRABUSV10)
- hpcd.Init.vbus_sensing_enable = 0; /* No VBUS Sensing on USB0 for HydraBus (VBUS is not connected on GPIOA9) */
+#if !defined(MICROPY_HW_USB_VBUS_DETECT_PIN)
+ hpcd.Init.vbus_sensing_enable = 0; // No VBUS Sensing on USB0
#else
hpcd.Init.vbus_sensing_enable = 1;
#endif
|