2 ******************************************************************************
3 * @file stm32f7xx_hal_smartcard.h
4 * @author MCD Application Team
7 * @brief Header file of SMARTCARD HAL module.
8 ******************************************************************************
11 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
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.
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.
35 ******************************************************************************
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F7xx_HAL_SMARTCARD_H
40 #define __STM32F7xx_HAL_SMARTCARD_H
46 /* Includes ------------------------------------------------------------------*/
47 #include "stm32f7xx_hal_def.h"
49 /** @addtogroup STM32F7xx_HAL_Driver
53 /** @addtogroup SMARTCARD
57 /* Exported types ------------------------------------------------------------*/
58 /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types
63 * @brief SMARTCARD Init Structure definition
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))) */
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). */
74 uint32_t StopBits
; /*!< Specifies the number of stop bits.
75 This parameter can be a value of @ref SMARTCARD_Stop_Bits. */
77 uint32_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. */
83 uint32_t Mode
; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
84 This parameter can be a value of @ref SMARTCARD_Mode */
86 uint32_t CLKPolarity
; /*!< Specifies the steady state of the serial clock.
87 This parameter can be a value of @ref SMARTCARD_Clock_Polarity */
89 uint32_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 */
92 uint32_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 */
96 uint32_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 */
100 uint32_t Prescaler
; /*!< Specifies the SmartCard Prescaler */
102 uint32_t GuardTime
; /*!< Specifies the SmartCard Guard Time */
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_State */
108 uint32_t TimeOutEnable
; /*!< Specifies whether the receiver timeout is enabled.
109 This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/
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. */
115 uint32_t BlockLength
; /*!< Specifies the SmartCard Block Length in T=1 Reception mode.
116 This parameter can be any value from 0x0 to 0xFF */
118 uint32_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
123 }SMARTCARD_InitTypeDef
;
126 * @brief SMARTCARD advanced features initalization structure definition
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 SMARTCARDEx_Advanced_Features_Initialization_Type */
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 */
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 */
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 */
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 */
147 uint32_t OverrunDisable
; /*!< Specifies whether the reception overrun detection is disabled.
148 This parameter can be a value of @ref SMARTCARD_Overrun_Disable */
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 */
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 */
156 uint16_t TxCompletionIndication
; /*!< Specifies which transmission completion indication is used: before (when
157 relevant flag is available) or once guard time period has elapsed.
158 This parameter can be a value of @ref SMARTCARDEx_Transmission_Completion_Indication. */
159 }SMARTCARD_AdvFeatureInitTypeDef
;
162 * @brief HAL SMARTCARD State structures definition
163 * @note HAL SMARTCARD State value is a combination of 2 different substates: gState and RxState.
164 * - gState contains SMARTCARD state information related to global Handle management
165 * and also information related to Tx operations.
166 * gState value coding follow below described bitmap :
167 * b7-b6 Error information
172 * b5 IP initilisation status
173 * 0 : Reset (IP not initialized)
174 * 1 : Init done (IP not initialized. HAL SMARTCARD Init function already called)
176 * xx : Should be set to 00
177 * b2 Intrinsic process state
179 * 1 : Busy (IP busy with some configuration or internal operations)
181 * x : Should be set to 0
183 * 0 : Ready (no Tx operation ongoing)
184 * 1 : Busy (Tx operation ongoing)
185 * - RxState contains information related to Rx operations.
186 * RxState value coding follow below described bitmap :
188 * xx : Should be set to 00
189 * b5 IP initilisation status
190 * 0 : Reset (IP not initialized)
191 * 1 : Init done (IP not initialized)
193 * xxx : Should be set to 000
195 * 0 : Ready (no Rx operation ongoing)
196 * 1 : Busy (Rx operation ongoing)
198 * x : Should be set to 0.
202 HAL_SMARTCARD_STATE_RESET
= 0x00U
, /*!< Peripheral is not initialized
203 Value is allowed for gState and RxState */
204 HAL_SMARTCARD_STATE_READY
= 0x20U
, /*!< Peripheral Initialized and ready for use
205 Value is allowed for gState and RxState */
206 HAL_SMARTCARD_STATE_BUSY
= 0x24U
, /*!< an internal process is ongoing
207 Value is allowed for gState only */
208 HAL_SMARTCARD_STATE_BUSY_TX
= 0x21U
, /*!< Data Transmission process is ongoing
209 Value is allowed for gState only */
210 HAL_SMARTCARD_STATE_BUSY_RX
= 0x22U
, /*!< Data Reception process is ongoing
211 Value is allowed for RxState only */
212 HAL_SMARTCARD_STATE_BUSY_TX_RX
= 0x23U
, /*!< Data Transmission and Reception process is ongoing
213 Not to be used for neither gState nor RxState.
214 Value is result of combination (Or) between gState and RxState values */
215 HAL_SMARTCARD_STATE_TIMEOUT
= 0xA0U
, /*!< Timeout state
216 Value is allowed for gState only */
217 HAL_SMARTCARD_STATE_ERROR
= 0xE0U
/*!< Error
218 Value is allowed for gState only */
219 }HAL_SMARTCARD_StateTypeDef
;
222 * @brief SMARTCARD clock sources definition
226 SMARTCARD_CLOCKSOURCE_PCLK1
= 0x00U
, /*!< PCLK1 clock source */
227 SMARTCARD_CLOCKSOURCE_PCLK2
= 0x01U
, /*!< PCLK2 clock source */
228 SMARTCARD_CLOCKSOURCE_HSI
= 0x02U
, /*!< HSI clock source */
229 SMARTCARD_CLOCKSOURCE_SYSCLK
= 0x04U
, /*!< SYSCLK clock source */
230 SMARTCARD_CLOCKSOURCE_LSE
= 0x08U
, /*!< LSE clock source */
231 SMARTCARD_CLOCKSOURCE_UNDEFINED
= 0x10 /*!< undefined clock source */
232 }SMARTCARD_ClockSourceTypeDef
;
235 * @brief SMARTCARD handle Structure definition
239 USART_TypeDef
*Instance
; /*!< USART registers base address */
241 SMARTCARD_InitTypeDef Init
; /*!< SmartCard communication parameters */
243 SMARTCARD_AdvFeatureInitTypeDef AdvancedInit
; /*!< SmartCard advanced features initialization parameters */
245 uint8_t *pTxBuffPtr
; /*!< Pointer to SmartCard Tx transfer Buffer */
247 uint16_t TxXferSize
; /*!< SmartCard Tx Transfer size */
249 __IO
uint16_t TxXferCount
; /*!< SmartCard Tx Transfer Counter */
251 uint8_t *pRxBuffPtr
; /*!< Pointer to SmartCard Rx transfer Buffer */
253 uint16_t RxXferSize
; /*!< SmartCard Rx Transfer size */
255 __IO
uint16_t RxXferCount
; /*!< SmartCard Rx Transfer Counter */
257 DMA_HandleTypeDef
*hdmatx
; /*!< SmartCard Tx DMA Handle parameters */
259 DMA_HandleTypeDef
*hdmarx
; /*!< SmartCard Rx DMA Handle parameters */
261 HAL_LockTypeDef Lock
; /*!< Locking object */
263 __IO HAL_SMARTCARD_StateTypeDef gState
; /*!< SmartCard state information related to global Handle management
264 and also related to Tx operations.
265 This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */
267 __IO HAL_SMARTCARD_StateTypeDef RxState
; /*!< SmartCard state information related to Rx operations.
268 This parameter can be a value of @ref HAL_SMARTCARD_StateTypeDef */
270 __IO
uint32_t ErrorCode
; /* SmartCard Error code */
272 }SMARTCARD_HandleTypeDef
;
277 /* Exported constants --------------------------------------------------------*/
278 /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported constants
281 /** @defgroup SMARTCARD_Error_Code SMARTCARD Error Code
282 * @brief SMARTCARD Error Code
285 #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00U) /*!< No error */
286 #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x01U) /*!< Parity error */
287 #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x02U) /*!< Noise error */
288 #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x04U) /*!< frame error */
289 #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x08U) /*!< Overrun error */
290 #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x10U) /*!< DMA transfer error */
291 #define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x20U) /*!< Receiver TimeOut error */
296 /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length
299 #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M_0)
304 /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Number of Stop Bits
307 #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP))
312 /** @defgroup SMARTCARD_Parity SMARTCARD Parity
315 #define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
316 #define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
321 /** @defgroup SMARTCARD_Mode SMARTCARD Mode
324 #define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE)
325 #define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE)
326 #define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
331 /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity
334 #define SMARTCARD_POLARITY_LOW ((uint32_t)0x0000U)
335 #define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL)
340 /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase
343 #define SMARTCARD_PHASE_1EDGE ((uint32_t)0x0000U)
344 #define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA)
349 /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit
352 #define SMARTCARD_LASTBIT_DISABLE ((uint32_t)0x0000U)
353 #define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL)
358 /** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD OneBit Sampling
361 #define SMARTCARD_ONE_BIT_SAMPLE_DISABLE ((uint32_t)0x0000U)
362 #define SMARTCARD_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT)
368 /** @defgroup SMARTCARD_NACK_State SMARTCARD NACK State
371 #define SMARTCARD_NACK_ENABLE ((uint32_t)USART_CR3_NACK)
372 #define SMARTCARD_NACK_DISABLE ((uint32_t)0x0000U)
377 /** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable
380 #define SMARTCARD_TIMEOUT_DISABLE ((uint32_t)0x00000000U)
381 #define SMARTCARD_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN)
386 /** @defgroup SMARTCARD_DMA_Requests SMARTCARD DMA requests
390 #define SMARTCARD_DMAREQ_TX ((uint32_t)USART_CR3_DMAT)
391 #define SMARTCARD_DMAREQ_RX ((uint32_t)USART_CR3_DMAR)
397 /** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD Advanced Features Initialization Type
400 #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000U)
401 #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001U)
402 #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002U)
403 #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004U)
404 #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008U)
405 #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010U)
406 #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020U)
407 #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080U)
412 /** @defgroup SMARTCARD_Tx_Inv SMARTCARD Tx Inv
415 #define SMARTCARD_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000U)
416 #define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV)
421 /** @defgroup SMARTCARD_Rx_Inv SMARTCARD Rx Inv
424 #define SMARTCARD_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000U)
425 #define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV)
430 /** @defgroup SMARTCARD_Data_Inv SMARTCARD Data Inv
433 #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000U)
434 #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV)
439 /** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD Rx Tx Swap
442 #define SMARTCARD_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000U)
443 #define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP)
448 /** @defgroup SMARTCARD_Overrun_Disable SMARTCARD Overrun Disable
451 #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000U)
452 #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS)
457 /** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD DMA Disable on Rx Error
460 #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000U)
461 #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE)
466 /** @defgroup SMARTCARD_MSB_First SMARTCARD MSB First
469 #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000U)
470 #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST)
475 /** @defgroup SmartCard_Flags SMARTCARD Flags
476 * Elements values convention: 0xXXXX
477 * - 0xXXXX : Flag mask in the ISR register
480 #define SMARTCARD_FLAG_REACK ((uint32_t)0x00400000U)
481 #define SMARTCARD_FLAG_TEACK ((uint32_t)0x00200000U)
482 #define SMARTCARD_FLAG_BUSY ((uint32_t)0x00010000U)
483 #define SMARTCARD_FLAG_EOBF ((uint32_t)0x00001000U)
484 #define SMARTCARD_FLAG_RTOF ((uint32_t)0x00000800U)
485 #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080U)
486 #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040U)
487 #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020U)
488 #define SMARTCARD_FLAG_IDLE ((uint32_t)0x00000010U)
489 #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008U)
490 #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004U)
491 #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002U)
492 #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001U)
497 /** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupt definition
498 * Elements values convention: 0000ZZZZ0XXYYYYYb
499 * - YYYYY : Interrupt source position in the XX register (5bits)
500 * - XX : Interrupt source register (2bits)
504 * - ZZZZ : Flag position in the ISR register(4bits)
508 #define SMARTCARD_IT_PE ((uint16_t)0x0028U)
509 #define SMARTCARD_IT_TXE ((uint16_t)0x0727U)
510 #define SMARTCARD_IT_TC ((uint16_t)0x0626U)
511 #define SMARTCARD_IT_RXNE ((uint16_t)0x0525U)
512 #define SMARTCARD_IT_IDLE ((uint16_t)0x0424U)
513 #define SMARTCARD_IT_ERR ((uint16_t)0x0060U)
514 #define SMARTCARD_IT_ORE ((uint16_t)0x0300U)
515 #define SMARTCARD_IT_NE ((uint16_t)0x0200U)
516 #define SMARTCARD_IT_FE ((uint16_t)0x0100U)
518 #define SMARTCARD_IT_EOB ((uint16_t)0x0C3BU)
519 #define SMARTCARD_IT_RTO ((uint16_t)0x0B3AU)
525 /** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD IT CLEAR Flags
528 #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
529 #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
530 #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
531 #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
532 #define SMARTCARD_CLEAR_IDLEF USART_ICR_IDLECF /*!< Idle line detected clear Flag */
533 #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
534 #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
535 #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
540 /** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters
543 #define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
544 #define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
550 /** @defgroup SMARTCARD_CR3_SCAR_CNT_LSB_POS SMARTCARD CR3 SCAR CNT LSB POS
553 #define SMARTCARD_CR3_SCARCNT_LSB_POS ((uint32_t) 17U)
558 /** @defgroup SMARTCARD_GTPR_GT_LSBPOS SMARTCARD GTPR GT LSBPOS
561 #define SMARTCARD_GTPR_GT_LSB_POS ((uint32_t) 8U)
566 /** @defgroup SMARTCARD_RTOR_BLEN_LSBPOS SMARTCARD RTOR BLEN LSBPOS
569 #define SMARTCARD_RTOR_BLEN_LSB_POS ((uint32_t) 24U)
574 /** @defgroup SMARTCARD_Interruption_Mask SMARTCARD Interruption Mask
577 #define SMARTCARD_IT_MASK ((uint16_t)0x001FU)
586 /* Exported macro ------------------------------------------------------------*/
587 /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros
591 /** @brief Reset SMARTCARD handle state
592 * @param __HANDLE__: specifies the SMARTCARD Handle.
593 * The Handle Instance which can be USART1 or USART2
596 #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET)
598 /** @brief Flush the Smartcard DR register
599 * @param __HANDLE__: specifies the SMARTCARD Handle.
600 * The Handle Instance which can be USART1 or USART2.
603 #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) (__HAL_SMARTCARD_SEND_REQ((__HANDLE__), SMARTCARD_RXDATA_FLUSH_REQUEST))
605 /** @brief Checks whether the specified Smartcard flag is set or not.
606 * @param __HANDLE__: specifies the SMARTCARD Handle.
607 * The Handle Instance which can be USART1 or USART2.
608 * @param __FLAG__: specifies the flag to check.
609 * This parameter can be one of the following values:
610 * @arg SMARTCARD_FLAG_REACK: Receive enable acknowledge flag
611 * @arg SMARTCARD_FLAG_TEACK: Transmit enable acknowledge flag
612 * @arg SMARTCARD_FLAG_BUSY: Busy flag
613 * @arg SMARTCARD_FLAG_EOBF: End of block flag
614 * @arg SMARTCARD_FLAG_RTOF: Receiver timeout flag
615 * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag
616 * @arg SMARTCARD_FLAG_TC: Transmission Complete flag
617 * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag
618 * @arg SMARTCARD_FLAG_ORE: OverRun Error flag
619 * @arg SMARTCARD_FLAG_NE: Noise Error flag
620 * @arg SMARTCARD_FLAG_FE: Framing Error flag
621 * @arg SMARTCARD_FLAG_PE: Parity Error flag
622 * @retval The new state of __FLAG__ (TRUE or FALSE).
624 #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
626 /** @brief Clear the specified SMARTCARD pending flag.
627 * @param __HANDLE__: specifies the SMARTCARD Handle.
628 * @param __FLAG__: specifies the flag to check.
629 * This parameter can be any combination of the following values:
630 * @arg @ref SMARTCARD_CLEAR_PEF Parity error clear flag
631 * @arg @ref SMARTCARD_CLEAR_FEF Framing error clear flag
632 * @arg @ref SMARTCARD_CLEAR_NEF Noise detected clear flag
633 * @arg @ref SMARTCARD_CLEAR_OREF OverRun error clear flag
634 * @arg @ref SMARTCARD_CLEAR_IDLEF Idle line detected clear flag
635 * @arg @ref SMARTCARD_CLEAR_TCF Transmission complete clear flag
637 * @arg @ref SMARTCARD_CLEAR_TCBGTF Transmission complete before guard time clear flag (when flag available)
639 * @arg @ref SMARTCARD_CLEAR_RTOF Receiver timeout clear flag
640 * @arg @ref SMARTCARD_CLEAR_EOBF End of block clear flag
643 #define __HAL_SMARTCARD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
645 /** @brief Clear the SMARTCARD PE pending flag.
646 * @param __HANDLE__: specifies the SMARTCARD Handle.
649 #define __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_PEF)
652 /** @brief Clear the SMARTCARD FE pending flag.
653 * @param __HANDLE__: specifies the SMARTCARD Handle.
656 #define __HAL_SMARTCARD_CLEAR_FEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_FEF)
658 /** @brief Clear the SMARTCARD NE pending flag.
659 * @param __HANDLE__: specifies the SMARTCARD Handle.
662 #define __HAL_SMARTCARD_CLEAR_NEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_NEF)
664 /** @brief Clear the SMARTCARD ORE pending flag.
665 * @param __HANDLE__: specifies the SMARTCARD Handle.
668 #define __HAL_SMARTCARD_CLEAR_OREFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_OREF)
670 /** @brief Clear the SMARTCARD IDLE pending flag.
671 * @param __HANDLE__: specifies the SMARTCARD Handle.
674 #define __HAL_SMARTCARD_CLEAR_IDLEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_IDLEF)
676 /** @brief Enables the specified SmartCard interrupt.
677 * @param __HANDLE__: specifies the SMARTCARD Handle.
678 * The Handle Instance which can be USART1 or USART2.
679 * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable.
680 * This parameter can be one of the following values:
681 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
682 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
683 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
684 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
685 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
686 * @arg SMARTCARD_IT_PE: Parity Error interrupt
687 * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
690 #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
691 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
692 ((__HANDLE__)->Instance->CR3 |= (1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
693 /** @brief Disables the specified SmartCard interrupt.
694 * @param __HANDLE__: specifies the SMARTCARD Handle.
695 * The Handle Instance which can be USART1 or USART2.
696 * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable.
697 * This parameter can be one of the following values:
698 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
699 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
700 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
701 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
702 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
703 * @arg SMARTCARD_IT_PE: Parity Error interrupt
704 * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
707 #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5U) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
708 ((((uint8_t)(__INTERRUPT__)) >> 5U) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
709 ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
711 /** @brief Checks whether the specified SmartCard interrupt has occurred or not.
712 * @param __HANDLE__: specifies the SMARTCARD Handle.
713 * The Handle Instance which can be USART1 or USART2.
714 * @param __IT__: specifies the SMARTCARD interrupt to check.
715 * This parameter can be one of the following values:
716 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
717 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
718 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
719 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
720 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
721 * @arg SMARTCARD_IT_ORE: OverRun Error interrupt
722 * @arg SMARTCARD_IT_NE: Noise Error interrupt
723 * @arg SMARTCARD_IT_FE: Framing Error interrupt
724 * @arg SMARTCARD_IT_PE: Parity Error interrupt
725 * @retval The new state of __IT__ (TRUE or FALSE).
727 #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1U << ((__IT__)>> 0x08U)))
729 /** @brief Checks whether the specified SmartCard interrupt interrupt source is enabled.
730 * @param __HANDLE__: specifies the SMARTCARD Handle.
731 * The Handle Instance which can be USART1 or USART2.
732 * @param __IT__: specifies the SMARTCARD interrupt source to check.
733 * This parameter can be one of the following values:
734 * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
735 * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
736 * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
737 * @arg SMARTCARD_IT_TC: Transmission complete interrupt
738 * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
739 * @arg SMARTCARD_IT_ORE: OverRun Error interrupt
740 * @arg SMARTCARD_IT_NE: Noise Error interrupt
741 * @arg SMARTCARD_IT_FE: Framing Error interrupt
742 * @arg SMARTCARD_IT_PE: Parity Error interrupt
743 * @retval The new state of __IT__ (TRUE or FALSE).
745 #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5U) == 1U)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5U) == 2U)? \
746 (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \
747 (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK)))
750 /** @brief Clears the specified SMARTCARD ISR flag, in setting the proper ICR register flag.
751 * @param __HANDLE__: specifies the SMARTCARD Handle.
752 * The Handle Instance which can be USART1 or USART2.
753 * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
754 * to clear the corresponding interrupt
755 * This parameter can be one of the following values:
756 * @arg USART_CLEAR_PEF: Parity Error Clear Flag
757 * @arg USART_CLEAR_FEF: Framing Error Clear Flag
758 * @arg USART_CLEAR_NEF: Noise detected Clear Flag
759 * @arg USART_CLEAR_OREF: OverRun Error Clear Flag
760 * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag
761 * @arg USART_CLEAR_RTOF: Receiver Time Out Clear Flag
762 * @arg USART_CLEAR_EOBF: End Of Block Clear Flag
765 #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
767 /** @brief Set a specific SMARTCARD request flag.
768 * @param __HANDLE__: specifies the SMARTCARD Handle.
769 * The Handle Instance which can be USART1 or USART2.
770 * @param __REQ__: specifies the request flag to set
771 * This parameter can be one of the following values:
772 * @arg SMARTCARD_RXDATA_FLUSH_REQUEST: Receive Data flush Request
773 * @arg SMARTCARD_TXDATA_FLUSH_REQUEST: Transmit data flush Request
777 #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint32_t)(__REQ__))
779 /** @brief Enable the USART associated to the SMARTCARD Handle
780 * @param __HANDLE__: specifies the SMARTCARD Handle.
781 * The Handle Instance which can be USART1 or USART2.
784 #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
786 /** @brief Disable the USART associated to the SMARTCARD Handle
787 * @param __HANDLE__: specifies the SMARTCARD Handle.
788 * The Handle Instance which can be USART1 or USART2.
791 #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
793 /** @brief Macros to enable or disable the SmartCard DMA request.
794 * @param __HANDLE__: specifies the SMARTCARD Handle.
795 * The Handle Instance which can be USART1 or USART2.
796 * @param __REQUEST__: specifies the SmartCard DMA request.
797 * This parameter can be one of the following values:
798 * @arg SMARTCARD_DMAREQ_TX: SmartCard DMA transmit request
799 * @arg SMARTCARD_DMAREQ_RX: SmartCard DMA receive request
801 #define __HAL_SMARTCARD_DMA_REQUEST_ENABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 |= (__REQUEST__))
802 #define __HAL_SMARTCARD_DMA_REQUEST_DISABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 &= ~(__REQUEST__))
807 /* Include SMARTCARD HAL Extension module */
808 #include "stm32f7xx_hal_smartcard_ex.h"
809 /* Exported functions --------------------------------------------------------*/
810 /** @addtogroup SMARTCARD_Exported_Functions
814 /** @addtogroup SMARTCARD_Exported_Functions_Group1
817 /* Initialization/de-initialization functions **********************************/
818 HAL_StatusTypeDef
HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef
*hsmartcard
);
819 HAL_StatusTypeDef
HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef
*hsmartcard
);
820 void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef
*hsmartcard
);
821 void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef
*hsmartcard
);
826 /** @addtogroup SMARTCARD_Exported_Functions_Group2
829 /* IO operation functions *******************************************************/
830 HAL_StatusTypeDef
HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef
*hsmartcard
, uint8_t *pData
, uint16_t Size
, uint32_t Timeout
);
831 HAL_StatusTypeDef
HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef
*hsmartcard
, uint8_t *pData
, uint16_t Size
, uint32_t Timeout
);
832 HAL_StatusTypeDef
HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef
*hsmartcard
, uint8_t *pData
, uint16_t Size
);
833 HAL_StatusTypeDef
HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef
*hsmartcard
, uint8_t *pData
, uint16_t Size
);
834 HAL_StatusTypeDef
HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef
*hsmartcard
, uint8_t *pData
, uint16_t Size
);
835 HAL_StatusTypeDef
HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef
*hsmartcard
, uint8_t *pData
, uint16_t Size
);
836 /* Transfer Abort functions */
837 HAL_StatusTypeDef
HAL_SMARTCARD_Abort(SMARTCARD_HandleTypeDef
*hsmartcard
);
838 HAL_StatusTypeDef
HAL_SMARTCARD_AbortTransmit(SMARTCARD_HandleTypeDef
*hsmartcard
);
839 HAL_StatusTypeDef
HAL_SMARTCARD_AbortReceive(SMARTCARD_HandleTypeDef
*hsmartcard
);
840 HAL_StatusTypeDef
HAL_SMARTCARD_Abort_IT(SMARTCARD_HandleTypeDef
*hsmartcard
);
841 HAL_StatusTypeDef
HAL_SMARTCARD_AbortTransmit_IT(SMARTCARD_HandleTypeDef
*hsmartcard
);
842 HAL_StatusTypeDef
HAL_SMARTCARD_AbortReceive_IT(SMARTCARD_HandleTypeDef
*hsmartcard
);
844 void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef
*hsmartcard
);
845 void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef
*hsmartcard
);
846 void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef
*hsmartcard
);
847 void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef
*hsmartcard
);
848 void HAL_SMARTCARD_AbortCpltCallback (SMARTCARD_HandleTypeDef
*hsmartcard
);
849 void HAL_SMARTCARD_AbortTransmitCpltCallback (SMARTCARD_HandleTypeDef
*hsmartcard
);
850 void HAL_SMARTCARD_AbortReceiveCpltCallback (SMARTCARD_HandleTypeDef
*hsmartcard
);
856 /** @addtogroup SMARTCARD_Exported_Functions_Group3
859 /* Peripheral State functions **************************************************/
860 HAL_SMARTCARD_StateTypeDef
HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef
*hsmartcard
);
861 uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef
*hsmartcard
);
870 /* Private types -------------------------------------------------------------*/
871 /* Private variables ---------------------------------------------------------*/
872 /* Private constants ---------------------------------------------------------*/
873 /** @defgroup SMARTCARD_Private_Constants SMARTCARD Private Constants
877 #define IS_SMARTCARD_WORD_LENGTH(__LENGTH__) ((__LENGTH__) == SMARTCARD_WORDLENGTH_9B)
878 #define IS_SMARTCARD_STOPBITS(__STOPBITS__) ((__STOPBITS__) == SMARTCARD_STOPBITS_1_5)
879 #define IS_SMARTCARD_PARITY(__PARITY__) (((__PARITY__) == SMARTCARD_PARITY_EVEN) || \
880 ((__PARITY__) == SMARTCARD_PARITY_ODD))
881 #define IS_SMARTCARD_MODE(__MODE__) ((((__MODE__) & (uint32_t)0xFFF3) == 0x00) && ((__MODE__) != (uint32_t)0x00))
882 #define IS_SMARTCARD_POLARITY(__CPOL__) (((__CPOL__) == SMARTCARD_POLARITY_LOW) || ((__CPOL__) == SMARTCARD_POLARITY_HIGH))
883 #define IS_SMARTCARD_PHASE(__CPHA__) (((__CPHA__) == SMARTCARD_PHASE_1EDGE) || ((__CPHA__) == SMARTCARD_PHASE_2EDGE))
884 #define IS_SMARTCARD_LASTBIT(__LASTBIT__) (((__LASTBIT__) == SMARTCARD_LASTBIT_DISABLE) || \
885 ((__LASTBIT__) == SMARTCARD_LASTBIT_ENABLE))
886 #define IS_SMARTCARD_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_DISABLE) || \
887 ((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_ENABLE))
888 #define IS_SMARTCARD_NACK(__NACK__) (((__NACK__) == SMARTCARD_NACK_ENABLE) || \
889 ((__NACK__) == SMARTCARD_NACK_DISABLE))
890 #define IS_SMARTCARD_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == SMARTCARD_TIMEOUT_DISABLE) || \
891 ((__TIMEOUT__) == SMARTCARD_TIMEOUT_ENABLE))
892 #define IS_SMARTCARD_ADVFEATURE_INIT(INIT) ((INIT) <= (SMARTCARD_ADVFEATURE_NO_INIT | \
893 SMARTCARD_ADVFEATURE_TXINVERT_INIT | \
894 SMARTCARD_ADVFEATURE_RXINVERT_INIT | \
895 SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \
896 SMARTCARD_ADVFEATURE_SWAP_INIT | \
897 SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
898 SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \
899 SMARTCARD_ADVFEATURE_MSBFIRST_INIT))
900 #define IS_SMARTCARD_ADVFEATURE_TXINV(TXINV) (((TXINV) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \
901 ((TXINV) == SMARTCARD_ADVFEATURE_TXINV_ENABLE))
902 #define IS_SMARTCARD_ADVFEATURE_RXINV(RXINV) (((RXINV) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \
903 ((RXINV) == SMARTCARD_ADVFEATURE_RXINV_ENABLE))
904 #define IS_SMARTCARD_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \
905 ((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE))
906 #define IS_SMARTCARD_ADVFEATURE_SWAP(SWAP) (((SWAP) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \
907 ((SWAP) == SMARTCARD_ADVFEATURE_SWAP_ENABLE))
908 #define IS_SMARTCARD_OVERRUN(OVERRUN) (((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \
909 ((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE))
910 #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(DMA) (((DMA) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \
911 ((DMA) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR))
912 #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001)
913 #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFF)
914 #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFF)
915 #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7)
916 #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \
917 ((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE))
918 #define IS_SMARTCARD_REQUEST_PARAMETER(PARAM) (((PARAM) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \
919 ((PARAM) == SMARTCARD_TXDATA_FLUSH_REQUEST))
926 /* Private functions ---------------------------------------------------------*/
927 /** @defgroup SMARTCARD_Private_Functions SMARTCARD Private Functions
947 #endif /* __STM32F7xx_HAL_SMARTCARD_H */
949 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/