提交 | 用户 | age
|
483170
|
1 |
/** |
Q |
2 |
****************************************************************************** |
|
3 |
* @file stm32f0xx_hal_smartcard.h |
|
4 |
* @author MCD Application Team |
|
5 |
* @brief Header file of SMARTCARD HAL module. |
|
6 |
****************************************************************************** |
|
7 |
* @attention |
|
8 |
* |
|
9 |
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
|
10 |
* |
|
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. |
|
21 |
* |
|
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. |
|
32 |
* |
|
33 |
****************************************************************************** |
|
34 |
*/ |
|
35 |
|
|
36 |
/* Define to prevent recursive inclusion -------------------------------------*/ |
|
37 |
#ifndef __STM32F0xx_HAL_SMARTCARD_H |
|
38 |
#define __STM32F0xx_HAL_SMARTCARD_H |
|
39 |
|
|
40 |
#ifdef __cplusplus |
|
41 |
extern "C" { |
|
42 |
#endif |
|
43 |
|
|
44 |
#if !defined(STM32F030x6) && !defined(STM32F030x8) && !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) |
|
45 |
|
|
46 |
/* Includes ------------------------------------------------------------------*/ |
|
47 |
#include "stm32f0xx_hal_def.h" |
|
48 |
|
|
49 |
/** @addtogroup STM32F0xx_HAL_Driver |
|
50 |
* @{ |
|
51 |
*/ |
|
52 |
|
|
53 |
/** @addtogroup SMARTCARD |
|
54 |
* @{ |
|
55 |
*/ |
|
56 |
|
|
57 |
/* Exported types ------------------------------------------------------------*/ |
|
58 |
/** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types |
|
59 |
* @{ |
|
60 |
*/ |
|
61 |
|
|
62 |
/** |
|
63 |
* @brief SMARTCARD Init Structure definition |
|
64 |
*/ |
|
65 |
typedef struct |
|
66 |
{ |
|
67 |
uint32_t BaudRate; /*!< Configures the SmartCard communication baud rate. |
|
68 |
The baud rate register is computed using the following formula: |
|
69 |
Baud Rate Register = ((PCLKx) / ((hsmartcard->Init.BaudRate))) */ |
|
70 |
|
|
71 |
uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. |
|
72 |
This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */ |
|
73 |
|
|
74 |
uint32_t StopBits; /*!< Specifies the number of stop bits. |
|
75 |
This parameter can be a value of @ref SMARTCARD_Stop_Bits. */ |
|
76 |
|
|
77 |
uint16_t Parity; /*!< Specifies the parity mode. |
|
78 |
This parameter can be a value of @ref SMARTCARD_Parity |
|
79 |
@note The parity is enabled by default (PCE is forced to 1). |
|
80 |
Since the WordLength is forced to 8 bits + parity, M is |
|
81 |
forced to 1 and the parity bit is the 9th bit. */ |
|
82 |
|
|
83 |
uint16_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. |
|
84 |
This parameter can be a value of @ref SMARTCARD_Mode */ |
|
85 |
|
|
86 |
uint16_t CLKPolarity; /*!< Specifies the steady state of the serial clock. |
|
87 |
This parameter can be a value of @ref SMARTCARD_Clock_Polarity */ |
|
88 |
|
|
89 |
uint16_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made. |
|
90 |
This parameter can be a value of @ref SMARTCARD_Clock_Phase */ |
|
91 |
|
|
92 |
uint16_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted |
|
93 |
data bit (MSB) has to be output on the SCLK pin in synchronous mode. |
|
94 |
This parameter can be a value of @ref SMARTCARD_Last_Bit */ |
|
95 |
|
|
96 |
uint16_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected. |
|
97 |
Selecting the single sample method increases the receiver tolerance to clock |
|
98 |
deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling. */ |
|
99 |
|
|
100 |
uint8_t Prescaler; /*!< Specifies the SmartCard Prescaler. */ |
|
101 |
|
|
102 |
uint8_t GuardTime; /*!< Specifies the SmartCard Guard Time applied after stop bits. */ |
|
103 |
|
|
104 |
uint16_t NACKEnable; /*!< Specifies whether the SmartCard NACK transmission is enabled |
|
105 |
in case of parity error. |
|
106 |
This parameter can be a value of @ref SMARTCARD_NACK_Enable */ |
|
107 |
|
|
108 |
uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled. |
|
109 |
This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/ |
|
110 |
|
|
111 |
uint32_t TimeOutValue; /*!< Specifies the receiver time out value in number of baud blocks: |
|
112 |
it is used to implement the Character Wait Time (CWT) and |
|
113 |
Block Wait Time (BWT). It is coded over 24 bits. */ |
|
114 |
|
|
115 |
uint8_t BlockLength; /*!< Specifies the SmartCard Block Length in T=1 Reception mode. |
|
116 |
This parameter can be any value from 0x0 to 0xFF */ |
|
117 |
|
|
118 |
uint8_t AutoRetryCount; /*!< Specifies the SmartCard auto-retry count (number of retries in |
|
119 |
receive and transmit mode). When set to 0, retransmission is |
|
120 |
disabled. Otherwise, its maximum value is 7 (before signalling |
|
121 |
an error) */ |
|
122 |
|
|
123 |
}SMARTCARD_InitTypeDef; |
|
124 |
|
|
125 |
/** |
|
126 |
* @brief SMARTCARD advanced features initalization structure definition |
|
127 |
*/ |
|
128 |
typedef struct |
|
129 |
{ |
|
130 |
uint32_t AdvFeatureInit; /*!< Specifies which advanced SMARTCARD features is initialized. Several |
|
131 |
advanced features may be initialized at the same time. This parameter |
|
132 |
can be a value of @ref SMARTCARD_Advanced_Features_Initialization_Type */ |
|
133 |
|
|
134 |
uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted. |
|
135 |
This parameter can be a value of @ref SMARTCARD_Tx_Inv */ |
|
136 |
|
|
137 |
uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted. |
|
138 |
This parameter can be a value of @ref SMARTCARD_Rx_Inv */ |
|
139 |
|
|
140 |
uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic |
|
141 |
vs negative/inverted logic). |
|
142 |
This parameter can be a value of @ref SMARTCARD_Data_Inv */ |
|
143 |
|
|
144 |
uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped. |
|
145 |
This parameter can be a value of @ref SMARTCARD_Rx_Tx_Swap */ |
|
146 |
|
|
147 |
uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled. |
|
148 |
This parameter can be a value of @ref SMARTCARD_Overrun_Disable */ |
|
149 |
|
|
150 |
uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error. |
|
151 |
This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */ |
|
152 |
|
|
153 |
uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line. |
|
154 |
This parameter can be a value of @ref SMARTCARD_MSB_First */ |
|
155 |
}SMARTCARD_AdvFeatureInitTypeDef; |
|
156 |
|
|
157 |
/** |
|
158 |
* @brief HAL SMARTCARD State structures definition |
|
159 |
* @note HAL SMARTCARD State value is a combination of 2 different substates: gState and RxState. |
|
160 |
* - gState contains SMARTCARD state information related to global Handle management |
|
161 |
* and also information related to Tx operations. |
|
162 |
* gState value coding follow below described bitmap : |
|
163 |
* b7-b6 Error information |
|
164 |
* 00 : No Error |
|
165 |
* 01 : (Not Used) |
|
166 |
* 10 : Timeout |
|
167 |
* 11 : Error |
|
168 |
* b5 IP initilisation status |
|
169 |
* 0 : Reset (IP not initialized) |
|
170 |
* 1 : Init done (IP not initialized. HAL SMARTCARD Init function already called) |
|
171 |
* b4-b3 (not used) |
|
172 |
* xx : Should be set to 00 |
|
173 |
* b2 Intrinsic process state |
|
174 |
* 0 : Ready |
|
175 |
* 1 : Busy (IP busy with some configuration or internal operations) |
|
176 |
* b1 (not used) |
|
177 |
* x : Should be set to 0 |
|
178 |
* b0 Tx state |
|
179 |
* 0 : Ready (no Tx operation ongoing) |
|
180 |
* 1 : Busy (Tx operation ongoing) |
|
181 |
* - RxState contains information related to Rx operations. |
|
182 |
* RxState value coding follow below described bitmap : |
|
183 |
* b7-b6 (not used) |
|
184 |
* xx : Should be set to 00 |
|
185 |
* b5 IP initilisation status |
|
186 |
* 0 : Reset (IP not initialized) |
|
187 |
* 1 : Init done (IP not initialized) |
|
188 |
* b4-b2 (not used) |
|
189 |
* xxx : Should be set to 000 |
|
190 |
* b1 Rx state |
|
191 |
* 0 : Ready (no Rx operation ongoing) |
|
192 |
* 1 : Busy (Rx operation ongoing) |
|
193 |
* b0 (not used) |
|
194 |
* x : Should be set to 0. |
|
195 |
*/ |
|
196 |
typedef enum |
|
197 |
{ |
|
198 |
HAL_SMARTCARD_STATE_RESET = 0x00U, /*!< Peripheral is not initialized |
|
199 |
Value is allowed for gState and RxState */ |
|
200 |
HAL_SMARTCARD_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use |
|
201 |
Value is allowed for gState and RxState */ |
|
202 |
HAL_SMARTCARD_STATE_BUSY = 0x24U, /*!< an internal process is ongoing |
|
203 |
Value is allowed for gState only */ |
|
204 |
HAL_SMARTCARD_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing |
|
205 |
Value is allowed for gState only */ |
|
206 |
HAL_SMARTCARD_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing |
|
207 |
Value is allowed for RxState only */ |
|
208 |
HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x23U, /*!< Data Transmission and Reception process is ongoing |
|
209 |
Not to be used for neither gState nor RxState. |
|
210 |
Value is result of combination (Or) between gState and RxState values */ |
|
211 |
HAL_SMARTCARD_STATE_TIMEOUT = 0xA0U, /*!< Timeout state |
|
212 |
Value is allowed for gState only */ |
|
213 |
HAL_SMARTCARD_STATE_ERROR = 0xE0U /*!< Error |
|
214 |
Value is allowed for gState only */ |
|
215 |
}HAL_SMARTCARD_StateTypeDef; |
|
216 |
|
|
217 |
/** |
|
218 |
* @brief SMARTCARD clock sources |
|
219 |
*/ |
|
220 |
typedef enum |
|
221 |
{ |
|
222 |
SMARTCARD_CLOCKSOURCE_PCLK1 = 0x00U, /*!< PCLK1 clock source */ |
|
223 |
SMARTCARD_CLOCKSOURCE_HSI = 0x02U, /*!< HSI clock source */ |
|
224 |
SMARTCARD_CLOCKSOURCE_SYSCLK = 0x04U, /*!< SYSCLK clock source */ |
|
225 |
SMARTCARD_CLOCKSOURCE_LSE = 0x08U, /*!< LSE clock source */ |
|
226 |
SMARTCARD_CLOCKSOURCE_UNDEFINED = 0x10U /*!< undefined clock source */ |
|
227 |
}SMARTCARD_ClockSourceTypeDef; |
|
228 |
|
|
229 |
/** |
|
230 |
* @brief SMARTCARD handle Structure definition |
|
231 |
*/ |
|
232 |
typedef struct |
|
233 |
{ |
|
234 |
USART_TypeDef *Instance; /*!< USART registers base address */ |
|
235 |
|
|
236 |
SMARTCARD_InitTypeDef Init; /*!< SmartCard communication parameters */ |
|
237 |
|
|
238 |
SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /*!< SmartCard advanced features initialization parameters */ |
|
239 |
|
|
240 |
uint8_t *pTxBuffPtr; /*!< Pointer to SmartCard Tx transfer Buffer */ |
|
241 |
|
|
242 |
uint16_t TxXferSize; /*!< SmartCard Tx Transfer size */ |
|
243 |
|
|
244 |
__IO uint16_t TxXferCount; /*!< SmartCard Tx Transfer Counter */ |
|
245 |
|
|
246 |
uint8_t *pRxBuffPtr; /*!< Pointer to SmartCard Rx transfer Buffer */ |
|
247 |
|
|
248 |
uint16_t RxXferSize; /*!< SmartCard Rx Transfer size */ |
|
249 |
|
|
250 |
__IO uint16_t RxXferCount; /*!< SmartCard Rx Transfer Counter */ |
|
251 |
|
|
252 |
DMA_HandleTypeDef *hdmatx; /*!< SmartCard Tx DMA Handle parameters */ |
|
253 |
|
|
254 |
DMA_HandleTypeDef *hdmarx; /*!< SmartCard Rx DMA Handle parameters */ |
|
255 |
|
|
256 |
HAL_LockTypeDef Lock; /*!< Locking object */ |
|
257 |
|
|
258 |
__IO HAL_SMARTCARD_StateTypeDef gState; /*!< SmartCard state information related to global Handle management |
|
259 |
and also related to Tx operations. |
|
260 |
This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */ |
|
261 |
|
|
262 |
__IO HAL_SMARTCARD_StateTypeDef RxState; /*!< SmartCard state information related to Rx operations. |
|
263 |
This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */ |
|
264 |
|
|
265 |
__IO uint32_t ErrorCode; /*!< SmartCard Error code |
|
266 |
This parameter can be a value of @ref SMARTCARD_Error */ |
|
267 |
|
|
268 |
}SMARTCARD_HandleTypeDef; |
|
269 |
|
|
270 |
/** |
|
271 |
* @} |
|
272 |
*/ |
|
273 |
|
|
274 |
/* Exported constants --------------------------------------------------------*/ |
|
275 |
/** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported Constants |
|
276 |
* @{ |
|
277 |
*/ |
|
278 |
|
|
279 |
/** @defgroup SMARTCARD_Error SMARTCARD Error |
|
280 |
* @{ |
|
281 |
*/ |
|
282 |
#define HAL_SMARTCARD_ERROR_NONE (0x00000000U) /*!< No error */ |
|
283 |
#define HAL_SMARTCARD_ERROR_PE (0x00000001U) /*!< Parity error */ |
|
284 |
#define HAL_SMARTCARD_ERROR_NE (0x00000002U) /*!< Noise error */ |
|
285 |
#define HAL_SMARTCARD_ERROR_FE (0x00000004U) /*!< frame error */ |
|
286 |
#define HAL_SMARTCARD_ERROR_ORE (0x00000008U) /*!< Overrun error */ |
|
287 |
#define HAL_SMARTCARD_ERROR_DMA (0x00000010U) /*!< DMA transfer error */ |
|
288 |
#define HAL_SMARTCARD_ERROR_RTO (0x00000020U) /*!< Receiver TimeOut error */ |
|
289 |
/** |
|
290 |
* @} |
|
291 |
*/ |
|
292 |
|
|
293 |
/** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length |
|
294 |
* @{ |
|
295 |
*/ |
|
296 |
#if defined (USART_CR1_M0) |
|
297 |
#define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M0) /*!< SMARTCARD frame length */ |
|
298 |
#else |
|
299 |
#define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M) /*!< SMARTCARD frame length */ |
|
300 |
#endif |
|
301 |
/** |
|
302 |
* @} |
|
303 |
*/ |
|
304 |
|
|
305 |
/** @defgroup SMARTCARD_Stop_Bits SMARTCARD Number of Stop Bits |
|
306 |
* @{ |
|
307 |
*/ |
|
308 |
#define SMARTCARD_STOPBITS_0_5 ((uint32_t)USART_CR2_STOP_0) /*!< SMARTCARD frame with 0.5 stop bit */ |
|
309 |
#define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP_0 | USART_CR2_STOP_1)) /*!< SMARTCARD frame with 1.5 stop bits */ |
|
310 |
/** |
|
311 |
* @} |
|
312 |
*/ |
|
313 |
|
|
314 |
/** @defgroup SMARTCARD_Parity SMARTCARD Parity |
|
315 |
* @{ |
|
316 |
*/ |
|
317 |
#define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE) /*!< SMARTCARD frame even parity */ |
|
318 |
#define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS)) /*!< SMARTCARD frame odd parity */ |
|
319 |
/** |
|
320 |
* @} |
|
321 |
*/ |
|
322 |
|
|
323 |
/** @defgroup SMARTCARD_Mode SMARTCARD Transfer Mode |
|
324 |
* @{ |
|
325 |
*/ |
|
326 |
#define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE) /*!< SMARTCARD RX mode */ |
|
327 |
#define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE) /*!< SMARTCARD TX mode */ |
|
328 |
#define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE)) /*!< SMARTCARD RX and TX mode */ |
|
329 |
/** |
|
330 |
* @} |
|
331 |
*/ |
|
332 |
|
|
333 |
/** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity |
|
334 |
* @{ |
|
335 |
*/ |
|
336 |
#define SMARTCARD_POLARITY_LOW (0x00000000U) /*!< SMARTCARD frame low polarity */ |
|
337 |
#define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL) /*!< SMARTCARD frame high polarity */ |
|
338 |
/** |
|
339 |
* @} |
|
340 |
*/ |
|
341 |
|
|
342 |
/** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase |
|
343 |
* @{ |
|
344 |
*/ |
|
345 |
#define SMARTCARD_PHASE_1EDGE (0x00000000U) /*!< SMARTCARD frame phase on first clock transition */ |
|
346 |
#define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA) /*!< SMARTCARD frame phase on second clock transition */ |
|
347 |
/** |
|
348 |
* @} |
|
349 |
*/ |
|
350 |
|
|
351 |
/** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit |
|
352 |
* @{ |
|
353 |
*/ |
|
354 |
#define SMARTCARD_LASTBIT_DISABLE (0x00000000U) /*!< SMARTCARD frame last data bit clock pulse not output to SCLK pin */ |
|
355 |
#define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL) /*!< SMARTCARD frame last data bit clock pulse output to SCLK pin */ |
|
356 |
/** |
|
357 |
* @} |
|
358 |
*/ |
|
359 |
|
|
360 |
/** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD One Bit Sampling Method |
|
361 |
* @{ |
|
362 |
*/ |
|
363 |
#define SMARTCARD_ONE_BIT_SAMPLE_DISABLE (0x00000000U) /*!< SMARTCARD frame one-bit sample disabled */ |
|
364 |
#define SMARTCARD_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT) /*!< SMARTCARD frame one-bit sample enabled */ |
|
365 |
/** |
|
366 |
* @} |
|
367 |
*/ |
|
368 |
|
|
369 |
|
|
370 |
/** @defgroup SMARTCARD_NACK_Enable SMARTCARD NACK Enable |
|
371 |
* @{ |
|
372 |
*/ |
|
373 |
#define SMARTCARD_NACK_ENABLE ((uint32_t)USART_CR3_NACK) /*!< SMARTCARD NACK transmission disabled */ |
|
374 |
#define SMARTCARD_NACK_DISABLE (0x00000000U) /*!< SMARTCARD NACK transmission enabled */ |
|
375 |
/** |
|
376 |
* @} |
|
377 |
*/ |
|
378 |
|
|
379 |
/** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable |
|
380 |
* @{ |
|
381 |
*/ |
|
382 |
#define SMARTCARD_TIMEOUT_DISABLE (0x00000000U) /*!< SMARTCARD receiver timeout disabled */ |
|
383 |
#define SMARTCARD_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN) /*!< SMARTCARD receiver timeout enabled */ |
|
384 |
/** |
|
385 |
* @} |
|
386 |
*/ |
|
387 |
|
|
388 |
/** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD advanced feature initialization type |
|
389 |
* @{ |
|
390 |
*/ |
|
391 |
#define SMARTCARD_ADVFEATURE_NO_INIT (0x00000000U) /*!< No advanced feature initialization */ |
|
392 |
#define SMARTCARD_ADVFEATURE_TXINVERT_INIT (0x00000001U) /*!< TX pin active level inversion */ |
|
393 |
#define SMARTCARD_ADVFEATURE_RXINVERT_INIT (0x00000002U) /*!< RX pin active level inversion */ |
|
394 |
#define SMARTCARD_ADVFEATURE_DATAINVERT_INIT (0x00000004U) /*!< Binary data inversion */ |
|
395 |
#define SMARTCARD_ADVFEATURE_SWAP_INIT (0x00000008U) /*!< TX/RX pins swap */ |
|
396 |
#define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT (0x00000010U) /*!< RX overrun disable */ |
|
397 |
#define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT (0x00000020U) /*!< DMA disable on Reception Error */ |
|
398 |
#define SMARTCARD_ADVFEATURE_MSBFIRST_INIT (0x00000080U) /*!< Most significant bit sent/received first */ |
|
399 |
/** |
|
400 |
* @} |
|
401 |
*/ |
|
402 |
|
|
403 |
/** @defgroup SMARTCARD_Tx_Inv SMARTCARD advanced feature TX pin active level inversion |
|
404 |
* @{ |
|
405 |
*/ |
|
406 |
#define SMARTCARD_ADVFEATURE_TXINV_DISABLE (0x00000000U) /*!< TX pin active level inversion disable */ |
|
407 |
#define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV) /*!< TX pin active level inversion enable */ |
|
408 |
/** |
|
409 |
* @} |
|
410 |
*/ |
|
411 |
|
|
412 |
/** @defgroup SMARTCARD_Rx_Inv SMARTCARD advanced feature RX pin active level inversion |
|
413 |
* @{ |
|
414 |
*/ |
|
415 |
#define SMARTCARD_ADVFEATURE_RXINV_DISABLE (0x00000000U) /*!< RX pin active level inversion disable */ |
|
416 |
#define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV) /*!< RX pin active level inversion enable */ |
|
417 |
/** |
|
418 |
* @} |
|
419 |
*/ |
|
420 |
|
|
421 |
/** @defgroup SMARTCARD_Data_Inv SMARTCARD advanced feature Binary Data inversion |
|
422 |
* @{ |
|
423 |
*/ |
|
424 |
#define SMARTCARD_ADVFEATURE_DATAINV_DISABLE (0x00000000U) /*!< Binary data inversion disable */ |
|
425 |
#define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV) /*!< Binary data inversion enable */ |
|
426 |
/** |
|
427 |
* @} |
|
428 |
*/ |
|
429 |
|
|
430 |
/** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD advanced feature RX TX pins swap |
|
431 |
* @{ |
|
432 |
*/ |
|
433 |
#define SMARTCARD_ADVFEATURE_SWAP_DISABLE (0x00000000U) /*!< TX/RX pins swap disable */ |
|
434 |
#define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP) /*!< TX/RX pins swap enable */ |
|
435 |
/** |
|
436 |
* @} |
|
437 |
*/ |
|
438 |
|
|
439 |
/** @defgroup SMARTCARD_Overrun_Disable SMARTCARD advanced feature Overrun Disable |
|
440 |
* @{ |
|
441 |
*/ |
|
442 |
#define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE (0x00000000U) /*!< RX overrun enable */ |
|
443 |
#define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS) /*!< RX overrun disable */ |
|
444 |
/** |
|
445 |
* @} |
|
446 |
*/ |
|
447 |
|
|
448 |
/** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD advanced feature DMA Disable on Rx Error |
|
449 |
* @{ |
|
450 |
*/ |
|
451 |
#define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR (0x00000000U) /*!< DMA enable on Reception Error */ |
|
452 |
#define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE) /*!< DMA disable on Reception Error */ |
|
453 |
/** |
|
454 |
* @} |
|
455 |
*/ |
|
456 |
|
|
457 |
/** @defgroup SMARTCARD_MSB_First SMARTCARD advanced feature MSB first |
|
458 |
* @{ |
|
459 |
*/ |
|
460 |
#define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE (0x00000000U) /*!< Most significant bit sent/received first disable */ |
|
461 |
#define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST) /*!< Most significant bit sent/received first enable */ |
|
462 |
/** |
|
463 |
* @} |
|
464 |
*/ |
|
465 |
|
|
466 |
/** @defgroup SMARTCARD_Flags SMARTCARD Flags |
|
467 |
* Elements values convention: 0xXXXX |
|
468 |
* - 0xXXXX : Flag mask in the ISR register |
|
469 |
* @{ |
|
470 |
*/ |
|
471 |
#define SMARTCARD_FLAG_REACK USART_ISR_REACK /*!< SMARTCARD receive enable acknowledge flag */ |
|
472 |
#define SMARTCARD_FLAG_TEACK USART_ISR_TEACK /*!< SMARTCARD transmit enable acknowledge flag */ |
|
473 |
#define SMARTCARD_FLAG_BUSY USART_ISR_BUSY /*!< SMARTCARD busy flag */ |
|
474 |
#define SMARTCARD_FLAG_EOBF USART_ISR_EOBF /*!< SMARTCARD end of block flag */ |
|
475 |
#define SMARTCARD_FLAG_RTOF USART_ISR_RTOF /*!< SMARTCARD receiver timeout flag */ |
|
476 |
#define SMARTCARD_FLAG_TXE USART_ISR_TXE /*!< SMARTCARD transmit data register empty */ |
|
477 |
#define SMARTCARD_FLAG_TC USART_ISR_TC /*!< SMARTCARD transmission complete */ |
|
478 |
#define SMARTCARD_FLAG_RXNE USART_ISR_RXNE /*!< SMARTCARD read data register not empty */ |
|
479 |
#define SMARTCARD_FLAG_IDLE USART_ISR_IDLE /*!< SMARTCARD idle line detection */ |
|
480 |
#define SMARTCARD_FLAG_ORE USART_ISR_ORE /*!< SMARTCARD overrun error */ |
|
481 |
#define SMARTCARD_FLAG_NE USART_ISR_NE /*!< SMARTCARD noise error */ |
|
482 |
#define SMARTCARD_FLAG_FE USART_ISR_FE /*!< SMARTCARD frame error */ |
|
483 |
#define SMARTCARD_FLAG_PE USART_ISR_PE /*!< SMARTCARD parity error */ |
|
484 |
/** |
|
485 |
* @} |
|
486 |
*/ |
|
487 |
|
|
488 |
/** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupts Definition |
|
489 |
* Elements values convention: 0000ZZZZ0XXYYYYYb |
|
490 |
* - YYYYY : Interrupt source position in the XX register (5bits) |
|
491 |
* - XX : Interrupt source register (2bits) |
|
492 |
* - 01: CR1 register |
|
493 |
* - 10: CR2 register |
|
494 |
* - 11: CR3 register |
|
495 |
* - ZZZZ : Flag position in the ISR register(4bits) |
|
496 |
* @{ |
|
497 |
*/ |
|
498 |
|
|
499 |
#define SMARTCARD_IT_PE ((uint16_t)0x0028U) /*!< SMARTCARD parity error interruption */ |
|
500 |
#define SMARTCARD_IT_TXE ((uint16_t)0x0727U) /*!< SMARTCARD transmit data register empty interruption */ |
|
501 |
#define SMARTCARD_IT_TC ((uint16_t)0x0626U) /*!< SMARTCARD transmission complete interruption */ |
|
502 |
#define SMARTCARD_IT_RXNE ((uint16_t)0x0525U) /*!< SMARTCARD read data register not empty interruption */ |
|
503 |
#define SMARTCARD_IT_IDLE ((uint16_t)0x0424U) /*!< SMARTCARD idle line detection interruption */ |
|
504 |
|
|
505 |
#define SMARTCARD_IT_ERR ((uint16_t)0x0060U) /*!< SMARTCARD error interruption */ |
|
506 |
#define SMARTCARD_IT_ORE ((uint16_t)0x0300U) /*!< SMARTCARD overrun error interruption */ |
|
507 |
#define SMARTCARD_IT_NE ((uint16_t)0x0200U) /*!< SMARTCARD noise error interruption */ |
|
508 |
#define SMARTCARD_IT_FE ((uint16_t)0x0100U) /*!< SMARTCARD frame error interruption */ |
|
509 |
|
|
510 |
#define SMARTCARD_IT_EOB ((uint16_t)0x0C3BU) /*!< SMARTCARD end of block interruption */ |
|
511 |
#define SMARTCARD_IT_RTO ((uint16_t)0x0B3AU) /*!< SMARTCARD receiver timeout interruption */ |
|
512 |
/** |
|
513 |
* @} |
|
514 |
*/ |
|
515 |
|
|
516 |
/** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD Interruption Clear Flags |
|
517 |
* @{ |
|
518 |
*/ |
|
519 |
#define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< SMARTCARD parity error clear flag */ |
|
520 |
#define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< SMARTCARD framing error clear flag */ |
|
521 |
#define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< SMARTCARD noise detected clear flag */ |
|
522 |
#define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< SMARTCARD overrun error clear flag */ |
|
523 |
#define SMARTCARD_CLEAR_IDLEF USART_ICR_IDLECF /*!< SMARTCARD idle line detected clear flag */ |
|
524 |
#define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< SMARTCARD transmission complete clear flag */ |
|
525 |
#define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< SMARTCARD receiver time out clear flag */ |
|
526 |
#define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< SMARTCARD end of block clear flag */ |
|
527 |
/** |
|
528 |
* @} |
|
529 |
*/ |
|
530 |
|
|
531 |
/** @defgroup SMARTCARD_CR3_SCARCNT_LSB_POS SMARTCARD auto retry counter LSB position in CR3 register |
|
532 |
* @{ |
|
533 |
*/ |
|
534 |
#define SMARTCARD_CR3_SCARCNT_LSB_POS ( 17U) /*!< SMARTCARD auto retry counter LSB position in CR3 register */ |
|
535 |
/** |
|
536 |
* @} |
|
537 |
*/ |
|
538 |
|
|
539 |
/** @defgroup SMARTCARD_GTPR_GT_LSB_POS SMARTCARD guard time value LSB position in GTPR register |
|
540 |
* @{ |
|
541 |
*/ |
|
542 |
#define SMARTCARD_GTPR_GT_LSB_POS ( 8U) /*!< SMARTCARD guard time value LSB position in GTPR register */ |
|
543 |
/** |
|
544 |
* @} |
|
545 |
*/ |
|
546 |
|
|
547 |
/** @defgroup SMARTCARD_RTOR_BLEN_LSB_POS SMARTCARD block length LSB position in RTOR register |
|
548 |
* @{ |
|
549 |
*/ |
|
550 |
#define SMARTCARD_RTOR_BLEN_LSB_POS ( 24U) /*!< SMARTCARD block length LSB position in RTOR register */ |
|
551 |
/** |
|
552 |
* @} |
|
553 |
*/ |
|
554 |
|
|
555 |
/** @defgroup SMARTCARD_Interruption_Mask SMARTCARD interruptions flags mask |
|
556 |
* @{ |
|
557 |
*/ |
|
558 |
#define SMARTCARD_IT_MASK ((uint16_t)0x001FU) /*!< SMARTCARD interruptions flags mask */ |
|
559 |
/** |
|
560 |
* @} |
|
561 |
*/ |
|
562 |
|
|
563 |
/** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters |
|
564 |
* @{ |
|
565 |
*/ |
|
566 |
#define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_RXFRQ) /*!< Receive data flush request */ |
|
567 |
#define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint16_t)USART_RQR_TXFRQ) /*!< Transmit data flush request */ |
|
568 |
/** |
|
569 |
* @} |
|
570 |
*/ |
|
571 |
|
|
572 |
/** |
|
573 |
* @} |
|
574 |
*/ |
|
575 |
|
|
576 |
/* Exported macros -----------------------------------------------------------*/ |
|
577 |
/** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros |
|
578 |
* @{ |
|
579 |
*/ |
|
580 |
|
|
581 |
/** @brief Reset SMARTCARD handle states. |
|
582 |
* @param __HANDLE__ SMARTCARD handle. |
|
583 |
* @retval None |
|
584 |
*/ |
|
585 |
#define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
|
586 |
(__HANDLE__)->gState = HAL_SMARTCARD_STATE_RESET; \ |
|
587 |
(__HANDLE__)->RxState = HAL_SMARTCARD_STATE_RESET; \ |
|
588 |
} while(0U) |
|
589 |
|
|
590 |
/** @brief Flush the Smartcard Data registers. |
|
591 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
592 |
* @retval None |
|
593 |
*/ |
|
594 |
#define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) \ |
|
595 |
do{ \ |
|
596 |
SET_BIT((__HANDLE__)->Instance->RQR, SMARTCARD_RXDATA_FLUSH_REQUEST); \ |
|
597 |
SET_BIT((__HANDLE__)->Instance->RQR, SMARTCARD_TXDATA_FLUSH_REQUEST); \ |
|
598 |
} while(0U) |
|
599 |
|
|
600 |
/** @brief Clear the specified SMARTCARD pending flag. |
|
601 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
602 |
* @param __FLAG__ specifies the flag to check. |
|
603 |
* This parameter can be any combination of the following values: |
|
604 |
* @arg @ref SMARTCARD_CLEAR_PEF Parity error clear flag |
|
605 |
* @arg @ref SMARTCARD_CLEAR_FEF Framing error clear flag |
|
606 |
* @arg @ref SMARTCARD_CLEAR_NEF Noise detected clear flag |
|
607 |
* @arg @ref SMARTCARD_CLEAR_OREF OverRun error clear flag |
|
608 |
* @arg @ref SMARTCARD_CLEAR_IDLEF Idle line detected clear flag |
|
609 |
* @arg @ref SMARTCARD_CLEAR_TCF Transmission complete clear flag |
|
610 |
* @arg @ref SMARTCARD_CLEAR_RTOF Receiver timeout clear flag |
|
611 |
* @arg @ref SMARTCARD_CLEAR_EOBF End of block clear flag |
|
612 |
* @retval None |
|
613 |
*/ |
|
614 |
#define __HAL_SMARTCARD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
|
615 |
|
|
616 |
/** @brief Clear the SMARTCARD PE pending flag. |
|
617 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
618 |
* @retval None |
|
619 |
*/ |
|
620 |
#define __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_PEF) |
|
621 |
|
|
622 |
|
|
623 |
/** @brief Clear the SMARTCARD FE pending flag. |
|
624 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
625 |
* @retval None |
|
626 |
*/ |
|
627 |
#define __HAL_SMARTCARD_CLEAR_FEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_FEF) |
|
628 |
|
|
629 |
/** @brief Clear the SMARTCARD NE pending flag. |
|
630 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
631 |
* @retval None |
|
632 |
*/ |
|
633 |
#define __HAL_SMARTCARD_CLEAR_NEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_NEF) |
|
634 |
|
|
635 |
/** @brief Clear the SMARTCARD ORE pending flag. |
|
636 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
637 |
* @retval None |
|
638 |
*/ |
|
639 |
#define __HAL_SMARTCARD_CLEAR_OREFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_OREF) |
|
640 |
|
|
641 |
/** @brief Clear the SMARTCARD IDLE pending flag. |
|
642 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
643 |
* @retval None |
|
644 |
*/ |
|
645 |
#define __HAL_SMARTCARD_CLEAR_IDLEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_IDLEF) |
|
646 |
|
|
647 |
/** @brief Check whether the specified Smartcard flag is set or not. |
|
648 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
649 |
* @param __FLAG__ specifies the flag to check. |
|
650 |
* This parameter can be one of the following values: |
|
651 |
* @arg @ref SMARTCARD_FLAG_REACK Receive enable acknowledge flag |
|
652 |
* @arg @ref SMARTCARD_FLAG_TEACK Transmit enable acknowledge flag |
|
653 |
* @arg @ref SMARTCARD_FLAG_BUSY Busy flag |
|
654 |
* @arg @ref SMARTCARD_FLAG_EOBF End of block flag |
|
655 |
* @arg @ref SMARTCARD_FLAG_RTOF Receiver timeout flag |
|
656 |
* @arg @ref SMARTCARD_FLAG_TXE Transmit data register empty flag |
|
657 |
* @arg @ref SMARTCARD_FLAG_TC Transmission complete flag |
|
658 |
* @arg @ref SMARTCARD_FLAG_RXNE Receive data register not empty flag |
|
659 |
* @arg @ref SMARTCARD_FLAG_IDLE Idle line detection flag |
|
660 |
* @arg @ref SMARTCARD_FLAG_ORE Overrun error flag |
|
661 |
* @arg @ref SMARTCARD_FLAG_NE Noise error flag |
|
662 |
* @arg @ref SMARTCARD_FLAG_FE Framing error flag |
|
663 |
* @arg @ref SMARTCARD_FLAG_PE Parity error flag |
|
664 |
* @retval The new state of __FLAG__ (TRUE or FALSE). |
|
665 |
*/ |
|
666 |
#define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) |
|
667 |
|
|
668 |
|
|
669 |
/** @brief Enable the specified SmartCard interrupt. |
|
670 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
671 |
* @param __INTERRUPT__ specifies the SMARTCARD interrupt to enable. |
|
672 |
* This parameter can be one of the following values: |
|
673 |
* @arg @ref SMARTCARD_IT_EOB End of block interrupt |
|
674 |
* @arg @ref SMARTCARD_IT_RTO Receive timeout interrupt |
|
675 |
* @arg @ref SMARTCARD_IT_TXE Transmit data register empty interrupt |
|
676 |
* @arg @ref SMARTCARD_IT_TC Transmission complete interrupt |
|
677 |
* @arg @ref SMARTCARD_IT_RXNE Receive data register not empty interrupt |
|
678 |
* @arg @ref SMARTCARD_IT_IDLE Idle line detection interrupt |
|
679 |
* @arg @ref SMARTCARD_IT_PE Parity error interrupt |
|
680 |
* @arg @ref SMARTCARD_IT_ERR Error interrupt(frame error, noise error, overrun error) |
|
681 |
* @retval None |
|
682 |
*/ |
|
683 |
#define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((__INTERRUPT__) & 0xFFU) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
|
684 |
((((__INTERRUPT__) & 0xFFU) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
|
685 |
((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
|
686 |
|
|
687 |
/** @brief Disable the specified SmartCard interrupt. |
|
688 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
689 |
* @param __INTERRUPT__ specifies the SMARTCARD interrupt to disable. |
|
690 |
* This parameter can be one of the following values: |
|
691 |
* @arg @ref SMARTCARD_IT_EOB End of block interrupt |
|
692 |
* @arg @ref SMARTCARD_IT_RTO Receive timeout interrupt |
|
693 |
* @arg @ref SMARTCARD_IT_TXE Transmit data register empty interrupt |
|
694 |
* @arg @ref SMARTCARD_IT_TC Transmission complete interrupt |
|
695 |
* @arg @ref SMARTCARD_IT_RXNE Receive data register not empty interrupt |
|
696 |
* @arg @ref SMARTCARD_IT_IDLE Idle line detection interrupt |
|
697 |
* @arg @ref SMARTCARD_IT_PE Parity error interrupt |
|
698 |
* @arg @ref SMARTCARD_IT_ERR Error interrupt(frame error, noise error, overrun error) |
|
699 |
* @retval None |
|
700 |
*/ |
|
701 |
#define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((__INTERRUPT__) & 0xFFU) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
|
702 |
((((__INTERRUPT__) & 0xFFU) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \ |
|
703 |
((__HANDLE__)->Instance->CR3 &= ~ (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK)))) |
|
704 |
|
|
705 |
|
|
706 |
/** @brief Check whether the specified SmartCard interrupt has occurred or not. |
|
707 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
708 |
* @param __IT__ specifies the SMARTCARD interrupt to check. |
|
709 |
* This parameter can be one of the following values: |
|
710 |
* @arg @ref SMARTCARD_IT_EOB End of block interrupt |
|
711 |
* @arg @ref SMARTCARD_IT_RTO Receive timeout interrupt |
|
712 |
* @arg @ref SMARTCARD_IT_TXE Transmit data register empty interrupt |
|
713 |
* @arg @ref SMARTCARD_IT_TC Transmission complete interrupt |
|
714 |
* @arg @ref SMARTCARD_IT_RXNE Receive data register not empty interrupt |
|
715 |
* @arg @ref SMARTCARD_IT_IDLE Idle line detection interrupt |
|
716 |
* @arg @ref SMARTCARD_IT_ORE Overrun error interrupt |
|
717 |
* @arg @ref SMARTCARD_IT_NE Noise error interrupt |
|
718 |
* @arg @ref SMARTCARD_IT_FE Framing error interrupt |
|
719 |
* @arg @ref SMARTCARD_IT_PE Parity error interrupt |
|
720 |
* @retval The new state of __IT__ (TRUE or FALSE). |
|
721 |
*/ |
|
722 |
#define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & (1U << ((__IT__)>> 0x08U))) |
|
723 |
|
|
724 |
/** @brief Check whether the specified SmartCard interrupt source is enabled or not. |
|
725 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
726 |
* @param __IT__ specifies the SMARTCARD interrupt source to check. |
|
727 |
* This parameter can be one of the following values: |
|
728 |
* @arg @ref SMARTCARD_IT_EOB End of block interrupt |
|
729 |
* @arg @ref SMARTCARD_IT_RTO Receive timeout interrupt |
|
730 |
* @arg @ref SMARTCARD_IT_TXE Transmit data register empty interrupt |
|
731 |
* @arg @ref SMARTCARD_IT_TC Transmission complete interrupt |
|
732 |
* @arg @ref SMARTCARD_IT_RXNE Receive data register not empty interrupt |
|
733 |
* @arg @ref SMARTCARD_IT_IDLE Idle line detection interrupt |
|
734 |
* @arg @ref SMARTCARD_IT_ERR Framing, overrun or noise error interrupt |
|
735 |
* @arg @ref SMARTCARD_IT_PE Parity error interrupt |
|
736 |
* @retval The new state of __IT__ (TRUE or FALSE). |
|
737 |
*/ |
|
738 |
#define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((__IT__) & 0xFFU) >> 5U) == 1U)? (__HANDLE__)->Instance->CR1 : \ |
|
739 |
(((((__IT__) & 0xFFU) >> 5U) == 2U)? (__HANDLE__)->Instance->CR2 : \ |
|
740 |
(__HANDLE__)->Instance->CR3)) & (1U << (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK))) |
|
741 |
|
|
742 |
|
|
743 |
/** @brief Clear the specified SMARTCARD ISR flag, in setting the proper ICR register flag. |
|
744 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
745 |
* @param __IT_CLEAR__ specifies the interrupt clear register flag that needs to be set |
|
746 |
* to clear the corresponding interrupt. |
|
747 |
* This parameter can be one of the following values: |
|
748 |
* @arg @ref SMARTCARD_CLEAR_PEF Parity error clear flag |
|
749 |
* @arg @ref SMARTCARD_CLEAR_FEF Framing error clear flag |
|
750 |
* @arg @ref SMARTCARD_CLEAR_NEF Noise detected clear flag |
|
751 |
* @arg @ref SMARTCARD_CLEAR_OREF OverRun error clear flag |
|
752 |
* @arg @ref SMARTCARD_CLEAR_IDLEF Idle line detection clear flag |
|
753 |
* @arg @ref SMARTCARD_CLEAR_TCF Transmission complete clear flag |
|
754 |
* @arg @ref SMARTCARD_CLEAR_RTOF Receiver timeout clear flag |
|
755 |
* @arg @ref SMARTCARD_CLEAR_EOBF End of block clear flag |
|
756 |
* @retval None |
|
757 |
*/ |
|
758 |
#define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__)) |
|
759 |
|
|
760 |
/** @brief Set a specific SMARTCARD request flag. |
|
761 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
762 |
* @param __REQ__ specifies the request flag to set |
|
763 |
* This parameter can be one of the following values: |
|
764 |
* @arg @ref SMARTCARD_RXDATA_FLUSH_REQUEST Receive data flush Request |
|
765 |
* @arg @ref SMARTCARD_TXDATA_FLUSH_REQUEST Transmit data flush Request |
|
766 |
* |
|
767 |
* @retval None |
|
768 |
*/ |
|
769 |
#define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__)) |
|
770 |
|
|
771 |
/** @brief Enable the SMARTCARD one bit sample method. |
|
772 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
773 |
* @retval None |
|
774 |
*/ |
|
775 |
#define __HAL_SMARTCARD_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT) |
|
776 |
|
|
777 |
/** @brief Disable the SMARTCARD one bit sample method. |
|
778 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
779 |
* @retval None |
|
780 |
*/ |
|
781 |
#define __HAL_SMARTCARD_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT)) |
|
782 |
|
|
783 |
/** @brief Enable the USART associated to the SMARTCARD Handle. |
|
784 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
785 |
* @retval None |
|
786 |
*/ |
|
787 |
#define __HAL_SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE) |
|
788 |
|
|
789 |
/** @brief Disable the USART associated to the SMARTCARD Handle |
|
790 |
* @param __HANDLE__ specifies the SMARTCARD Handle. |
|
791 |
* @retval None |
|
792 |
*/ |
|
793 |
#define __HAL_SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE) |
|
794 |
|
|
795 |
/** |
|
796 |
* @} |
|
797 |
*/ |
|
798 |
|
|
799 |
/* Private macros -------------------------------------------------------------*/ |
|
800 |
/** @defgroup SMARTCARD_Private_Macros SMARTCARD Private Macros |
|
801 |
* @{ |
|
802 |
*/ |
|
803 |
|
|
804 |
/** @brief Check the Baud rate range. |
|
805 |
* @note The maximum Baud Rate is derived from the maximum clock on F0 (48 MHz) |
|
806 |
* divided by the oversampling used on the SMARTCARD (i.e. 16). |
|
807 |
* @param __BAUDRATE__ Baud rate set by the configuration function. |
|
808 |
* @retval Test result (TRUE or FALSE) |
|
809 |
*/ |
|
810 |
#define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 3000001U) |
|
811 |
|
|
812 |
/** @brief Check the block length range. |
|
813 |
* @note The maximum SMARTCARD block length is 0xFF. |
|
814 |
* @param __LENGTH__ block length. |
|
815 |
* @retval Test result (TRUE or FALSE) |
|
816 |
*/ |
|
817 |
#define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFFU) |
|
818 |
|
|
819 |
/** @brief Check the receiver timeout value. |
|
820 |
* @note The maximum SMARTCARD receiver timeout value is 0xFFFFFF. |
|
821 |
* @param __TIMEOUTVALUE__ receiver timeout value. |
|
822 |
* @retval Test result (TRUE or FALSE) |
|
823 |
*/ |
|
824 |
#define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFFU) |
|
825 |
|
|
826 |
/** @brief Check the SMARTCARD autoretry counter value. |
|
827 |
* @note The maximum number of retransmissions is 0x7. |
|
828 |
* @param __COUNT__ number of retransmissions. |
|
829 |
* @retval Test result (TRUE or FALSE) |
|
830 |
*/ |
|
831 |
#define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7U) |
|
832 |
|
|
833 |
/** |
|
834 |
* @brief Ensure that SMARTCARD frame length is valid. |
|
835 |
* @param __LENGTH__ SMARTCARD frame length. |
|
836 |
* @retval SET (__LENGTH__ is valid) or RESET (__LENGTH__ is invalid) |
|
837 |
*/ |
|
838 |
#define IS_SMARTCARD_WORD_LENGTH(__LENGTH__) ((__LENGTH__) == SMARTCARD_WORDLENGTH_9B) |
|
839 |
|
|
840 |
/** |
|
841 |
* @brief Ensure that SMARTCARD frame number of stop bits is valid. |
|
842 |
* @param __STOPBITS__ SMARTCARD frame number of stop bits. |
|
843 |
* @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid) |
|
844 |
*/ |
|
845 |
#define IS_SMARTCARD_STOPBITS(__STOPBITS__) (((__STOPBITS__) == SMARTCARD_STOPBITS_0_5) ||\ |
|
846 |
((__STOPBITS__) == SMARTCARD_STOPBITS_1_5)) |
|
847 |
|
|
848 |
/** |
|
849 |
* @brief Ensure that SMARTCARD frame parity is valid. |
|
850 |
* @param __PARITY__ SMARTCARD frame parity. |
|
851 |
* @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid) |
|
852 |
*/ |
|
853 |
#define IS_SMARTCARD_PARITY(__PARITY__) (((__PARITY__) == SMARTCARD_PARITY_EVEN) || \ |
|
854 |
((__PARITY__) == SMARTCARD_PARITY_ODD)) |
|
855 |
|
|
856 |
/** |
|
857 |
* @brief Ensure that SMARTCARD communication mode is valid. |
|
858 |
* @param __MODE__ SMARTCARD communication mode. |
|
859 |
* @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) |
|
860 |
*/ |
|
861 |
#define IS_SMARTCARD_MODE(__MODE__) ((((__MODE__) & (uint16_t)0xFFF3U) == 0x00U) && ((__MODE__) != (uint16_t)0x00U)) |
|
862 |
|
|
863 |
/** |
|
864 |
* @brief Ensure that SMARTCARD frame polarity is valid. |
|
865 |
* @param __CPOL__ SMARTCARD frame polarity. |
|
866 |
* @retval SET (__CPOL__ is valid) or RESET (__CPOL__ is invalid) |
|
867 |
*/ |
|
868 |
#define IS_SMARTCARD_POLARITY(__CPOL__) (((__CPOL__) == SMARTCARD_POLARITY_LOW) || ((__CPOL__) == SMARTCARD_POLARITY_HIGH)) |
|
869 |
|
|
870 |
/** |
|
871 |
* @brief Ensure that SMARTCARD frame phase is valid. |
|
872 |
* @param __CPHA__ SMARTCARD frame phase. |
|
873 |
* @retval SET (__CPHA__ is valid) or RESET (__CPHA__ is invalid) |
|
874 |
*/ |
|
875 |
#define IS_SMARTCARD_PHASE(__CPHA__) (((__CPHA__) == SMARTCARD_PHASE_1EDGE) || ((__CPHA__) == SMARTCARD_PHASE_2EDGE)) |
|
876 |
|
|
877 |
/** |
|
878 |
* @brief Ensure that SMARTCARD frame last bit clock pulse setting is valid. |
|
879 |
* @param __LASTBIT__ SMARTCARD frame last bit clock pulse setting. |
|
880 |
* @retval SET (__LASTBIT__ is valid) or RESET (__LASTBIT__ is invalid) |
|
881 |
*/ |
|
882 |
#define IS_SMARTCARD_LASTBIT(__LASTBIT__) (((__LASTBIT__) == SMARTCARD_LASTBIT_DISABLE) || \ |
|
883 |
((__LASTBIT__) == SMARTCARD_LASTBIT_ENABLE)) |
|
884 |
|
|
885 |
/** |
|
886 |
* @brief Ensure that SMARTCARD frame sampling is valid. |
|
887 |
* @param __ONEBIT__ SMARTCARD frame sampling. |
|
888 |
* @retval SET (__ONEBIT__ is valid) or RESET (__ONEBIT__ is invalid) |
|
889 |
*/ |
|
890 |
#define IS_SMARTCARD_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_DISABLE) || \ |
|
891 |
((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_ENABLE)) |
|
892 |
|
|
893 |
/** |
|
894 |
* @brief Ensure that SMARTCARD NACK transmission setting is valid. |
|
895 |
* @param __NACK__ SMARTCARD NACK transmission setting. |
|
896 |
* @retval SET (__NACK__ is valid) or RESET (__NACK__ is invalid) |
|
897 |
*/ |
|
898 |
#define IS_SMARTCARD_NACK(__NACK__) (((__NACK__) == SMARTCARD_NACK_ENABLE) || \ |
|
899 |
((__NACK__) == SMARTCARD_NACK_DISABLE)) |
|
900 |
|
|
901 |
/** |
|
902 |
* @brief Ensure that SMARTCARD receiver timeout setting is valid. |
|
903 |
* @param __TIMEOUT__ SMARTCARD receiver timeout setting. |
|
904 |
* @retval SET (__TIMEOUT__ is valid) or RESET (__TIMEOUT__ is invalid) |
|
905 |
*/ |
|
906 |
#define IS_SMARTCARD_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == SMARTCARD_TIMEOUT_DISABLE) || \ |
|
907 |
((__TIMEOUT__) == SMARTCARD_TIMEOUT_ENABLE)) |
|
908 |
|
|
909 |
/** |
|
910 |
* @brief Ensure that SMARTCARD advanced features initialization is valid. |
|
911 |
* @param __INIT__ SMARTCARD advanced features initialization. |
|
912 |
* @retval SET (__INIT__ is valid) or RESET (__INIT__ is invalid) |
|
913 |
*/ |
|
914 |
#define IS_SMARTCARD_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (SMARTCARD_ADVFEATURE_NO_INIT | \ |
|
915 |
SMARTCARD_ADVFEATURE_TXINVERT_INIT | \ |
|
916 |
SMARTCARD_ADVFEATURE_RXINVERT_INIT | \ |
|
917 |
SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \ |
|
918 |
SMARTCARD_ADVFEATURE_SWAP_INIT | \ |
|
919 |
SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \ |
|
920 |
SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \ |
|
921 |
SMARTCARD_ADVFEATURE_MSBFIRST_INIT)) |
|
922 |
|
|
923 |
/** |
|
924 |
* @brief Ensure that SMARTCARD frame TX inversion setting is valid. |
|
925 |
* @param __TXINV__ SMARTCARD frame TX inversion setting. |
|
926 |
* @retval SET (__TXINV__ is valid) or RESET (__TXINV__ is invalid) |
|
927 |
*/ |
|
928 |
#define IS_SMARTCARD_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \ |
|
929 |
((__TXINV__) == SMARTCARD_ADVFEATURE_TXINV_ENABLE)) |
|
930 |
|
|
931 |
/** |
|
932 |
* @brief Ensure that SMARTCARD frame RX inversion setting is valid. |
|
933 |
* @param __RXINV__ SMARTCARD frame RX inversion setting. |
|
934 |
* @retval SET (__RXINV__ is valid) or RESET (__RXINV__ is invalid) |
|
935 |
*/ |
|
936 |
#define IS_SMARTCARD_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \ |
|
937 |
((__RXINV__) == SMARTCARD_ADVFEATURE_RXINV_ENABLE)) |
|
938 |
|
|
939 |
/** |
|
940 |
* @brief Ensure that SMARTCARD frame data inversion setting is valid. |
|
941 |
* @param __DATAINV__ SMARTCARD frame data inversion setting. |
|
942 |
* @retval SET (__DATAINV__ is valid) or RESET (__DATAINV__ is invalid) |
|
943 |
*/ |
|
944 |
#define IS_SMARTCARD_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \ |
|
945 |
((__DATAINV__) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE)) |
|
946 |
|
|
947 |
/** |
|
948 |
* @brief Ensure that SMARTCARD frame RX/TX pins swap setting is valid. |
|
949 |
* @param __SWAP__ SMARTCARD frame RX/TX pins swap setting. |
|
950 |
* @retval SET (__SWAP__ is valid) or RESET (__SWAP__ is invalid) |
|
951 |
*/ |
|
952 |
#define IS_SMARTCARD_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \ |
|
953 |
((__SWAP__) == SMARTCARD_ADVFEATURE_SWAP_ENABLE)) |
|
954 |
|
|
955 |
/** |
|
956 |
* @brief Ensure that SMARTCARD frame overrun setting is valid. |
|
957 |
* @param __OVERRUN__ SMARTCARD frame overrun setting. |
|
958 |
* @retval SET (__OVERRUN__ is valid) or RESET (__OVERRUN__ is invalid) |
|
959 |
*/ |
|
960 |
#define IS_SMARTCARD_OVERRUN(__OVERRUN__) (((__OVERRUN__) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \ |
|
961 |
((__OVERRUN__) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE)) |
|
962 |
|
|
963 |
/** |
|
964 |
* @brief Ensure that SMARTCARD DMA enabling or disabling on error setting is valid. |
|
965 |
* @param __DMA__ SMARTCARD DMA enabling or disabling on error setting. |
|
966 |
* @retval SET (__DMA__ is valid) or RESET (__DMA__ is invalid) |
|
967 |
*/ |
|
968 |
#define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \ |
|
969 |
((__DMA__) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR)) |
|
970 |
|
|
971 |
/** |
|
972 |
* @brief Ensure that SMARTCARD frame MSB first setting is valid. |
|
973 |
* @param __MSBFIRST__ SMARTCARD frame MSB first setting. |
|
974 |
* @retval SET (__MSBFIRST__ is valid) or RESET (__MSBFIRST__ is invalid) |
|
975 |
*/ |
|
976 |
#define IS_SMARTCARD_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \ |
|
977 |
((__MSBFIRST__) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE)) |
|
978 |
|
|
979 |
/** |
|
980 |
* @brief Ensure that SMARTCARD request parameter is valid. |
|
981 |
* @param __PARAM__ SMARTCARD request parameter. |
|
982 |
* @retval SET (__PARAM__ is valid) or RESET (__PARAM__ is invalid) |
|
983 |
*/ |
|
984 |
#define IS_SMARTCARD_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \ |
|
985 |
((__PARAM__) == SMARTCARD_TXDATA_FLUSH_REQUEST)) |
|
986 |
|
|
987 |
/** |
|
988 |
* @} |
|
989 |
*/ |
|
990 |
|
|
991 |
/* Include SMARTCARD HAL Extended module */ |
|
992 |
#include "stm32f0xx_hal_smartcard_ex.h" |
|
993 |
|
|
994 |
/* Exported functions --------------------------------------------------------*/ |
|
995 |
/** @addtogroup SMARTCARD_Exported_Functions |
|
996 |
* @{ |
|
997 |
*/ |
|
998 |
|
|
999 |
/* Initialization and de-initialization functions ****************************/ |
|
1000 |
|
|
1001 |
/** @addtogroup SMARTCARD_Exported_Functions_Group1 |
|
1002 |
* @{ |
|
1003 |
*/ |
|
1004 |
|
|
1005 |
HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1006 |
HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1007 |
void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1008 |
void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1009 |
|
|
1010 |
/** |
|
1011 |
* @} |
|
1012 |
*/ |
|
1013 |
|
|
1014 |
/* IO operation functions *****************************************************/ |
|
1015 |
/** @addtogroup SMARTCARD_Exported_Functions_Group2 |
|
1016 |
* @{ |
|
1017 |
*/ |
|
1018 |
|
|
1019 |
HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
|
1020 |
HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size, uint32_t Timeout); |
|
1021 |
HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
|
1022 |
HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
|
1023 |
HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
|
1024 |
HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size); |
|
1025 |
/* Transfer Abort functions */ |
|
1026 |
HAL_StatusTypeDef HAL_SMARTCARD_Abort(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1027 |
HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1028 |
HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1029 |
HAL_StatusTypeDef HAL_SMARTCARD_Abort_IT(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1030 |
HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit_IT(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1031 |
HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive_IT(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1032 |
|
|
1033 |
void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1034 |
void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1035 |
void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1036 |
void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1037 |
void HAL_SMARTCARD_AbortCpltCallback (SMARTCARD_HandleTypeDef *hsmartcard); |
|
1038 |
void HAL_SMARTCARD_AbortTransmitCpltCallback (SMARTCARD_HandleTypeDef *hsmartcard); |
|
1039 |
void HAL_SMARTCARD_AbortReceiveCpltCallback (SMARTCARD_HandleTypeDef *hsmartcard); |
|
1040 |
|
|
1041 |
/** |
|
1042 |
* @} |
|
1043 |
*/ |
|
1044 |
|
|
1045 |
/* Peripheral State and Error functions ***************************************/ |
|
1046 |
/** @addtogroup SMARTCARD_Exported_Functions_Group3 |
|
1047 |
* @{ |
|
1048 |
*/ |
|
1049 |
|
|
1050 |
HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1051 |
uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard); |
|
1052 |
|
|
1053 |
/** |
|
1054 |
* @} |
|
1055 |
*/ |
|
1056 |
|
|
1057 |
/** |
|
1058 |
* @} |
|
1059 |
*/ |
|
1060 |
|
|
1061 |
/** |
|
1062 |
* @} |
|
1063 |
*/ |
|
1064 |
|
|
1065 |
/** |
|
1066 |
* @} |
|
1067 |
*/ |
|
1068 |
|
|
1069 |
#endif /* !defined(STM32F030x6) && !defined(STM32F030x8)&& !defined(STM32F070x6) && !defined(STM32F070xB) && !defined(STM32F030xC) */ |
|
1070 |
|
|
1071 |
#ifdef __cplusplus |
|
1072 |
} |
|
1073 |
#endif |
|
1074 |
|
|
1075 |
#endif /* __STM32F0xx_HAL_SMARTCARD_H */ |
|
1076 |
|
|
1077 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|
1078 |
|