84 lines
2.1 KiB
C
84 lines
2.1 KiB
C
/**
|
|
******************************************************************************
|
|
* File Name : USB.c
|
|
* Description : This file provides code for the configuration
|
|
* of the USB instances.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
|
* All rights reserved.</center></h2>
|
|
*
|
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
* the "License"; You may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at:
|
|
* opensource.org/licenses/BSD-3-Clause
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "usb.h"
|
|
|
|
/* USER CODE BEGIN 0 */
|
|
|
|
/* USER CODE END 0 */
|
|
|
|
PCD_HandleTypeDef hpcd_USB_FS;
|
|
|
|
/* USB init function */
|
|
|
|
void MX_USB_PCD_Init(void)
|
|
{
|
|
|
|
hpcd_USB_FS.Instance = USB;
|
|
hpcd_USB_FS.Init.dev_endpoints = 8;
|
|
hpcd_USB_FS.Init.speed = PCD_SPEED_FULL;
|
|
hpcd_USB_FS.Init.low_power_enable = DISABLE;
|
|
hpcd_USB_FS.Init.lpm_enable = DISABLE;
|
|
hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
|
|
if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK)
|
|
{
|
|
Error_Handler();
|
|
}
|
|
|
|
}
|
|
|
|
void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle)
|
|
{
|
|
|
|
if(pcdHandle->Instance==USB)
|
|
{
|
|
/* USER CODE BEGIN USB_MspInit 0 */
|
|
|
|
/* USER CODE END USB_MspInit 0 */
|
|
/* USB clock enable */
|
|
__HAL_RCC_USB_CLK_ENABLE();
|
|
/* USER CODE BEGIN USB_MspInit 1 */
|
|
|
|
/* USER CODE END USB_MspInit 1 */
|
|
}
|
|
}
|
|
|
|
void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle)
|
|
{
|
|
|
|
if(pcdHandle->Instance==USB)
|
|
{
|
|
/* USER CODE BEGIN USB_MspDeInit 0 */
|
|
|
|
/* USER CODE END USB_MspDeInit 0 */
|
|
/* Peripheral clock disable */
|
|
__HAL_RCC_USB_CLK_DISABLE();
|
|
/* USER CODE BEGIN USB_MspDeInit 1 */
|
|
|
|
/* USER CODE END USB_MspDeInit 1 */
|
|
}
|
|
}
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE END 1 */
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|