mbed library sources

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Oct 09 08:15:07 2014 +0100
Revision:
340:28d1f895c6fe
Synchronized with git revision b5a4c8e80393336b2656fb29ab46d405d3068602

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

HAL: nrf51822 - Few fixes for PWM and Serial

Who changed what in which revision?

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