Updated and Validated
[betaflight.git] / lib / main / STM32_USB_OTG_Driver / src / usb_bsp_template.c
blob5bba0e071c92b9dbbc428b357c2df0e016570e32
1 /**
2 ******************************************************************************
3 * @file usb_bsp.c
4 * @author MCD Application Team
5 * @version V2.2.0
6 * @date 09-November-2015
7 * @brief This file is responsible to offer board support package and is
8 * configurable by user.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
27 */
29 /* Includes ------------------------------------------------------------------*/
30 #include "usb_bsp.h"
32 /** @addtogroup USB_OTG_DRIVER
33 * @{
36 /** @defgroup USB_BSP
37 * @brief This file is responsible to offer board support package
38 * @{
39 */
41 /** @defgroup USB_BSP_Private_Defines
42 * @{
43 */
44 /**
45 * @}
46 */
49 /** @defgroup USB_BSP_Private_TypesDefinitions
50 * @{
51 */
52 /**
53 * @}
54 */
60 /** @defgroup USB_BSP_Private_Macros
61 * @{
62 */
63 /**
64 * @}
65 */
67 /** @defgroup USBH_BSP_Private_Variables
68 * @{
69 */
71 /**
72 * @}
73 */
75 /** @defgroup USBH_BSP_Private_FunctionPrototypes
76 * @{
77 */
78 /**
79 * @}
80 */
82 /** @defgroup USB_BSP_Private_Functions
83 * @{
84 */
87 /**
88 * @brief USB_OTG_BSP_Init
89 * Initializes BSP configurations
90 * @param None
91 * @retval None
94 void USB_OTG_BSP_Init(void)
98 /**
99 * @brief USB_OTG_BSP_EnableInterrupt
100 * Enable USB Global interrupt
101 * @param None
102 * @retval None
104 void USB_OTG_BSP_EnableInterrupt(void)
110 * @brief BSP_Drive_VBUS
111 * Drives the Vbus signal through IO
112 * @param speed : Full, Low
113 * @param state : VBUS states
114 * @retval None
117 void USB_OTG_BSP_DriveVBUS(uint32_t speed, uint8_t state)
119 (void)speed;
120 (void)state;
125 * @brief USB_OTG_BSP_ConfigVBUS
126 * Configures the IO for the Vbus and OverCurrent
127 * @param Speed : Full, Low
128 * @retval None
131 void USB_OTG_BSP_ConfigVBUS(uint32_t speed)
133 (void)speed;
138 * @brief USB_OTG_BSP_TimeInit
139 * Initialises delay unit Systick timer /Timer2
140 * @param None
141 * @retval None
143 void USB_OTG_BSP_TimeInit ( void )
149 * @brief USB_OTG_BSP_uDelay
150 * This function provides delay time in micro sec
151 * @param usec : Value of delay required in micro sec
152 * @retval None
154 void USB_OTG_BSP_uDelay (const uint32_t usec)
157 uint32_t count = 0;
158 const uint32_t utime = (120 * usec / 7);
161 if ( ++count > utime )
163 return ;
166 while (1);
172 * @brief USB_OTG_BSP_mDelay
173 * This function provides delay time in milli sec
174 * @param msec : Value of delay required in milli sec
175 * @retval None
177 void USB_OTG_BSP_mDelay (const uint32_t msec)
180 USB_OTG_BSP_uDelay(msec * 1000);
186 * @brief USB_OTG_BSP_TimerIRQ
187 * Time base IRQ
188 * @param None
189 * @retval None
192 void USB_OTG_BSP_TimerIRQ (void)
198 * @}
202 * @}
206 * @}
209 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/