stm32f7xx_hal_smartcard.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_smartcard.h
  4. * @author MCD Application Team
  5. * @version V1.0.1
  6. * @date 25-June-2015
  7. * @brief Header file of SMARTCARD HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F7xx_HAL_SMARTCARD_H
  39. #define __STM32F7xx_HAL_SMARTCARD_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f7xx_hal_def.h"
  45. /** @addtogroup STM32F7xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup SMARTCARD
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup SMARTCARD_Exported_Types SMARTCARD Exported Types
  53. * @{
  54. */
  55. /**
  56. * @brief SMARTCARD Init Structure definition
  57. */
  58. typedef struct
  59. {
  60. uint32_t BaudRate; /*!< Configures the SmartCard communication baud rate.
  61. The baud rate register is computed using the following formula:
  62. Baud Rate Register = ((PCLKx) / ((hsc->Init.BaudRate))) */
  63. uint32_t WordLength; /*!< Specifies the number of data bits transmitted or received in a frame.
  64. This parameter @ref SMARTCARD_Word_Length can only be set to 9 (8 data + 1 parity bits). */
  65. uint32_t StopBits; /*!< Specifies the number of stop bits @ref SMARTCARD_Stop_Bits.
  66. Only 1.5 stop bits are authorized in SmartCard mode. */
  67. uint32_t Parity; /*!< Specifies the parity mode.
  68. This parameter can be a value of @ref SMARTCARD_Parity
  69. @note The parity is enabled by default (PCE is forced to 1).
  70. Since the WordLength is forced to 8 bits + parity, M is
  71. forced to 1 and the parity bit is the 9th bit. */
  72. uint32_t Mode; /*!< Specifies whether the Receive or Transmit mode is enabled or disabled.
  73. This parameter can be a value of @ref SMARTCARD_Mode */
  74. uint32_t CLKPolarity; /*!< Specifies the steady state of the serial clock.
  75. This parameter can be a value of @ref SMARTCARD_Clock_Polarity */
  76. uint32_t CLKPhase; /*!< Specifies the clock transition on which the bit capture is made.
  77. This parameter can be a value of @ref SMARTCARD_Clock_Phase */
  78. uint32_t CLKLastBit; /*!< Specifies whether the clock pulse corresponding to the last transmitted
  79. data bit (MSB) has to be output on the SCLK pin in synchronous mode.
  80. This parameter can be a value of @ref SMARTCARD_Last_Bit */
  81. uint32_t OneBitSampling; /*!< Specifies whether a single sample or three samples' majority vote is selected.
  82. Selecting the single sample method increases the receiver tolerance to clock
  83. deviations. This parameter can be a value of @ref SMARTCARD_OneBit_Sampling */
  84. uint32_t Prescaler; /*!< Specifies the SmartCard Prescaler */
  85. uint32_t GuardTime; /*!< Specifies the SmartCard Guard Time */
  86. uint32_t NACKState; /*!< Specifies whether the SmartCard NACK transmission is enabled
  87. in case of parity error.
  88. This parameter can be a value of @ref SMARTCARD_NACK_State */
  89. uint32_t TimeOutEnable; /*!< Specifies whether the receiver timeout is enabled.
  90. This parameter can be a value of @ref SMARTCARD_Timeout_Enable*/
  91. uint32_t TimeOutValue; /*!< Specifies the receiver time out value in number of baud blocks:
  92. it is used to implement the Character Wait Time (CWT) and
  93. Block Wait Time (BWT). It is coded over 24 bits. */
  94. uint32_t BlockLength; /*!< Specifies the SmartCard Block Length in T=1 Reception mode.
  95. This parameter can be any value from 0x0 to 0xFF */
  96. uint32_t AutoRetryCount; /*!< Specifies the SmartCard auto-retry count (number of retries in
  97. receive and transmit mode). When set to 0, retransmission is
  98. disabled. Otherwise, its maximum value is 7 (before signalling
  99. an error) */
  100. }SMARTCARD_InitTypeDef;
  101. /**
  102. * @brief SMARTCARD advanced features initalization structure definition
  103. */
  104. typedef struct
  105. {
  106. uint32_t AdvFeatureInit; /*!< Specifies which advanced SMARTCARD features is initialized. Several
  107. advanced features may be initialized at the same time. This parameter
  108. can be a value of @ref SMARTCARD_Advanced_Features_Initialization_Type */
  109. uint32_t TxPinLevelInvert; /*!< Specifies whether the TX pin active level is inverted.
  110. This parameter can be a value of @ref SMARTCARD_Tx_Inv */
  111. uint32_t RxPinLevelInvert; /*!< Specifies whether the RX pin active level is inverted.
  112. This parameter can be a value of @ref SMARTCARD_Rx_Inv */
  113. uint32_t DataInvert; /*!< Specifies whether data are inverted (positive/direct logic
  114. vs negative/inverted logic).
  115. This parameter can be a value of @ref SMARTCARD_Data_Inv */
  116. uint32_t Swap; /*!< Specifies whether TX and RX pins are swapped.
  117. This parameter can be a value of @ref SMARTCARD_Rx_Tx_Swap */
  118. uint32_t OverrunDisable; /*!< Specifies whether the reception overrun detection is disabled.
  119. This parameter can be a value of @ref SMARTCARD_Overrun_Disable */
  120. uint32_t DMADisableonRxError; /*!< Specifies whether the DMA is disabled in case of reception error.
  121. This parameter can be a value of @ref SMARTCARD_DMA_Disable_on_Rx_Error */
  122. uint32_t MSBFirst; /*!< Specifies whether MSB is sent first on UART line.
  123. This parameter can be a value of @ref SMARTCARD_MSB_First */
  124. }SMARTCARD_AdvFeatureInitTypeDef;
  125. /**
  126. * @brief HAL State structures definition
  127. */
  128. typedef enum
  129. {
  130. HAL_SMARTCARD_STATE_RESET = 0x00, /*!< Peripheral is not yet Initialized */
  131. HAL_SMARTCARD_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
  132. HAL_SMARTCARD_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
  133. HAL_SMARTCARD_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
  134. HAL_SMARTCARD_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
  135. HAL_SMARTCARD_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
  136. HAL_SMARTCARD_STATE_TIMEOUT = 0x03, /*!< Timeout state */
  137. HAL_SMARTCARD_STATE_ERROR = 0x04 /*!< Error */
  138. }HAL_SMARTCARD_StateTypeDef;
  139. /**
  140. * @brief SMARTCARD clock sources definition
  141. */
  142. typedef enum
  143. {
  144. SMARTCARD_CLOCKSOURCE_PCLK1 = 0x00, /*!< PCLK1 clock source */
  145. SMARTCARD_CLOCKSOURCE_PCLK2 = 0x01, /*!< PCLK2 clock source */
  146. SMARTCARD_CLOCKSOURCE_HSI = 0x02, /*!< HSI clock source */
  147. SMARTCARD_CLOCKSOURCE_SYSCLK = 0x04, /*!< SYSCLK clock source */
  148. SMARTCARD_CLOCKSOURCE_LSE = 0x08 /*!< LSE clock source */
  149. }SMARTCARD_ClockSourceTypeDef;
  150. /**
  151. * @brief SMARTCARD handle Structure definition
  152. */
  153. typedef struct
  154. {
  155. USART_TypeDef *Instance; /* USART registers base address */
  156. SMARTCARD_InitTypeDef Init; /* SmartCard communication parameters */
  157. SMARTCARD_AdvFeatureInitTypeDef AdvancedInit; /* SmartCard advanced features initialization parameters */
  158. uint8_t *pTxBuffPtr; /* Pointer to SmartCard Tx transfer Buffer */
  159. uint16_t TxXferSize; /* SmartCard Tx Transfer size */
  160. uint16_t TxXferCount; /* SmartCard Tx Transfer Counter */
  161. uint8_t *pRxBuffPtr; /* Pointer to SmartCard Rx transfer Buffer */
  162. uint16_t RxXferSize; /* SmartCard Rx Transfer size */
  163. uint16_t RxXferCount; /* SmartCard Rx Transfer Counter */
  164. DMA_HandleTypeDef *hdmatx; /* SmartCard Tx DMA Handle parameters */
  165. DMA_HandleTypeDef *hdmarx; /* SmartCard Rx DMA Handle parameters */
  166. HAL_LockTypeDef Lock; /* Locking object */
  167. __IO HAL_SMARTCARD_StateTypeDef State; /* SmartCard communication state */
  168. __IO uint32_t ErrorCode; /* SmartCard Error code */
  169. }SMARTCARD_HandleTypeDef;
  170. /**
  171. * @}
  172. */
  173. /* Exported constants --------------------------------------------------------*/
  174. /** @defgroup SMARTCARD_Exported_Constants SMARTCARD Exported constants
  175. * @{
  176. */
  177. /** @defgroup SMARTCARD_Error_Code SMARTCARD Error Code
  178. * @brief SMARTCARD Error Code
  179. * @{
  180. */
  181. #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00) /*!< No error */
  182. #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x01) /*!< Parity error */
  183. #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x02) /*!< Noise error */
  184. #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x04) /*!< frame error */
  185. #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x08) /*!< Overrun error */
  186. #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x10) /*!< DMA transfer error */
  187. #define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x20) /*!< Receiver TimeOut error */
  188. /**
  189. * @}
  190. */
  191. /** @defgroup SMARTCARD_Word_Length SMARTCARD Word Length
  192. * @{
  193. */
  194. #define SMARTCARD_WORDLENGTH_9B ((uint32_t)USART_CR1_M_0)
  195. /**
  196. * @}
  197. */
  198. /** @defgroup SMARTCARD_Stop_Bits SMARTCARD Number of Stop Bits
  199. * @{
  200. */
  201. #define SMARTCARD_STOPBITS_1_5 ((uint32_t)(USART_CR2_STOP))
  202. /**
  203. * @}
  204. */
  205. /** @defgroup SMARTCARD_Parity SMARTCARD Parity
  206. * @{
  207. */
  208. #define SMARTCARD_PARITY_EVEN ((uint32_t)USART_CR1_PCE)
  209. #define SMARTCARD_PARITY_ODD ((uint32_t)(USART_CR1_PCE | USART_CR1_PS))
  210. /**
  211. * @}
  212. */
  213. /** @defgroup SMARTCARD_Mode SMARTCARD Mode
  214. * @{
  215. */
  216. #define SMARTCARD_MODE_RX ((uint32_t)USART_CR1_RE)
  217. #define SMARTCARD_MODE_TX ((uint32_t)USART_CR1_TE)
  218. #define SMARTCARD_MODE_TX_RX ((uint32_t)(USART_CR1_TE |USART_CR1_RE))
  219. /**
  220. * @}
  221. */
  222. /** @defgroup SMARTCARD_Clock_Polarity SMARTCARD Clock Polarity
  223. * @{
  224. */
  225. #define SMARTCARD_POLARITY_LOW ((uint32_t)0x0000)
  226. #define SMARTCARD_POLARITY_HIGH ((uint32_t)USART_CR2_CPOL)
  227. /**
  228. * @}
  229. */
  230. /** @defgroup SMARTCARD_Clock_Phase SMARTCARD Clock Phase
  231. * @{
  232. */
  233. #define SMARTCARD_PHASE_1EDGE ((uint32_t)0x0000)
  234. #define SMARTCARD_PHASE_2EDGE ((uint32_t)USART_CR2_CPHA)
  235. /**
  236. * @}
  237. */
  238. /** @defgroup SMARTCARD_Last_Bit SMARTCARD Last Bit
  239. * @{
  240. */
  241. #define SMARTCARD_LASTBIT_DISABLE ((uint32_t)0x0000)
  242. #define SMARTCARD_LASTBIT_ENABLE ((uint32_t)USART_CR2_LBCL)
  243. /**
  244. * @}
  245. */
  246. /** @defgroup SMARTCARD_OneBit_Sampling SMARTCARD OneBit Sampling
  247. * @{
  248. */
  249. #define SMARTCARD_ONE_BIT_SAMPLE_DISABLE ((uint32_t)0x0000)
  250. #define SMARTCARD_ONE_BIT_SAMPLE_ENABLE ((uint32_t)USART_CR3_ONEBIT)
  251. /**
  252. * @}
  253. */
  254. /** @defgroup SMARTCARD_NACK_State SMARTCARD NACK State
  255. * @{
  256. */
  257. #define SMARTCARD_NACK_ENABLE ((uint32_t)USART_CR3_NACK)
  258. #define SMARTCARD_NACK_DISABLE ((uint32_t)0x0000)
  259. /**
  260. * @}
  261. */
  262. /** @defgroup SMARTCARD_Timeout_Enable SMARTCARD Timeout Enable
  263. * @{
  264. */
  265. #define SMARTCARD_TIMEOUT_DISABLE ((uint32_t)0x00000000)
  266. #define SMARTCARD_TIMEOUT_ENABLE ((uint32_t)USART_CR2_RTOEN)
  267. /**
  268. * @}
  269. */
  270. /** @defgroup SMARTCARD_DMA_Requests SMARTCARD DMA requests
  271. * @{
  272. */
  273. #define SMARTCARD_DMAREQ_TX ((uint32_t)USART_CR3_DMAT)
  274. #define SMARTCARD_DMAREQ_RX ((uint32_t)USART_CR3_DMAR)
  275. /**
  276. * @}
  277. */
  278. /** @defgroup SMARTCARD_Advanced_Features_Initialization_Type SMARTCARD Advanced Features Initialization Type
  279. * @{
  280. */
  281. #define SMARTCARD_ADVFEATURE_NO_INIT ((uint32_t)0x00000000)
  282. #define SMARTCARD_ADVFEATURE_TXINVERT_INIT ((uint32_t)0x00000001)
  283. #define SMARTCARD_ADVFEATURE_RXINVERT_INIT ((uint32_t)0x00000002)
  284. #define SMARTCARD_ADVFEATURE_DATAINVERT_INIT ((uint32_t)0x00000004)
  285. #define SMARTCARD_ADVFEATURE_SWAP_INIT ((uint32_t)0x00000008)
  286. #define SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT ((uint32_t)0x00000010)
  287. #define SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT ((uint32_t)0x00000020)
  288. #define SMARTCARD_ADVFEATURE_MSBFIRST_INIT ((uint32_t)0x00000080)
  289. /**
  290. * @}
  291. */
  292. /** @defgroup SMARTCARD_Tx_Inv SMARTCARD Tx Inv
  293. * @{
  294. */
  295. #define SMARTCARD_ADVFEATURE_TXINV_DISABLE ((uint32_t)0x00000000)
  296. #define SMARTCARD_ADVFEATURE_TXINV_ENABLE ((uint32_t)USART_CR2_TXINV)
  297. /**
  298. * @}
  299. */
  300. /** @defgroup SMARTCARD_Rx_Inv SMARTCARD Rx Inv
  301. * @{
  302. */
  303. #define SMARTCARD_ADVFEATURE_RXINV_DISABLE ((uint32_t)0x00000000)
  304. #define SMARTCARD_ADVFEATURE_RXINV_ENABLE ((uint32_t)USART_CR2_RXINV)
  305. /**
  306. * @}
  307. */
  308. /** @defgroup SMARTCARD_Data_Inv SMARTCARD Data Inv
  309. * @{
  310. */
  311. #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE ((uint32_t)0x00000000)
  312. #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE ((uint32_t)USART_CR2_DATAINV)
  313. /**
  314. * @}
  315. */
  316. /** @defgroup SMARTCARD_Rx_Tx_Swap SMARTCARD Rx Tx Swap
  317. * @{
  318. */
  319. #define SMARTCARD_ADVFEATURE_SWAP_DISABLE ((uint32_t)0x00000000)
  320. #define SMARTCARD_ADVFEATURE_SWAP_ENABLE ((uint32_t)USART_CR2_SWAP)
  321. /**
  322. * @}
  323. */
  324. /** @defgroup SMARTCARD_Overrun_Disable SMARTCARD Overrun Disable
  325. * @{
  326. */
  327. #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE ((uint32_t)0x00000000)
  328. #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE ((uint32_t)USART_CR3_OVRDIS)
  329. /**
  330. * @}
  331. */
  332. /** @defgroup SMARTCARD_DMA_Disable_on_Rx_Error SMARTCARD DMA Disable on Rx Error
  333. * @{
  334. */
  335. #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR ((uint32_t)0x00000000)
  336. #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR ((uint32_t)USART_CR3_DDRE)
  337. /**
  338. * @}
  339. */
  340. /** @defgroup SMARTCARD_MSB_First SMARTCARD MSB First
  341. * @{
  342. */
  343. #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE ((uint32_t)0x00000000)
  344. #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE ((uint32_t)USART_CR2_MSBFIRST)
  345. /**
  346. * @}
  347. */
  348. /** @defgroup SmartCard_Flags SMARTCARD Flags
  349. * Elements values convention: 0xXXXX
  350. * - 0xXXXX : Flag mask in the ISR register
  351. * @{
  352. */
  353. #define SMARTCARD_FLAG_REACK ((uint32_t)0x00400000)
  354. #define SMARTCARD_FLAG_TEACK ((uint32_t)0x00200000)
  355. #define SMARTCARD_FLAG_BUSY ((uint32_t)0x00010000)
  356. #define SMARTCARD_FLAG_EOBF ((uint32_t)0x00001000)
  357. #define SMARTCARD_FLAG_RTOF ((uint32_t)0x00000800)
  358. #define SMARTCARD_FLAG_TXE ((uint32_t)0x00000080)
  359. #define SMARTCARD_FLAG_TC ((uint32_t)0x00000040)
  360. #define SMARTCARD_FLAG_RXNE ((uint32_t)0x00000020)
  361. #define SMARTCARD_FLAG_IDLE ((uint32_t)0x00000010)
  362. #define SMARTCARD_FLAG_ORE ((uint32_t)0x00000008)
  363. #define SMARTCARD_FLAG_NE ((uint32_t)0x00000004)
  364. #define SMARTCARD_FLAG_FE ((uint32_t)0x00000002)
  365. #define SMARTCARD_FLAG_PE ((uint32_t)0x00000001)
  366. /**
  367. * @}
  368. */
  369. /** @defgroup SMARTCARD_Interrupt_definition SMARTCARD Interrupt definition
  370. * Elements values convention: 0000ZZZZ0XXYYYYYb
  371. * - YYYYY : Interrupt source position in the XX register (5bits)
  372. * - XX : Interrupt source register (2bits)
  373. * - 01: CR1 register
  374. * - 10: CR2 register
  375. * - 11: CR3 register
  376. * - ZZZZ : Flag position in the ISR register(4bits)
  377. * @{
  378. */
  379. #define SMARTCARD_IT_PE ((uint16_t)0x0028)
  380. #define SMARTCARD_IT_TXE ((uint16_t)0x0727)
  381. #define SMARTCARD_IT_TC ((uint16_t)0x0626)
  382. #define SMARTCARD_IT_RXNE ((uint16_t)0x0525)
  383. #define SMARTCARD_IT_IDLE ((uint16_t)0x0424)
  384. #define SMARTCARD_IT_ERR ((uint16_t)0x0060)
  385. #define SMARTCARD_IT_ORE ((uint16_t)0x0300)
  386. #define SMARTCARD_IT_NE ((uint16_t)0x0200)
  387. #define SMARTCARD_IT_FE ((uint16_t)0x0100)
  388. #define SMARTCARD_IT_EOB ((uint16_t)0x0C3B)
  389. #define SMARTCARD_IT_RTO ((uint16_t)0x0B3A)
  390. /**
  391. * @}
  392. */
  393. /** @defgroup SMARTCARD_IT_CLEAR_Flags SMARTCARD IT CLEAR Flags
  394. * @{
  395. */
  396. #define SMARTCARD_CLEAR_PEF USART_ICR_PECF /*!< Parity Error Clear Flag */
  397. #define SMARTCARD_CLEAR_FEF USART_ICR_FECF /*!< Framing Error Clear Flag */
  398. #define SMARTCARD_CLEAR_NEF USART_ICR_NCF /*!< Noise detected Clear Flag */
  399. #define SMARTCARD_CLEAR_OREF USART_ICR_ORECF /*!< OverRun Error Clear Flag */
  400. #define SMARTCARD_CLEAR_IDLEF USART_ICR_IDLECF /*!< Idle line detected clear Flag */
  401. #define SMARTCARD_CLEAR_TCF USART_ICR_TCCF /*!< Transmission Complete Clear Flag */
  402. #define SMARTCARD_CLEAR_RTOF USART_ICR_RTOCF /*!< Receiver Time Out Clear Flag */
  403. #define SMARTCARD_CLEAR_EOBF USART_ICR_EOBCF /*!< End Of Block Clear Flag */
  404. /**
  405. * @}
  406. */
  407. /** @defgroup SMARTCARD_Request_Parameters SMARTCARD Request Parameters
  408. * @{
  409. */
  410. #define SMARTCARD_RXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_RXFRQ) /*!< Receive Data flush Request */
  411. #define SMARTCARD_TXDATA_FLUSH_REQUEST ((uint32_t)USART_RQR_TXFRQ) /*!< Transmit data flush Request */
  412. /**
  413. * @}
  414. */
  415. /** @defgroup SMARTCARD_CR3_SCAR_CNT_LSB_POS SMARTCARD CR3 SCAR CNT LSB POS
  416. * @{
  417. */
  418. #define SMARTCARD_CR3_SCARCNT_LSB_POS ((uint32_t) 17)
  419. /**
  420. * @}
  421. */
  422. /** @defgroup SMARTCARD_GTPR_GT_LSBPOS SMARTCARD GTPR GT LSBPOS
  423. * @{
  424. */
  425. #define SMARTCARD_GTPR_GT_LSB_POS ((uint32_t) 8)
  426. /**
  427. * @}
  428. */
  429. /** @defgroup SMARTCARD_RTOR_BLEN_LSBPOS SMARTCARD RTOR BLEN LSBPOS
  430. * @{
  431. */
  432. #define SMARTCARD_RTOR_BLEN_LSB_POS ((uint32_t) 24)
  433. /**
  434. * @}
  435. */
  436. /** @defgroup SMARTCARD_Interruption_Mask SMARTCARD Interruption Mask
  437. * @{
  438. */
  439. #define SMARTCARD_IT_MASK ((uint16_t)0x001F)
  440. /**
  441. * @}
  442. */
  443. /**
  444. * @}
  445. */
  446. /* Exported macro ------------------------------------------------------------*/
  447. /** @defgroup SMARTCARD_Exported_Macros SMARTCARD Exported Macros
  448. * @{
  449. */
  450. /** @brief Reset SMARTCARD handle state
  451. * @param __HANDLE__: specifies the SMARTCARD Handle.
  452. * The Handle Instance which can be USART1 or USART2
  453. * @retval None
  454. */
  455. #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SMARTCARD_STATE_RESET)
  456. /** @brief Flush the Smartcard DR register
  457. * @param __HANDLE__: specifies the SMARTCARD Handle.
  458. * The Handle Instance which can be USART1 or USART2.
  459. * @retval None
  460. */
  461. #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) (__HAL_SMARTCARD_SEND_REQ((__HANDLE__), SMARTCARD_RXDATA_FLUSH_REQUEST))
  462. /** @brief Checks whether the specified Smartcard flag is set or not.
  463. * @param __HANDLE__: specifies the SMARTCARD Handle.
  464. * The Handle Instance which can be USART1 or USART2.
  465. * @param __FLAG__: specifies the flag to check.
  466. * This parameter can be one of the following values:
  467. * @arg SMARTCARD_FLAG_REACK: Receive enable acknowledge flag
  468. * @arg SMARTCARD_FLAG_TEACK: Transmit enable acknowledge flag
  469. * @arg SMARTCARD_FLAG_BUSY: Busy flag
  470. * @arg SMARTCARD_FLAG_EOBF: End of block flag
  471. * @arg SMARTCARD_FLAG_RTOF: Receiver timeout flag
  472. * @arg SMARTCARD_FLAG_TXE: Transmit data register empty flag
  473. * @arg SMARTCARD_FLAG_TC: Transmission Complete flag
  474. * @arg SMARTCARD_FLAG_RXNE: Receive data register not empty flag
  475. * @arg SMARTCARD_FLAG_ORE: OverRun Error flag
  476. * @arg SMARTCARD_FLAG_NE: Noise Error flag
  477. * @arg SMARTCARD_FLAG_FE: Framing Error flag
  478. * @arg SMARTCARD_FLAG_PE: Parity Error flag
  479. * @retval The new state of __FLAG__ (TRUE or FALSE).
  480. */
  481. #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
  482. /** @brief Enables the specified SmartCard interrupt.
  483. * @param __HANDLE__: specifies the SMARTCARD Handle.
  484. * The Handle Instance which can be USART1 or USART2.
  485. * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable.
  486. * This parameter can be one of the following values:
  487. * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
  488. * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
  489. * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
  490. * @arg SMARTCARD_IT_TC: Transmission complete interrupt
  491. * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
  492. * @arg SMARTCARD_IT_PE: Parity Error interrupt
  493. * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
  494. * @retval None
  495. */
  496. #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5) == 1)? ((__HANDLE__)->Instance->CR1 |= (1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
  497. ((((uint8_t)(__INTERRUPT__)) >> 5) == 2)? ((__HANDLE__)->Instance->CR2 |= (1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
  498. ((__HANDLE__)->Instance->CR3 |= (1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
  499. /** @brief Disables the specified SmartCard interrupt.
  500. * @param __HANDLE__: specifies the SMARTCARD Handle.
  501. * The Handle Instance which can be USART1 or USART2.
  502. * @param __INTERRUPT__: specifies the SMARTCARD interrupt to enable.
  503. * This parameter can be one of the following values:
  504. * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
  505. * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
  506. * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
  507. * @arg SMARTCARD_IT_TC: Transmission complete interrupt
  508. * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
  509. * @arg SMARTCARD_IT_PE: Parity Error interrupt
  510. * @arg SMARTCARD_IT_ERR: Error interrupt(Frame error, noise error, overrun error)
  511. * @retval None
  512. */
  513. #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((uint8_t)(__INTERRUPT__)) >> 5) == 1)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
  514. ((((uint8_t)(__INTERRUPT__)) >> 5) == 2)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
  515. ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1 << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
  516. /** @brief Checks whether the specified SmartCard interrupt has occurred or not.
  517. * @param __HANDLE__: specifies the SMARTCARD Handle.
  518. * The Handle Instance which can be USART1 or USART2.
  519. * @param __IT__: specifies the SMARTCARD interrupt to check.
  520. * This parameter can be one of the following values:
  521. * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
  522. * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
  523. * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
  524. * @arg SMARTCARD_IT_TC: Transmission complete interrupt
  525. * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
  526. * @arg SMARTCARD_IT_ORE: OverRun Error interrupt
  527. * @arg SMARTCARD_IT_NE: Noise Error interrupt
  528. * @arg SMARTCARD_IT_FE: Framing Error interrupt
  529. * @arg SMARTCARD_IT_PE: Parity Error interrupt
  530. * @retval The new state of __IT__ (TRUE or FALSE).
  531. */
  532. #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __IT__) ((__HANDLE__)->Instance->ISR & ((uint32_t)1 << ((__IT__)>> 0x08)))
  533. /** @brief Checks whether the specified SmartCard interrupt interrupt source is enabled.
  534. * @param __HANDLE__: specifies the SMARTCARD Handle.
  535. * The Handle Instance which can be USART1 or USART2.
  536. * @param __IT__: specifies the SMARTCARD interrupt source to check.
  537. * This parameter can be one of the following values:
  538. * @arg SMARTCARD_IT_EOBF: End Of Block interrupt
  539. * @arg SMARTCARD_IT_RTOF: Receive TimeOut interrupt
  540. * @arg SMARTCARD_IT_TXE: Transmit Data Register empty interrupt
  541. * @arg SMARTCARD_IT_TC: Transmission complete interrupt
  542. * @arg SMARTCARD_IT_RXNE: Receive Data register not empty interrupt
  543. * @arg SMARTCARD_IT_ORE: OverRun Error interrupt
  544. * @arg SMARTCARD_IT_NE: Noise Error interrupt
  545. * @arg SMARTCARD_IT_FE: Framing Error interrupt
  546. * @arg SMARTCARD_IT_PE: Parity Error interrupt
  547. * @retval The new state of __IT__ (TRUE or FALSE).
  548. */
  549. #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __IT__) ((((((uint8_t)(__IT__)) >> 5) == 1)? (__HANDLE__)->Instance->CR1:(((((uint8_t)(__IT__)) >> 5) == 2)? \
  550. (__HANDLE__)->Instance->CR2 : (__HANDLE__)->Instance->CR3)) & ((uint32_t)1 << \
  551. (((uint16_t)(__IT__)) & SMARTCARD_IT_MASK)))
  552. /** @brief Clears the specified SMARTCARD ISR flag, in setting the proper ICR register flag.
  553. * @param __HANDLE__: specifies the SMARTCARD Handle.
  554. * The Handle Instance which can be USART1 or USART2.
  555. * @param __IT_CLEAR__: specifies the interrupt clear register flag that needs to be set
  556. * to clear the corresponding interrupt
  557. * This parameter can be one of the following values:
  558. * @arg USART_CLEAR_PEF: Parity Error Clear Flag
  559. * @arg USART_CLEAR_FEF: Framing Error Clear Flag
  560. * @arg USART_CLEAR_NEF: Noise detected Clear Flag
  561. * @arg USART_CLEAR_OREF: OverRun Error Clear Flag
  562. * @arg USART_CLEAR_TCF: Transmission Complete Clear Flag
  563. * @arg USART_CLEAR_RTOF: Receiver Time Out Clear Flag
  564. * @arg USART_CLEAR_EOBF: End Of Block Clear Flag
  565. * @retval None
  566. */
  567. #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR = (uint32_t)(__IT_CLEAR__))
  568. /** @brief Set a specific SMARTCARD request flag.
  569. * @param __HANDLE__: specifies the SMARTCARD Handle.
  570. * The Handle Instance which can be USART1 or USART2.
  571. * @param __REQ__: specifies the request flag to set
  572. * This parameter can be one of the following values:
  573. * @arg SMARTCARD_RXDATA_FLUSH_REQUEST: Receive Data flush Request
  574. * @arg SMARTCARD_TXDATA_FLUSH_REQUEST: Transmit data flush Request
  575. *
  576. * @retval None
  577. */
  578. #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint32_t)(__REQ__))
  579. /** @brief Enable the USART associated to the SMARTCARD Handle
  580. * @param __HANDLE__: specifies the SMARTCARD Handle.
  581. * The Handle Instance which can be USART1 or USART2.
  582. * @retval None
  583. */
  584. #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
  585. /** @brief Disable the USART associated to the SMARTCARD Handle
  586. * @param __HANDLE__: specifies the SMARTCARD Handle.
  587. * The Handle Instance which can be USART1 or USART2.
  588. * @retval None
  589. */
  590. #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ( (__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
  591. /** @brief Macros to enable or disable the SmartCard DMA request.
  592. * @param __HANDLE__: specifies the SMARTCARD Handle.
  593. * The Handle Instance which can be USART1 or USART2.
  594. * @param __REQUEST__: specifies the SmartCard DMA request.
  595. * This parameter can be one of the following values:
  596. * @arg SMARTCARD_DMAREQ_TX: SmartCard DMA transmit request
  597. * @arg SMARTCARD_DMAREQ_RX: SmartCard DMA receive request
  598. */
  599. #define __HAL_SMARTCARD_DMA_REQUEST_ENABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 |= (__REQUEST__))
  600. #define __HAL_SMARTCARD_DMA_REQUEST_DISABLE(__HANDLE__, __REQUEST__) ((__HANDLE__)->Instance->CR3 &= ~(__REQUEST__))
  601. /**
  602. * @}
  603. */
  604. /* Include SMARTCARD HAL Extension module */
  605. #include "stm32f7xx_hal_smartcard_ex.h"
  606. /* Exported functions --------------------------------------------------------*/
  607. /** @addtogroup SMARTCARD_Exported_Functions
  608. * @{
  609. */
  610. /** @addtogroup SMARTCARD_Exported_Functions_Group1
  611. * @{
  612. */
  613. /* Initialization/de-initialization functions **********************************/
  614. HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsc);
  615. HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsc);
  616. void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsc);
  617. void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsc);
  618. /**
  619. * @}
  620. */
  621. /** @addtogroup SMARTCARD_Exported_Functions_Group2
  622. * @{
  623. */
  624. /* IO operation functions *******************************************************/
  625. HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout);
  626. HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout);
  627. HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size);
  628. HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size);
  629. HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size);
  630. HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size);
  631. void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsc);
  632. void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsc);
  633. void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsc);
  634. void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsc);
  635. /**
  636. * @}
  637. */
  638. /** @addtogroup SMARTCARD_Exported_Functions_Group3
  639. * @{
  640. */
  641. /* Peripheral State functions **************************************************/
  642. HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsc);
  643. uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsc);
  644. /**
  645. * @}
  646. */
  647. /**
  648. * @}
  649. */
  650. /* Private types -------------------------------------------------------------*/
  651. /* Private variables ---------------------------------------------------------*/
  652. /* Private constants ---------------------------------------------------------*/
  653. /** @defgroup SMARTCARD_Private_Constants SMARTCARD Private Constants
  654. * @{
  655. */
  656. #define IS_SMARTCARD_WORD_LENGTH(__LENGTH__) ((__LENGTH__) == SMARTCARD_WORDLENGTH_9B)
  657. #define IS_SMARTCARD_STOPBITS(__STOPBITS__) ((__STOPBITS__) == SMARTCARD_STOPBITS_1_5)
  658. #define IS_SMARTCARD_PARITY(__PARITY__) (((__PARITY__) == SMARTCARD_PARITY_EVEN) || \
  659. ((__PARITY__) == SMARTCARD_PARITY_ODD))
  660. #define IS_SMARTCARD_MODE(__MODE__) ((((__MODE__) & (uint32_t)0xFFF3) == 0x00) && ((__MODE__) != (uint32_t)0x00))
  661. #define IS_SMARTCARD_POLARITY(__CPOL__) (((__CPOL__) == SMARTCARD_POLARITY_LOW) || ((__CPOL__) == SMARTCARD_POLARITY_HIGH))
  662. #define IS_SMARTCARD_PHASE(__CPHA__) (((__CPHA__) == SMARTCARD_PHASE_1EDGE) || ((__CPHA__) == SMARTCARD_PHASE_2EDGE))
  663. #define IS_SMARTCARD_LASTBIT(__LASTBIT__) (((__LASTBIT__) == SMARTCARD_LASTBIT_DISABLE) || \
  664. ((__LASTBIT__) == SMARTCARD_LASTBIT_ENABLE))
  665. #define IS_SMARTCARD_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_DISABLE) || \
  666. ((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_ENABLE))
  667. #define IS_SMARTCARD_NACK(__NACK__) (((__NACK__) == SMARTCARD_NACK_ENABLE) || \
  668. ((__NACK__) == SMARTCARD_NACK_DISABLE))
  669. #define IS_SMARTCARD_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == SMARTCARD_TIMEOUT_DISABLE) || \
  670. ((__TIMEOUT__) == SMARTCARD_TIMEOUT_ENABLE))
  671. #define IS_SMARTCARD_ADVFEATURE_INIT(INIT) ((INIT) <= (SMARTCARD_ADVFEATURE_NO_INIT | \
  672. SMARTCARD_ADVFEATURE_TXINVERT_INIT | \
  673. SMARTCARD_ADVFEATURE_RXINVERT_INIT | \
  674. SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \
  675. SMARTCARD_ADVFEATURE_SWAP_INIT | \
  676. SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
  677. SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \
  678. SMARTCARD_ADVFEATURE_MSBFIRST_INIT))
  679. #define IS_SMARTCARD_ADVFEATURE_TXINV(TXINV) (((TXINV) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \
  680. ((TXINV) == SMARTCARD_ADVFEATURE_TXINV_ENABLE))
  681. #define IS_SMARTCARD_ADVFEATURE_RXINV(RXINV) (((RXINV) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \
  682. ((RXINV) == SMARTCARD_ADVFEATURE_RXINV_ENABLE))
  683. #define IS_SMARTCARD_ADVFEATURE_DATAINV(DATAINV) (((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \
  684. ((DATAINV) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE))
  685. #define IS_SMARTCARD_ADVFEATURE_SWAP(SWAP) (((SWAP) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \
  686. ((SWAP) == SMARTCARD_ADVFEATURE_SWAP_ENABLE))
  687. #define IS_SMARTCARD_OVERRUN(OVERRUN) (((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \
  688. ((OVERRUN) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE))
  689. #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(DMA) (((DMA) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \
  690. ((DMA) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR))
  691. #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 4500001)
  692. #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFF)
  693. #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFF)
  694. #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7)
  695. #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(MSBFIRST) (((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \
  696. ((MSBFIRST) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE))
  697. #define IS_SMARTCARD_REQUEST_PARAMETER(PARAM) (((PARAM) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \
  698. ((PARAM) == SMARTCARD_TXDATA_FLUSH_REQUEST))
  699. /**
  700. * @}
  701. */
  702. /* Private functions ---------------------------------------------------------*/
  703. /** @defgroup SMARTCARD_Private_Functions SMARTCARD Private Functions
  704. * @{
  705. */
  706. /**
  707. * @}
  708. */
  709. /**
  710. * @}
  711. */
  712. /**
  713. * @}
  714. */
  715. #ifdef __cplusplus
  716. }
  717. #endif
  718. #endif /* __STM32F7xx_HAL_SMARTCARD_H */
  719. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/