!224 修改 stm32 驱动库 usbh 初始化错误
Merge pull request !224 from THEWON/usbh_init
This commit is contained in:
commit
03837384ea
|
@ -197,6 +197,8 @@ static struct uhcd_ops _uhcd_ops =
|
|||
|
||||
static rt_err_t stm32_hcd_init(rt_device_t device)
|
||||
{
|
||||
HAL_StatusTypeDef state;
|
||||
|
||||
HCD_HandleTypeDef *hhcd = (HCD_HandleTypeDef *)device->user_data;
|
||||
hhcd->Instance = USB_OTG_FS;
|
||||
hhcd->Init.Host_channels = 8;
|
||||
|
@ -204,7 +206,11 @@ static rt_err_t stm32_hcd_init(rt_device_t device)
|
|||
hhcd->Init.dma_enable = DISABLE;
|
||||
hhcd->Init.phy_itface = HCD_PHY_EMBEDDED;
|
||||
hhcd->Init.Sof_enable = DISABLE;
|
||||
RT_ASSERT(HAL_HCD_Init(hhcd) == HAL_OK);
|
||||
state = HAL_HCD_Init(hhcd);
|
||||
if (state != HAL_OK)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
HAL_HCD_Start(hhcd);
|
||||
#ifdef USBH_USING_CONTROLLABLE_POWER
|
||||
rt_pin_mode(USBH_POWER_PIN, PIN_MODE_OUTPUT);
|
||||
|
|
Loading…
Reference in New Issue