my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
filartrix
Date:
Wed Apr 08 14:12:53 2015 +0000
Revision:
97:4298809c7c9e
Parent:
93:e188a91d3eaa
First reale BlueNRG module for nucleo 401 board

Who changed what in which revision?

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