mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Sep 30 17:00:09 2015 +0100
Revision:
636:a11c0372f0ba
Parent:
631:825f75ca301e
Synchronized with git revision d29c98dae61be0946ddf3a3c641c7726056f9452

Full URL: https://github.com/mbedmicro/mbed/commit/d29c98dae61be0946ddf3a3c641c7726056f9452/

Added support for SAMW25

Who changed what in which revision?

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