SPKT

Dependencies:   F746_GUI SD_PlayerSkeleton F746_SAI_IO

Committer:
phungductung
Date:
Tue Jun 04 21:37:21 2019 +0000
Revision:
0:8ede47d38d10
SPKT

Who changed what in which revision?

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