stmhal: Add MICROPY_HW_USB_OTG_ID_PIN config, set for relevant boards.

This config option is for the USB OTG pin, pin A10.  This is used on
some boards but not others.  Eg PYBv3 uses PA10 for LED(2), so it
shouldn't be used for OTG ID (actually PA10 is multiplexed on this
board, but defaults to LED(2)).

Partially addresses issue #1059.
This commit is contained in:
Damien George 2015-01-12 16:13:29 +00:00
parent 7630d9ca0e
commit 131185a2b8
6 changed files with 11 additions and 9 deletions

View File

@ -37,3 +37,6 @@
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8)
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
#define MICROPY_HW_SDCARD_DETECT_PRESENT (1)
// USB config
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

View File

@ -48,7 +48,6 @@
#define STM32F405xx
#define USE_USB_FS
#define USE_USB_OTG_ID 0
/* ########################## Module Selection ############################## */
/**

View File

@ -39,5 +39,6 @@
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
// USB VBUS detect pin
// USB config
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

View File

@ -38,5 +38,6 @@
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
#define MICROPY_HW_SDCARD_DETECT_PRESENT (GPIO_PIN_RESET)
// USB VBUS detect pin
// USB config
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

View File

@ -33,5 +33,6 @@
#define MICROPY_HW_LED_ON(pin) (pin->gpio->BSRRL = pin->pin_mask)
#define MICROPY_HW_LED_OFF(pin) (pin->gpio->BSRRH = pin->pin_mask)
// USB VBUS detect pin
// USB config
#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9)
#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10)

View File

@ -33,10 +33,6 @@
#include "stm32f4xx_hal.h"
#include "usbd_core.h"
#if !defined(USE_USB_OTG_ID)
#define USE_USB_OTG_ID 1
#endif
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
@ -79,7 +75,8 @@ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif
#if USE_USB_OTG_ID
#if defined(MICROPY_HW_USB_OTG_ID_PIN)
// USB ID pin is always A10
GPIO_InitStruct.Pin = GPIO_PIN_10;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;