1 /** 2 ****************************************************************************** 3 * @file stm32f7xx_hal_smartcard_ex.h 4 * @author MCD Application Team 5 * @version V1.0.1 6 * @date 25-June-2015 7 * @brief Header file of SMARTCARD HAL module. 8 ****************************************************************************** 9 * @attention 10 * 11 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> 12 * 13 * Redistribution and use in source and binary forms, with or without modification, 14 * are permitted provided that the following conditions are met: 15 * 1. Redistributions of source code must retain the above copyright notice, 16 * this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright notice, 18 * this list of conditions and the following disclaimer in the documentation 19 * and/or other materials provided with the distribution. 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * 35 ****************************************************************************** 36 */ 37 38 /* Define to prevent recursive inclusion -------------------------------------*/ 39 #ifndef __STM32F7xx_HAL_SMARTCARD_EX_H 40 #define __STM32F7xx_HAL_SMARTCARD_EX_H 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /* Includes ------------------------------------------------------------------*/ 47 #include "stm32f7xx_hal_def.h" 48 49 /** @addtogroup STM32F7xx_HAL_Driver 50 * @{ 51 */ 52 53 /** @addtogroup SMARTCARDEx 54 * @{ 55 */ 56 57 /* Exported types ------------------------------------------------------------*/ 58 /* Exported constants --------------------------------------------------------*/ 59 /* Exported macro ------------------------------------------------------------*/ 60 61 /** @brief Reports the SMARTCARD clock source. 62 * @param __HANDLE__: specifies the USART Handle 63 * @param __CLOCKSOURCE__ : output variable 64 * @retval the USART clocking source, written in __CLOCKSOURCE__. 65 */ 66 #define SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \ 67 do { \ 68 if((__HANDLE__)->Instance == USART1) \ 69 { \ 70 switch(__HAL_RCC_GET_USART1_SOURCE()) \ 71 { \ 72 case RCC_USART1CLKSOURCE_PCLK2: \ 73 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \ 74 break; \ 75 case RCC_USART1CLKSOURCE_HSI: \ 76 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ 77 break; \ 78 case RCC_USART1CLKSOURCE_SYSCLK: \ 79 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \ 80 break; \ 81 case RCC_USART1CLKSOURCE_LSE: \ 82 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ 83 break; \ 84 default: \ 85 break; \ 86 } \ 87 } \ 88 else if((__HANDLE__)->Instance == USART2) \ 89 { \ 90 switch(__HAL_RCC_GET_USART2_SOURCE()) \ 91 { \ 92 case RCC_USART2CLKSOURCE_PCLK1: \ 93 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \ 94 break; \ 95 case RCC_USART2CLKSOURCE_HSI: \ 96 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ 97 break; \ 98 case RCC_USART2CLKSOURCE_SYSCLK: \ 99 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \ 100 break; \ 101 case RCC_USART2CLKSOURCE_LSE: \ 102 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ 103 break; \ 104 default: \ 105 break; \ 106 } \ 107 } \ 108 else if((__HANDLE__)->Instance == USART3) \ 109 { \ 110 switch(__HAL_RCC_GET_USART3_SOURCE()) \ 111 { \ 112 case RCC_USART3CLKSOURCE_PCLK1: \ 113 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \ 114 break; \ 115 case RCC_USART3CLKSOURCE_HSI: \ 116 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ 117 break; \ 118 case RCC_USART3CLKSOURCE_SYSCLK: \ 119 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \ 120 break; \ 121 case RCC_USART3CLKSOURCE_LSE: \ 122 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ 123 break; \ 124 default: \ 125 break; \ 126 } \ 127 } \ 128 else if((__HANDLE__)->Instance == USART6) \ 129 { \ 130 switch(__HAL_RCC_GET_USART6_SOURCE()) \ 131 { \ 132 case RCC_USART6CLKSOURCE_PCLK2: \ 133 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \ 134 break; \ 135 case RCC_USART6CLKSOURCE_HSI: \ 136 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \ 137 break; \ 138 case RCC_USART6CLKSOURCE_SYSCLK: \ 139 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \ 140 break; \ 141 case RCC_USART6CLKSOURCE_LSE: \ 142 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \ 143 break; \ 144 default: \ 145 break; \ 146 } \ 147 } \ 148 } while(0) 149 150 /* Exported functions --------------------------------------------------------*/ 151 /* Initialization and de-initialization functions ****************************/ 152 /* IO operation functions *****************************************************/ 153 /* Peripheral Control functions ***********************************************/ 154 void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsc, uint8_t BlockLength); 155 void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsc, uint32_t TimeOutValue); 156 HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsc); 157 HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsc); 158 159 /* Peripheral State and Error functions ***************************************/ 160 161 /** 162 * @} 163 */ 164 165 /** 166 * @} 167 */ 168 169 #ifdef __cplusplus 170 } 171 #endif 172 173 #endif /* __STM32F7xx_HAL_SMARTCARD_EX_H */ 174 175 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 176