mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
93:e188a91d3eaa
remove SerialHalfDuplex.h

Who changed what in which revision?

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