Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

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