mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Oct 29 08:40:18 2015 +0000
Revision:
109:9296ab0bfc11
Child:
122:f9eeca106725
Release 109  of the mbed library

Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix

Who changed what in which revision?

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