The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
92:4fc01daae5a5
Child:
123:b0220dba8be7
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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