Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed May 27 08:07:35 2015 +0100
Revision:
100:cbbeb26dbd92
Release 100 of the mbed library

Changes:
- new target: DISCOF334C8
- API: Ticker/Timer bugfix with constness
- Silabs: RTC, PWM, Serial clocks bufixes
- Renesas: i2c bugfix
- Maxim: 326000 - pin definitions for v2, spi freq fix

Who changed what in which revision?

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