Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file stm32f4xx_hal_pcd.h
sahilmgandhi 18:6a4db94011d3 4 * @author MCD Application Team
sahilmgandhi 18:6a4db94011d3 5 * @version V1.5.0
sahilmgandhi 18:6a4db94011d3 6 * @date 06-May-2016
sahilmgandhi 18:6a4db94011d3 7 * @brief Header file of PCD HAL module.
sahilmgandhi 18:6a4db94011d3 8 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 9 * @attention
sahilmgandhi 18:6a4db94011d3 10 *
sahilmgandhi 18:6a4db94011d3 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
sahilmgandhi 18:6a4db94011d3 12 *
sahilmgandhi 18:6a4db94011d3 13 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 14 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 15 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 16 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 18 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 19 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
sahilmgandhi 18:6a4db94011d3 21 * may be used to endorse or promote products derived from this software
sahilmgandhi 18:6a4db94011d3 22 * without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 23 *
sahilmgandhi 18:6a4db94011d3 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
sahilmgandhi 18:6a4db94011d3 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sahilmgandhi 18:6a4db94011d3 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
sahilmgandhi 18:6a4db94011d3 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sahilmgandhi 18:6a4db94011d3 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
sahilmgandhi 18:6a4db94011d3 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
sahilmgandhi 18:6a4db94011d3 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
sahilmgandhi 18:6a4db94011d3 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 34 *
sahilmgandhi 18:6a4db94011d3 35 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 36 */
sahilmgandhi 18:6a4db94011d3 37
sahilmgandhi 18:6a4db94011d3 38 /* Define to prevent recursive inclusion -------------------------------------*/
sahilmgandhi 18:6a4db94011d3 39 #ifndef __STM32F4xx_HAL_PCD_H
sahilmgandhi 18:6a4db94011d3 40 #define __STM32F4xx_HAL_PCD_H
sahilmgandhi 18:6a4db94011d3 41
sahilmgandhi 18:6a4db94011d3 42 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 43 extern "C" {
sahilmgandhi 18:6a4db94011d3 44 #endif
sahilmgandhi 18:6a4db94011d3 45 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
sahilmgandhi 18:6a4db94011d3 46 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
sahilmgandhi 18:6a4db94011d3 47 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
sahilmgandhi 18:6a4db94011d3 48 defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
sahilmgandhi 18:6a4db94011d3 49 defined(STM32F412Rx) || defined(STM32F412Cx)
sahilmgandhi 18:6a4db94011d3 50 /* Includes ------------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 51 #include "stm32f4xx_ll_usb.h"
sahilmgandhi 18:6a4db94011d3 52
sahilmgandhi 18:6a4db94011d3 53 /** @addtogroup STM32F4xx_HAL_Driver
sahilmgandhi 18:6a4db94011d3 54 * @{
sahilmgandhi 18:6a4db94011d3 55 */
sahilmgandhi 18:6a4db94011d3 56
sahilmgandhi 18:6a4db94011d3 57 /** @addtogroup PCD
sahilmgandhi 18:6a4db94011d3 58 * @{
sahilmgandhi 18:6a4db94011d3 59 */
sahilmgandhi 18:6a4db94011d3 60
sahilmgandhi 18:6a4db94011d3 61 /* Exported types ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 62 /** @defgroup PCD_Exported_Types PCD Exported Types
sahilmgandhi 18:6a4db94011d3 63 * @{
sahilmgandhi 18:6a4db94011d3 64 */
sahilmgandhi 18:6a4db94011d3 65
sahilmgandhi 18:6a4db94011d3 66 /**
sahilmgandhi 18:6a4db94011d3 67 * @brief PCD State structure definition
sahilmgandhi 18:6a4db94011d3 68 */
sahilmgandhi 18:6a4db94011d3 69 typedef enum
sahilmgandhi 18:6a4db94011d3 70 {
sahilmgandhi 18:6a4db94011d3 71 HAL_PCD_STATE_RESET = 0x00U,
sahilmgandhi 18:6a4db94011d3 72 HAL_PCD_STATE_READY = 0x01U,
sahilmgandhi 18:6a4db94011d3 73 HAL_PCD_STATE_ERROR = 0x02U,
sahilmgandhi 18:6a4db94011d3 74 HAL_PCD_STATE_BUSY = 0x03U,
sahilmgandhi 18:6a4db94011d3 75 HAL_PCD_STATE_TIMEOUT = 0x04U
sahilmgandhi 18:6a4db94011d3 76 } PCD_StateTypeDef;
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78 #ifdef USB_OTG_GLPMCFG_LPMEN
sahilmgandhi 18:6a4db94011d3 79 /* Device LPM suspend state */
sahilmgandhi 18:6a4db94011d3 80 typedef enum
sahilmgandhi 18:6a4db94011d3 81 {
sahilmgandhi 18:6a4db94011d3 82 LPM_L0 = 0x00U, /* on */
sahilmgandhi 18:6a4db94011d3 83 LPM_L1 = 0x01U, /* LPM L1 sleep */
sahilmgandhi 18:6a4db94011d3 84 LPM_L2 = 0x02U, /* suspend */
sahilmgandhi 18:6a4db94011d3 85 LPM_L3 = 0x03U /* off */
sahilmgandhi 18:6a4db94011d3 86 }PCD_LPM_StateTypeDef;
sahilmgandhi 18:6a4db94011d3 87 #endif /* USB_OTG_GLPMCFG_LPMEN */
sahilmgandhi 18:6a4db94011d3 88
sahilmgandhi 18:6a4db94011d3 89 typedef USB_OTG_GlobalTypeDef PCD_TypeDef;
sahilmgandhi 18:6a4db94011d3 90 typedef USB_OTG_CfgTypeDef PCD_InitTypeDef;
sahilmgandhi 18:6a4db94011d3 91 typedef USB_OTG_EPTypeDef PCD_EPTypeDef ;
sahilmgandhi 18:6a4db94011d3 92
sahilmgandhi 18:6a4db94011d3 93 /**
sahilmgandhi 18:6a4db94011d3 94 * @brief PCD Handle Structure definition
sahilmgandhi 18:6a4db94011d3 95 */
sahilmgandhi 18:6a4db94011d3 96
sahilmgandhi 18:6a4db94011d3 97 typedef struct
sahilmgandhi 18:6a4db94011d3 98 {
sahilmgandhi 18:6a4db94011d3 99 HAL_LockTypeDef Lock;
sahilmgandhi 18:6a4db94011d3 100 } PCD_EPLockDef;
sahilmgandhi 18:6a4db94011d3 101
sahilmgandhi 18:6a4db94011d3 102 typedef struct
sahilmgandhi 18:6a4db94011d3 103 {
sahilmgandhi 18:6a4db94011d3 104 PCD_TypeDef *Instance; /*!< Register base address */
sahilmgandhi 18:6a4db94011d3 105 PCD_InitTypeDef Init; /*!< PCD required parameters */
sahilmgandhi 18:6a4db94011d3 106 PCD_EPTypeDef IN_ep[15]; /*!< IN endpoint parameters */
sahilmgandhi 18:6a4db94011d3 107 PCD_EPTypeDef OUT_ep[15]; /*!< OUT endpoint parameters */
sahilmgandhi 18:6a4db94011d3 108 HAL_LockTypeDef Lock; /*!< PCD peripheral status */
sahilmgandhi 18:6a4db94011d3 109 PCD_EPLockDef EPLock[15]; /*!< PCD endpoint peripheral status */
sahilmgandhi 18:6a4db94011d3 110 __IO PCD_StateTypeDef State; /*!< PCD communication state */
sahilmgandhi 18:6a4db94011d3 111 uint32_t Setup[12]; /*!< Setup packet buffer */
sahilmgandhi 18:6a4db94011d3 112 #ifdef USB_OTG_GLPMCFG_LPMEN
sahilmgandhi 18:6a4db94011d3 113 PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */
sahilmgandhi 18:6a4db94011d3 114 uint32_t BESL;
sahilmgandhi 18:6a4db94011d3 115 uint32_t lpm_active; /*!< Enable or disable the Link Power Management .
sahilmgandhi 18:6a4db94011d3 116 This parameter can be set to ENABLE or DISABLE */
sahilmgandhi 18:6a4db94011d3 117 #endif /* USB_OTG_GLPMCFG_LPMEN */
sahilmgandhi 18:6a4db94011d3 118 #ifdef USB_OTG_GCCFG_BCDEN
sahilmgandhi 18:6a4db94011d3 119 uint32_t battery_charging_active; /*!< Enable or disable Battery charging.
sahilmgandhi 18:6a4db94011d3 120 This parameter can be set to ENABLE or DISABLE */
sahilmgandhi 18:6a4db94011d3 121 #endif /* USB_OTG_GCCFG_BCDEN */
sahilmgandhi 18:6a4db94011d3 122 void *pData; /*!< Pointer to upper stack Handler */
sahilmgandhi 18:6a4db94011d3 123 } PCD_HandleTypeDef;
sahilmgandhi 18:6a4db94011d3 124
sahilmgandhi 18:6a4db94011d3 125 /**
sahilmgandhi 18:6a4db94011d3 126 * @}
sahilmgandhi 18:6a4db94011d3 127 */
sahilmgandhi 18:6a4db94011d3 128
sahilmgandhi 18:6a4db94011d3 129 /* Include PCD HAL Extension module */
sahilmgandhi 18:6a4db94011d3 130 #include "stm32f4xx_hal_pcd_ex.h"
sahilmgandhi 18:6a4db94011d3 131
sahilmgandhi 18:6a4db94011d3 132 /* Exported constants --------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 133 /** @defgroup PCD_Exported_Constants PCD Exported Constants
sahilmgandhi 18:6a4db94011d3 134 * @{
sahilmgandhi 18:6a4db94011d3 135 */
sahilmgandhi 18:6a4db94011d3 136
sahilmgandhi 18:6a4db94011d3 137 /** @defgroup PCD_Speed PCD Speed
sahilmgandhi 18:6a4db94011d3 138 * @{
sahilmgandhi 18:6a4db94011d3 139 */
sahilmgandhi 18:6a4db94011d3 140 #define PCD_SPEED_HIGH 0U
sahilmgandhi 18:6a4db94011d3 141 #define PCD_SPEED_HIGH_IN_FULL 1U
sahilmgandhi 18:6a4db94011d3 142 #define PCD_SPEED_FULL 2U
sahilmgandhi 18:6a4db94011d3 143 /**
sahilmgandhi 18:6a4db94011d3 144 * @}
sahilmgandhi 18:6a4db94011d3 145 */
sahilmgandhi 18:6a4db94011d3 146
sahilmgandhi 18:6a4db94011d3 147 /** @defgroup PCD_PHY_Module PCD PHY Module
sahilmgandhi 18:6a4db94011d3 148 * @{
sahilmgandhi 18:6a4db94011d3 149 */
sahilmgandhi 18:6a4db94011d3 150 #define PCD_PHY_ULPI 1U
sahilmgandhi 18:6a4db94011d3 151 #define PCD_PHY_EMBEDDED 2U
sahilmgandhi 18:6a4db94011d3 152 /**
sahilmgandhi 18:6a4db94011d3 153 * @}
sahilmgandhi 18:6a4db94011d3 154 */
sahilmgandhi 18:6a4db94011d3 155
sahilmgandhi 18:6a4db94011d3 156 /** @defgroup PCD_Turnaround_Timeout Turnaround Timeout Value
sahilmgandhi 18:6a4db94011d3 157 * @{
sahilmgandhi 18:6a4db94011d3 158 */
sahilmgandhi 18:6a4db94011d3 159 #ifndef USBD_HS_TRDT_VALUE
sahilmgandhi 18:6a4db94011d3 160 #define USBD_HS_TRDT_VALUE 9U
sahilmgandhi 18:6a4db94011d3 161 #endif /* USBD_HS_TRDT_VALUE */
sahilmgandhi 18:6a4db94011d3 162 #ifndef USBD_FS_TRDT_VALUE
sahilmgandhi 18:6a4db94011d3 163 #define USBD_FS_TRDT_VALUE 5U
sahilmgandhi 18:6a4db94011d3 164 #endif /* USBD_FS_TRDT_VALUE */
sahilmgandhi 18:6a4db94011d3 165 /**
sahilmgandhi 18:6a4db94011d3 166 * @}
sahilmgandhi 18:6a4db94011d3 167 */
sahilmgandhi 18:6a4db94011d3 168
sahilmgandhi 18:6a4db94011d3 169 /**
sahilmgandhi 18:6a4db94011d3 170 * @}
sahilmgandhi 18:6a4db94011d3 171 */
sahilmgandhi 18:6a4db94011d3 172
sahilmgandhi 18:6a4db94011d3 173 /* Exported macros -----------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 174 /** @defgroup PCD_Exported_Macros PCD Exported Macros
sahilmgandhi 18:6a4db94011d3 175 * @brief macros to handle interrupts and specific clock configurations
sahilmgandhi 18:6a4db94011d3 176 * @{
sahilmgandhi 18:6a4db94011d3 177 */
sahilmgandhi 18:6a4db94011d3 178 #define __HAL_PCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance)
sahilmgandhi 18:6a4db94011d3 179 #define __HAL_PCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance)
sahilmgandhi 18:6a4db94011d3 180
sahilmgandhi 18:6a4db94011d3 181 #define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__))
sahilmgandhi 18:6a4db94011d3 182 #define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) &= (__INTERRUPT__))
sahilmgandhi 18:6a4db94011d3 183 #define __HAL_PCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
sahilmgandhi 18:6a4db94011d3 184
sahilmgandhi 18:6a4db94011d3 185 #define __HAL_PCD_UNGATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) &= \
sahilmgandhi 18:6a4db94011d3 186 ~(USB_OTG_PCGCCTL_STOPCLK)
sahilmgandhi 18:6a4db94011d3 187
sahilmgandhi 18:6a4db94011d3 188 #define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK
sahilmgandhi 18:6a4db94011d3 189
sahilmgandhi 18:6a4db94011d3 190 #define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE))&0x10U)
sahilmgandhi 18:6a4db94011d3 191
sahilmgandhi 18:6a4db94011d3 192 #define USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE ((uint32_t)0x08U)
sahilmgandhi 18:6a4db94011d3 193 #define USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE ((uint32_t)0x0CU)
sahilmgandhi 18:6a4db94011d3 194 #define USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE ((uint32_t)0x10U)
sahilmgandhi 18:6a4db94011d3 195
sahilmgandhi 18:6a4db94011d3 196 #define USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE ((uint32_t)0x08U)
sahilmgandhi 18:6a4db94011d3 197 #define USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE ((uint32_t)0x0CU)
sahilmgandhi 18:6a4db94011d3 198 #define USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE ((uint32_t)0x10U)
sahilmgandhi 18:6a4db94011d3 199
sahilmgandhi 18:6a4db94011d3 200 #define USB_OTG_HS_WAKEUP_EXTI_LINE ((uint32_t)0x00100000U) /*!< External interrupt line 20 Connected to the USB HS EXTI Line */
sahilmgandhi 18:6a4db94011d3 201 #define USB_OTG_FS_WAKEUP_EXTI_LINE ((uint32_t)0x00040000U) /*!< External interrupt line 18 Connected to the USB FS EXTI Line */
sahilmgandhi 18:6a4db94011d3 202
sahilmgandhi 18:6a4db94011d3 203 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= (USB_OTG_HS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 204 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 205 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_OTG_HS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 206 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = (USB_OTG_HS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 207
sahilmgandhi 18:6a4db94011d3 208 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_EDGE() do{EXTI->FTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 209 EXTI->RTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE;\
sahilmgandhi 18:6a4db94011d3 210 }while(0)
sahilmgandhi 18:6a4db94011d3 211
sahilmgandhi 18:6a4db94011d3 212 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_FALLING_EDGE() do{EXTI->FTSR |= (USB_OTG_HS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 213 EXTI->RTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 214 }while(0)
sahilmgandhi 18:6a4db94011d3 215
sahilmgandhi 18:6a4db94011d3 216 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE() do{EXTI->RTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 217 EXTI->FTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 218 EXTI->RTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE;\
sahilmgandhi 18:6a4db94011d3 219 EXTI->FTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE;\
sahilmgandhi 18:6a4db94011d3 220 }while(0)
sahilmgandhi 18:6a4db94011d3 221
sahilmgandhi 18:6a4db94011d3 222 #define __HAL_USB_OTG_HS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= USB_OTG_FS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 223
sahilmgandhi 18:6a4db94011d3 224 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= USB_OTG_FS_WAKEUP_EXTI_LINE
sahilmgandhi 18:6a4db94011d3 225 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 226 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_OTG_FS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 227 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = USB_OTG_FS_WAKEUP_EXTI_LINE
sahilmgandhi 18:6a4db94011d3 228
sahilmgandhi 18:6a4db94011d3 229 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE() do{EXTI->FTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 230 EXTI->RTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE;\
sahilmgandhi 18:6a4db94011d3 231 }while(0)
sahilmgandhi 18:6a4db94011d3 232
sahilmgandhi 18:6a4db94011d3 233 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_FALLING_EDGE() do{EXTI->FTSR |= (USB_OTG_FS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 234 EXTI->RTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 235 }while(0)
sahilmgandhi 18:6a4db94011d3 236
sahilmgandhi 18:6a4db94011d3 237 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE() do{EXTI->RTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 238 EXTI->FTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE);\
sahilmgandhi 18:6a4db94011d3 239 EXTI->RTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE;\
sahilmgandhi 18:6a4db94011d3 240 EXTI->FTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE;\
sahilmgandhi 18:6a4db94011d3 241 }while(0)
sahilmgandhi 18:6a4db94011d3 242
sahilmgandhi 18:6a4db94011d3 243 #define __HAL_USB_OTG_FS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= USB_OTG_FS_WAKEUP_EXTI_LINE)
sahilmgandhi 18:6a4db94011d3 244 /**
sahilmgandhi 18:6a4db94011d3 245 * @}
sahilmgandhi 18:6a4db94011d3 246 */
sahilmgandhi 18:6a4db94011d3 247
sahilmgandhi 18:6a4db94011d3 248 /* Exported functions --------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 249 /** @addtogroup PCD_Exported_Functions PCD Exported Functions
sahilmgandhi 18:6a4db94011d3 250 * @{
sahilmgandhi 18:6a4db94011d3 251 */
sahilmgandhi 18:6a4db94011d3 252
sahilmgandhi 18:6a4db94011d3 253 /* Initialization/de-initialization functions ********************************/
sahilmgandhi 18:6a4db94011d3 254 /** @addtogroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions
sahilmgandhi 18:6a4db94011d3 255 * @{
sahilmgandhi 18:6a4db94011d3 256 */
sahilmgandhi 18:6a4db94011d3 257 HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 258 HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 259 void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 260 void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 261 /**
sahilmgandhi 18:6a4db94011d3 262 * @}
sahilmgandhi 18:6a4db94011d3 263 */
sahilmgandhi 18:6a4db94011d3 264
sahilmgandhi 18:6a4db94011d3 265 /* I/O operation functions ***************************************************/
sahilmgandhi 18:6a4db94011d3 266 /* Non-Blocking mode: Interrupt */
sahilmgandhi 18:6a4db94011d3 267 /** @addtogroup PCD_Exported_Functions_Group2 Input and Output operation functions
sahilmgandhi 18:6a4db94011d3 268 * @{
sahilmgandhi 18:6a4db94011d3 269 */
sahilmgandhi 18:6a4db94011d3 270 /* Non-Blocking mode: Interrupt */
sahilmgandhi 18:6a4db94011d3 271 HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 272 HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 273 void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 274
sahilmgandhi 18:6a4db94011d3 275 void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
sahilmgandhi 18:6a4db94011d3 276 void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
sahilmgandhi 18:6a4db94011d3 277 void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 278 void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 279 void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 280 void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 281 void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 282 void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
sahilmgandhi 18:6a4db94011d3 283 void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
sahilmgandhi 18:6a4db94011d3 284 void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 285 void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 286 /**
sahilmgandhi 18:6a4db94011d3 287 * @}
sahilmgandhi 18:6a4db94011d3 288 */
sahilmgandhi 18:6a4db94011d3 289
sahilmgandhi 18:6a4db94011d3 290 /* Peripheral Control functions **********************************************/
sahilmgandhi 18:6a4db94011d3 291 /** @addtogroup PCD_Exported_Functions_Group3 Peripheral Control functions
sahilmgandhi 18:6a4db94011d3 292 * @{
sahilmgandhi 18:6a4db94011d3 293 */
sahilmgandhi 18:6a4db94011d3 294 HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 295 HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 296 HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address);
sahilmgandhi 18:6a4db94011d3 297 HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type);
sahilmgandhi 18:6a4db94011d3 298 HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
sahilmgandhi 18:6a4db94011d3 299 HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len);
sahilmgandhi 18:6a4db94011d3 300 HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len);
sahilmgandhi 18:6a4db94011d3 301 uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
sahilmgandhi 18:6a4db94011d3 302 HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
sahilmgandhi 18:6a4db94011d3 303 HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
sahilmgandhi 18:6a4db94011d3 304 HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
sahilmgandhi 18:6a4db94011d3 305 HAL_StatusTypeDef HAL_PCD_ActivateRemoteWakeup(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 306 HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 307 /**
sahilmgandhi 18:6a4db94011d3 308 * @}
sahilmgandhi 18:6a4db94011d3 309 */
sahilmgandhi 18:6a4db94011d3 310
sahilmgandhi 18:6a4db94011d3 311 /* Peripheral State functions ************************************************/
sahilmgandhi 18:6a4db94011d3 312 /** @addtogroup PCD_Exported_Functions_Group4 Peripheral State functions
sahilmgandhi 18:6a4db94011d3 313 * @{
sahilmgandhi 18:6a4db94011d3 314 */
sahilmgandhi 18:6a4db94011d3 315 PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd);
sahilmgandhi 18:6a4db94011d3 316 /**
sahilmgandhi 18:6a4db94011d3 317 * @}
sahilmgandhi 18:6a4db94011d3 318 */
sahilmgandhi 18:6a4db94011d3 319
sahilmgandhi 18:6a4db94011d3 320 /**
sahilmgandhi 18:6a4db94011d3 321 * @}
sahilmgandhi 18:6a4db94011d3 322 */
sahilmgandhi 18:6a4db94011d3 323
sahilmgandhi 18:6a4db94011d3 324 /* Private macros ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 325 /** @defgroup PCD_Private_Macros PCD Private Macros
sahilmgandhi 18:6a4db94011d3 326 * @{
sahilmgandhi 18:6a4db94011d3 327 */
sahilmgandhi 18:6a4db94011d3 328
sahilmgandhi 18:6a4db94011d3 329 /**
sahilmgandhi 18:6a4db94011d3 330 * @}
sahilmgandhi 18:6a4db94011d3 331 */
sahilmgandhi 18:6a4db94011d3 332
sahilmgandhi 18:6a4db94011d3 333 /**
sahilmgandhi 18:6a4db94011d3 334 * @}
sahilmgandhi 18:6a4db94011d3 335 */
sahilmgandhi 18:6a4db94011d3 336
sahilmgandhi 18:6a4db94011d3 337 /**
sahilmgandhi 18:6a4db94011d3 338 * @}
sahilmgandhi 18:6a4db94011d3 339 */
sahilmgandhi 18:6a4db94011d3 340 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
sahilmgandhi 18:6a4db94011d3 341 STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx ||
sahilmgandhi 18:6a4db94011d3 342 STM32F412Vx || STM32F412Cx */
sahilmgandhi 18:6a4db94011d3 343 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 344 }
sahilmgandhi 18:6a4db94011d3 345 #endif
sahilmgandhi 18:6a4db94011d3 346
sahilmgandhi 18:6a4db94011d3 347
sahilmgandhi 18:6a4db94011d3 348 #endif /* __STM32F4xx_HAL_PCD_H */
sahilmgandhi 18:6a4db94011d3 349
sahilmgandhi 18:6a4db94011d3 350 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/