F1 and F3 HAL / LL libraries
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F3xx_HAL_Driver / Inc / stm32f3xx_hal_smartcard_ex.h
blob3402769cc7d855326b13bc88ea475f097781f682
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_hal_smartcard_ex.h
4 * @author MCD Application Team
5 * @brief Header file of SMARTCARD HAL Extended module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ******************************************************************************
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F3xx_HAL_SMARTCARD_EX_H
38 #define __STM32F3xx_HAL_SMARTCARD_EX_H
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /* Includes ------------------------------------------------------------------*/
45 #include "stm32f3xx_hal_def.h"
47 /** @addtogroup STM32F3xx_HAL_Driver
48 * @{
51 /** @addtogroup SMARTCARDEx
52 * @{
55 /* Exported types ------------------------------------------------------------*/
56 /* Exported constants --------------------------------------------------------*/
57 /* Exported macros -----------------------------------------------------------*/
58 /* Private macros ------------------------------------------------------------*/
59 /** @defgroup SMARTCARDEx_Private_Macros SMARTCARD Extended Private Macros
60 * @{
63 /** @brief Report the SMARTCARD clock source.
64 * @param __HANDLE__ specifies the SMARTCARD Handle.
65 * @param __CLOCKSOURCE__ output variable.
66 * @retval the SMARTCARD clocking source, written in __CLOCKSOURCE__.
68 #if defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
69 defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
70 #define SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
71 do { \
72 if((__HANDLE__)->Instance == USART1) \
73 { \
74 switch(__HAL_RCC_GET_USART1_SOURCE()) \
75 { \
76 case RCC_USART1CLKSOURCE_PCLK1: \
77 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
78 break; \
79 case RCC_USART1CLKSOURCE_HSI: \
80 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
81 break; \
82 case RCC_USART1CLKSOURCE_SYSCLK: \
83 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
84 break; \
85 case RCC_USART1CLKSOURCE_LSE: \
86 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
87 break; \
88 default: \
89 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
90 break; \
91 } \
92 } \
93 else if((__HANDLE__)->Instance == USART2) \
94 { \
95 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
96 } \
97 else if((__HANDLE__)->Instance == USART3) \
98 { \
99 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
101 else \
103 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
105 } while(0U)
106 #else
107 #define SMARTCARD_GETCLOCKSOURCE(__HANDLE__,__CLOCKSOURCE__) \
108 do { \
109 if((__HANDLE__)->Instance == USART1) \
111 switch(__HAL_RCC_GET_USART1_SOURCE()) \
113 case RCC_USART1CLKSOURCE_PCLK2: \
114 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \
115 break; \
116 case RCC_USART1CLKSOURCE_HSI: \
117 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
118 break; \
119 case RCC_USART1CLKSOURCE_SYSCLK: \
120 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
121 break; \
122 case RCC_USART1CLKSOURCE_LSE: \
123 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
124 break; \
125 default: \
126 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
127 break; \
130 else if((__HANDLE__)->Instance == USART2) \
132 switch(__HAL_RCC_GET_USART2_SOURCE()) \
134 case RCC_USART2CLKSOURCE_PCLK1: \
135 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
136 break; \
137 case RCC_USART2CLKSOURCE_HSI: \
138 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
139 break; \
140 case RCC_USART2CLKSOURCE_SYSCLK: \
141 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
142 break; \
143 case RCC_USART2CLKSOURCE_LSE: \
144 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
145 break; \
146 default: \
147 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
148 break; \
151 else if((__HANDLE__)->Instance == USART3) \
153 switch(__HAL_RCC_GET_USART3_SOURCE()) \
155 case RCC_USART3CLKSOURCE_PCLK1: \
156 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
157 break; \
158 case RCC_USART3CLKSOURCE_HSI: \
159 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
160 break; \
161 case RCC_USART3CLKSOURCE_SYSCLK: \
162 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
163 break; \
164 case RCC_USART3CLKSOURCE_LSE: \
165 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
166 break; \
167 default: \
168 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
169 break; \
172 else \
174 (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
176 } while(0U)
177 #endif
180 * @}
183 /* Exported functions --------------------------------------------------------*/
184 /** @addtogroup SMARTCARDEx_Exported_Functions
185 * @{
188 /* Initialization and de-initialization functions ****************************/
189 /* IO operation methods *******************************************************/
191 /** @addtogroup SMARTCARDEx_Exported_Functions_Group1
192 * @{
195 /* Peripheral Control functions ***********************************************/
196 void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength);
197 void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue);
198 HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
199 HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard);
202 * @}
206 * @}
210 * @}
214 * @}
217 #ifdef __cplusplus
219 #endif
221 #endif /* __STM32F3xx_HAL_SMARTCARD_EX_H */
223 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/